The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
And debug info is here: status false Transaction mined but execution failed transaction hash 0x52339df2d955fba5533f1a93cd8712b8ca1d0a93e09ddc2af7a1b5a41b4db627 from 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 to Fish.(constructor) gas 100000003 gas transaction cost 3660652 gas execution cost 3051582 gas input 0x608...f0033 decoded input {} decoded output - logs [] val 0 wei
contract Fish is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
address public DEAD = 0x000000000000000000000000000000000000dEaD;
bool private swapping;
bool private stakingEnabled = false;
bool public tradingEnabled = false;
uint256 public sellAmount = 0;
uint256 public buyAmount = 0;
uint256 private totalSellFees;
uint256 private totalBuyFees;
FishDividendTracker public dividendTracker;
address payable public marketingWallet;
address payable public devWallet;
// Max tx, dividend threshold and tax variables
uint256 public maxWallet;
uint256 public swapTokensAtAmount;
uint256 public sellRewardsFee;
uint256 public sellDeadFees;
uint256 public sellMarketingFees;
uint256 public sellLiquidityFee;
uint256 public buyDeadFees;
uint256 public buyMarketingFees;
uint256 public buyLiquidityFee;
uint256 public buyRewardsFee;
uint256 public buyDevFee;
uint256 public sellDevFee;
uint256 public transferFee;
bool public swapAndLiquifyEnabled = true;
// gas for processing auto claim dividends
uint256 public gasForProcessing = 300000;
// exlcude from fees and max transaction amount
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public automatedMarketMakerPairs;
// staking variables
mapping(address => uint256) public stakingBonus;
mapping(address => uint256) public stakingUntilDate;
mapping(uint256 => uint256) public stakingAmounts;
//for allowing specific address to trade while trading has not been enabled yet
mapping(address => bool) private canTransferBeforeTradingIsEnabled;
// Limit variables for bot protection
bool public limitsInEffect = true; //boolean used to turn limits on and off
uint256 private gasPriceLimit = 7 * 1 gwei;
mapping(address => uint256) private _holderLastTransferBlock; // for 1 tx per block
mapping(address => uint256) private _holderLastTransferTimestamp; // for sell cooldown timer
uint256 public launchblock;
uint256 public cooldowntimer = 60; //default cooldown 60s
event EnableAccountStaking(address indexed account, uint256 duration);
event UpdateStakingAmounts(uint256 duration, uint256 amount);
event EnableSwapAndLiquify(bool enabled);
event EnableStaking(bool enabled);
event SetPreSaleWallet(address wallet);
event UpdateDividendTracker(
address indexed newAddress,
address indexed oldAddress
);
event UpdateUniswapV2Router(
address indexed newAddress,
address indexed oldAddress
);
event TradingEnabled();
event UpdateFees(
uint256 sellDeadFees,
uint256 sellMarketingFees,
uint256 sellLiquidityFee,
uint256 sellRewardsFee,
uint256 buyDeadFees,
uint256 buyMarketingFees,
uint256 buyLiquidityFee,
uint256 buyRewardsFee,
uint256 buyDevFee,
uint256 sellDevFee
);
event UpdateTransferFee(uint256 transferFee);
event Airdrop(address holder, uint256 amount);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event GasForProcessingUpdated(
uint256 indexed newValue,
uint256 indexed oldValue
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
event SendDividends(uint256 amount, uint256 opAmount, bool success);
event ProcessedDividendTracker(
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex,
bool indexed automatic,
uint256 gas,
address indexed processor
);
event UpdatePayoutToken(address token);
constructor() ERC20("Fish", "Fsh") {
marketingWallet = payable(0xd9145CCE52D386f254917e481eB44e9943F39138);
devWallet = payable(0xd9145CCE52D386f254917e481eB44e9943F39138);
address router = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
buyDeadFees = 0;
sellDeadFees = 0;
buyMarketingFees = 4;
sellMarketingFees = 4;
buyLiquidityFee = 1;
sellLiquidityFee = 1;
buyRewardsFee = 3;
sellRewardsFee = 3;
buyDevFee = 0;
sellDevFee = 0;
transferFee = 15;
totalBuyFees = buyRewardsFee
.add(buyLiquidityFee)
.add(buyMarketingFees)
.add(buyDevFee);
totalSellFees = sellRewardsFee
.add(sellLiquidityFee)
.add(sellMarketingFees)
.add(sellDevFee);
dividendTracker = new FishDividendTracker(
payable(this),
router,
0x893535ED1b5C6969E62a10bABfED4F5fF8373278,
"FishTRACKER",
"FshTRACKER"
);
uniswapV2Router = IUniswapV2Router02(router);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
address(this),
uniswapV2Router.WETH()
);
_setAutomatedMarketMakerPair(uniswapV2Pair, true);
// exclude from receiving dividends
dividendTracker.excludeFromDividends(address(dividendTracker));
dividendTracker.excludeFromDividends(address(this));
dividendTracker.excludeFromDividends(DEAD);
dividendTracker.excludedFromDividends(address(0));
dividendTracker.excludeFromDividends(router);
dividendTracker.excludeFromDividends(marketingWallet);
dividendTracker.excludeFromDividends(owner());
// exclude from paying fees or having max transaction amount
_isExcludedFromFees[address(this)] = true;
_isExcludedFromFees[address(dividendTracker)] = true;
_isExcludedFromFees[address(marketingWallet)] = true;
_isExcludedFromFees[address(devWallet)] = true;
_isExcludedFromFees[msg.sender] = true;
uint256 totalTokenSupply = (1_000_000_000) * (10**18);
_mint(owner(), totalTokenSupply); // only time internal mint function is ever called is to create supply
maxWallet = totalTokenSupply / 200000; // 0.005%
swapTokensAtAmount = totalTokenSupply / 2000000; // 0.05%;
canTransferBeforeTradingIsEnabled[owner()] = true;
canTransferBeforeTradingIsEnabled[address(this)] = true;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
receive() external payable {}
function updateStakingAmounts(uint256 duration, uint256 bonus)
public
onlyOwner
{
require(stakingAmounts[duration] != bonus);
require(bonus <= 100, "Staking bonus can't exceed 100");
stakingAmounts[duration] = bonus;
emit UpdateStakingAmounts(duration, bonus);
}
// writeable function to enable trading, can only enable, trading can never be disabled
function enableTrading() external onlyOwner {
require(!tradingEnabled);
tradingEnabled = true;
launchblock = block.number;
emit TradingEnabled();
}
// use for pre sale wallet, adds all exclusions to it
function setPresaleWallet(address wallet) external onlyOwner {
canTransferBeforeTradingIsEnabled[wallet] = true;
_isExcludedFromFees[wallet] = true;
dividendTracker.excludeFromDividends(wallet);
emit SetPreSaleWallet(wallet);
}
// exclude a wallet from fees
function setExcludeFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
// exclude from dividends (rewards)
function setExcludeDividends(address account) public onlyOwner {
dividendTracker.excludeFromDividends(account);
}
// include in dividends
function setIncludeDividends(address account) public onlyOwner {
dividendTracker.includeFromDividends(account);
dividendTracker.setBalance(account, getStakingBalance(account));
}
//allow a wallet to trade before trading enabled
function setCanTransferBefore(address wallet, bool enable)
external
onlyOwner
{
canTransferBeforeTradingIsEnabled[wallet] = enable;
}
// turn limits on and off
function setLimitsInEffect(bool value) external onlyOwner {
limitsInEffect = value;
}
// set max GWEI
function setGasPriceLimit(uint256 GWEI) external onlyOwner {
require(GWEI >= 5, "can never be set below 5");
gasPriceLimit = GWEI * 1 gwei;
}
// set cooldown timer, can only be between 0 and 300 seconds (5 mins max)
function setcooldowntimer(uint256 value) external onlyOwner {
require(value <= 300, "cooldown timer cannot exceed 5 minutes");
cooldowntimer = value;
}
// set max wallet, can not be lower than 0.05% of supply
function setmaxWallet(uint256 value) external onlyOwner {
value = value * (10**18);
require(value >= _totalSupply / 2000, "max wallet cannot be set to less than 0.05%");
maxWallet = value;
}
function enableStaking(bool enable) public onlyOwner {
require(stakingEnabled != enable);
stakingEnabled = enable;
emit EnableStaking(enable);
}
function stake(uint256 duration) public {
require(stakingEnabled, "Staking is not enabled");
require(stakingAmounts[duration] != 0, "Invalid staking duration");
require(
stakingUntilDate[_msgSender()] < block.timestamp.add(duration),
"already staked for a longer duration"
);
stakingBonus[_msgSender()] = stakingAmounts[duration];
stakingUntilDate[_msgSender()] = block.timestamp.add(duration);
dividendTracker.setBalance(
_msgSender(),
getStakingBalance(_msgSender())
);
emit EnableAccountStaking(_msgSender(), duration);
}
// rewards threshold
function setSwapTriggerAmount(uint256 amount) public onlyOwner {
swapTokensAtAmount = amount * (10**18);
}
function enableSwapAndLiquify(bool enabled) public onlyOwner {
require(swapAndLiquifyEnabled != enabled);
swapAndLiquifyEnabled = enabled;
emit EnableSwapAndLiquify(enabled);
}
function setAutomatedMarketMakerPair(address pair, bool value)
public
onlyOwner
{
_setAutomatedMarketMakerPair(pair, value);
}
function setAllowCustomTokens(bool allow) public onlyOwner {
dividendTracker.setAllowCustomTokens(allow);
}
function setAllowAutoReinvest(bool allow) public onlyOwner {
dividendTracker.setAllowAutoReinvest(allow);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
if (value) {
dividendTracker.excludeFromDividends(pair);
}
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateGasForProcessing(uint256 newValue) public onlyOwner {
require(newValue >= 200000 && newValue <= 1000000);
emit GasForProcessingUpdated(newValue, gasForProcessing);
gasForProcessing = newValue;
}
function transferAdmin(address newOwner) public onlyOwner {
dividendTracker.excludeFromDividends(newOwner);
_isExcludedFromFees[newOwner] = true;
transferOwnership(newOwner);
}
function updateTransferFee(uint256 newTransferFee) public onlyOwner {
require (newTransferFee <= 15, "transfer fee cannot exceed 15%");
transferFee = newTransferFee;
emit UpdateTransferFee(transferFee);
}
function updateFees(
uint256 deadBuy,
uint256 deadSell,
uint256 marketingBuy,
uint256 marketingSell,
uint256 liquidityBuy,
uint256 liquiditySell,
uint256 RewardsBuy,
uint256 RewardsSell,
uint256 devBuy,
uint256 devSell
) public onlyOwner {
buyDeadFees = deadBuy;
buyMarketingFees = marketingBuy;
buyLiquidityFee = liquidityBuy;
buyRewardsFee = RewardsBuy;
sellDeadFees = deadSell;
sellMarketingFees = marketingSell;
sellLiquidityFee = liquiditySell;
sellRewardsFee = RewardsSell;
buyDevFee = devBuy;
sellDevFee = devSell;
totalSellFees = sellRewardsFee
.add(sellLiquidityFee)
.add(sellMarketingFees)
.add(sellDevFee);
totalBuyFees = buyRewardsFee
.add(buyLiquidityFee)
.add(buyMarketingFees)
.add(buyDevFee);
require(totalSellFees <= 100 && totalBuyFees <= 100, "total fees cannot exceed 15% sell or buy");
emit UpdateFees(
sellDeadFees,
sellMarketingFees,
sellLiquidityFee,
sellRewardsFee,
buyDeadFees,
buyMarketingFees,
buyLiquidityFee,
buyRewardsFee,
buyDevFee,
sellDevFee
);
}
function getStakingInfo(address account)
external
view
returns (uint256, uint256)
{
return (stakingUntilDate[account], stakingBonus[account]);
}
function getTotalDividendsDistributed() external view returns (uint256) {
return dividendTracker.totalDividendsDistributed();
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
function withdrawableDividendOf(address account)
public
view
returns (uint256)
{
return dividendTracker.withdrawableDividendOf(account);
}
function dividendTokenBalanceOf(address account)
public
view
returns (uint256)
{
return dividendTracker.balanceOf(account);
}
function getAccountDividendsInfo(address account)
external
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256
)
{
return dividendTracker.getAccount(account);
}
function getAccountDividendsInfoAtIndex(uint256 index)
external
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256
)
{
return dividendTracker.getAccountAtIndex(index);
}
function processDividendTracker(uint256 gas) external {
(
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex
) = dividendTracker.process(gas);
emit ProcessedDividendTracker(
iterations,
claims,
lastProcessedIndex,
false,
gas,
tx.origin
);
}
function claim() external {
dividendTracker.processAccount(payable(msg.sender), false);
}
function getLastProcessedIndex() external view returns (uint256) {
return dividendTracker.getLastProcessedIndex();
}
function getNumberOfDividendTokenHolders() external view returns (uint256) {
return dividendTracker.getNumberOfTokenHolders();
}
function setAutoClaim(bool value) external {
dividendTracker.setAutoClaim(msg.sender, value);
}
function setReinvest(bool value) external {
dividendTracker.setReinvest(msg.sender, value);
}
function setDividendsPaused(bool value) external onlyOwner {
dividendTracker.setDividendsPaused(value);
}
function isExcludedFromAutoClaim(address account)
external
view
returns (bool)
{
return dividendTracker.isExcludedFromAutoClaim(account);
}
function isReinvest(address account) external view returns (bool) {
return dividendTracker.isReinvest(account);
}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 RewardsFee;
uint256 deadFees;
uint256 marketingFees;
uint256 liquidityFee;
uint256 devFees;
if (!canTransferBeforeTradingIsEnabled[from]) {
require(tradingEnabled, "Trading has not yet been enabled");
}
if (amount == 0) {
super._transfer(from, to, 0);
return;
} else if (
!swapping && !_isExcludedFromFees[from] && !_isExcludedFromFees[to]
) {
bool isSelling = automatedMarketMakerPairs[to];
bool isBuying = automatedMarketMakerPairs[from];
if (!isBuying && !isSelling) {
uint256 tFees = amount.mul(transferFee).div(100);
amount = amount.sub(tFees);
super._transfer(from, address(this), tFees);
super._transfer(from, to, amount);
dividendTracker.setBalance(from, getStakingBalance(from));
dividendTracker.setBalance(to, getStakingBalance(to));
return;
}
else if (!isBuying && stakingEnabled) {
require(
stakingUntilDate[from] <= block.timestamp,
"Tokens are staked and locked!"
);
if (stakingUntilDate[from] != 0) {
stakingUntilDate[from] = 0;
stakingBonus[from] = 0;
}
}
else if (isSelling) {
RewardsFee = sellRewardsFee;
deadFees = sellDeadFees;
marketingFees = sellMarketingFees;
liquidityFee = sellLiquidityFee;
devFees = sellDevFee;
if (limitsInEffect) {
require(block.timestamp >= _holderLastTransferTimestamp[tx.origin] + cooldowntimer,
"cooldown period active");
_holderLastTransferTimestamp[tx.origin] = block.timestamp;
}
} else if (isBuying) {
RewardsFee = buyRewardsFee;
deadFees = buyDeadFees;
marketingFees = buyMarketingFees;
liquidityFee = buyLiquidityFee;
devFees = buyDevFee;
if (limitsInEffect) {
require(block.number > launchblock + 30,"you shall not pass");
require(tx.gasprice <= gasPriceLimit,"Gas price exceeds limit.");
require(_holderLastTransferBlock[tx.origin] != block.number,"Too many TX in block");
_holderLastTransferBlock[tx.origin] = block.number;
}
uint256 contractBalanceRecipient = balanceOf(to);
require(contractBalanceRecipient + amount <= maxWallet,
"Exceeds maximum wallet token amount." );
}
uint256 totalFees = RewardsFee
.add(liquidityFee + marketingFees + devFees);
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (canSwap && !automatedMarketMakerPairs[from]) {
swapping = true;
if (swapAndLiquifyEnabled && liquidityFee > 0 && totalBuyFees > 0) {
uint256 totalBuySell = buyAmount.add(sellAmount);
uint256 swapAmountBought = contractTokenBalance
.mul(buyAmount)
.div(totalBuySell);
uint256 swapAmountSold = contractTokenBalance
.mul(sellAmount)
.div(totalBuySell);
uint256 swapBuyTokens = swapAmountBought
.mul(liquidityFee)
.div(totalBuyFees);
uint256 swapSellTokens = swapAmountSold
.mul(liquidityFee)
.div(totalSellFees);
uint256 swapTokens = swapSellTokens.add(swapBuyTokens);
swapAndLiquify(swapTokens);
}
uint256 remainingBalance = balanceOf(address(this));
swapAndSendDividends(remainingBalance);
buyAmount = 0;
sellAmount = 0;
swapping = false;
}
uint256 fees = amount.mul(totalFees).div(100);
uint256 burntokens;
if (deadFees > 0) {
burntokens = amount.mul(deadFees) / 100;
super._transfer(from, DEAD, burntokens);
_totalSupply = _totalSupply.sub(burntokens);
}
amount = amount.sub(fees + burntokens);
if (isSelling) {
sellAmount = sellAmount.add(fees);
} else {
buyAmount = buyAmount.add(fees);
}
super._transfer(from, address(this), fees);
uint256 gas = gasForProcessing;
try dividendTracker.process(gas) returns (
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex
) {
emit ProcessedDividendTracker(
iterations,
claims,
lastProcessedIndex,
true,
gas,
tx.origin
);
} catch {}
}
super._transfer(from, to, amount);
dividendTracker.setBalance(from, getStakingBalance(from));
dividendTracker.setBalance(to, getStakingBalance(to));
}
function getStakingBalance(address account) private view returns (uint256) {
return
stakingEnabled
? balanceOf(account).mul(stakingBonus[account].add(100)).div(
100
)
: balanceOf(account);
}
function swapAndLiquify(uint256 tokens) private {
uint256 half = tokens.div(2);
uint256 otherHalf = tokens.sub(half);
uint256 initialBalance = address(this).balance;
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function updatePayoutToken(address token) public onlyOwner {
dividendTracker.updatePayoutToken(token);
emit UpdatePayoutToken(token);
}
function getPayoutToken() public view returns (address) {
return dividendTracker.getPayoutToken();
}
function setMinimumTokenBalanceForAutoDividends(uint256 value)
public
onlyOwner
{
dividendTracker.setMinimumTokenBalanceForAutoDividends(value);
}
function setMinimumTokenBalanceForDividends(uint256 value)
public
onlyOwner
{
dividendTracker.setMinimumTokenBalanceForDividends(value);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function forceSwapAndSendDividends(uint256 tokens) public onlyOwner {
tokens = tokens * (10**18);
uint256 totalAmount = buyAmount.add(sellAmount);
uint256 fromBuy = tokens.mul(buyAmount).div(totalAmount);
uint256 fromSell = tokens.mul(sellAmount).div(totalAmount);
swapAndSendDividends(tokens);
buyAmount = buyAmount.sub(fromBuy);
sellAmount = sellAmount.sub(fromSell);
}
function swapAndSendDividends(uint256 tokens) private {
if (tokens == 0) {
return;
}
swapTokensForEth(tokens);
uint256 totalAmount = buyAmount.add(sellAmount);
bool success = true;
bool successOp1 = true;
bool successOp2 = true;
uint256 dividends;
uint256 dividendsFromBuy;
uint256 dividendsFromSell;
THERE MORE THAT GOT CUT OFF