// SPDX-License-Identifier: MIT// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)pragmasolidity ^0.8.0;/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/abstractcontractContext{
function_msgSender() internalviewvirtualreturns (address) {
returnmsg.sender;
}
function_msgData() internalviewvirtualreturns (bytescalldata) {
returnmsg.data;
}
}
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)pragmasolidity ^0.8.0;import"../utils/Context.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.
*/abstractcontractOwnableisContext{
addressprivate _owner;
eventOwnershipTransferred(addressindexed previousOwner, addressindexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/modifieronlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/functionowner() publicviewvirtualreturns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/function_checkOwner() internalviewvirtual{
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.
*/functionrenounceOwnership() publicvirtualonlyOwner{
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/functiontransferOwnership(address newOwner) publicvirtualonlyOwner{
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) internalvirtual{
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Contract Source Code
File 8 of 9: ReentrancyGuard.sol
// SPDX-License-Identifier: MIT// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)pragmasolidity ^0.8.0;/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/abstractcontractReentrancyGuard{
// Booleans are more expensive than uint256 or any type that takes up a full// word because each write operation emits an extra SLOAD to first read the// slot's contents, replace the bits taken up by the boolean, and then write// back. This is the compiler's defense against contract upgrades and// pointer aliasing, and it cannot be disabled.// The values being non-zero value makes deployment a bit more expensive,// but in exchange the refund on every call to nonReentrant will be lower in// amount. Since refunds are capped to a percentage of the total// transaction's gas, it is best to keep them low in cases like this one, to// increase the likelihood of the full refund coming into effect.uint256privateconstant _NOT_ENTERED =1;
uint256privateconstant _ENTERED =2;
uint256private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/modifiernonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function_nonReentrantBefore() private{
// On the first call to nonReentrant, _status will be _NOT_ENTEREDrequire(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function_nonReentrantAfter() private{
// By storing the original value once again, a refund is triggered (see// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
Contract Source Code
File 9 of 9: Yeet.sol
/*
| |
░░ ░░ ░░░░░░░ ░░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░
▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒
▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒ ▒▒▒▒▒ ▒▒ ▒▒ ▒▒
▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓
██ ███████ ███████ ██ ███████ ██ ██████
It's time to go up only.
Website: https://yeetzejeet.com
Docs: https://docs.yeetzejeet.com
Telegram: https://t.me/YeetZeJeet
Twitter: https://twitter.com/YeetZeJeet
*/// SPDX-License-Identifier: MITpragmasolidity 0.8.19;import"lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import"lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
import"lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol";
import"interfaces/IUniswapV2Router02.sol";
import"interfaces/IUniswapV2Pair.sol";
import"interfaces/IUniswapV2Factory.sol";
contractYeetisIERC20, Ownable, ReentrancyGuard{
stringpublic name ="Yeet ze Jeet 2.0";
stringpublic symbol ="YEET";
uint8public decimals =18;
uint256public totalSupply;
mapping(address=>uint256) public balanceOf;
mapping(address=>mapping(address=>uint256)) private _allowances;
mapping(address=>bool) public isExcludedFromTax;
boolpublic isTimeToYeet;
boolpublic tradingOpen;
boolpublic dynamicTaxOn =true;
uint256public baseSellTax =10e12; // 10%uint256public maxWallet;
uint256public floorYeetReserve;
uint256public floorEthReserve;
uint256public yeetCooldown =24hours;
uint256public lastYeetTimestamp;
IUniswapV2Pair publicimmutable uniswapV2Pair;
IUniswapV2Router02 publicimmutable uniswapV2Router;
addresspayablepublic devWallet;
addresspayablepublic marketingWallet;
constructor() {
totalSupply =2_000_000e18;
balanceOf[msg.sender] = totalSupply;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Pair(
IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH())
);
devWallet =payable(0x4783c30AEa0A1a467aD4662a2e19e742d00865D9);
marketingWallet =payable(0xCc3E3C5044e461ECe6cC6D0577c146998D3eD37A);
maxWallet = totalSupply /50; // 2%
isExcludedFromTax[owner()] =true;
isExcludedFromTax[address(this)] =true;
isExcludedFromTax[devWallet] =true;
isExcludedFromTax[marketingWallet] =true;
isExcludedFromTax[0xAbc1508B730c7Edd3811e31591f66616d71271Ea] =true; // Presale addr
isExcludedFromTax[0x2c952eE289BbDB3aEbA329a4c41AE4C836bcc231] =true; // Wentokens addr
}
eventYeeted(uint256 prevYeetReserve,
uint256 prevEthReserve,
uint256 newYeetReserve,
uint256 newEthReserve,
uint256 prevPrice,
uint256 newPrice,
uint256 yeetBurned
);
eventNewFloorSet(uint256 prevFloorPrice, uint256 newFloorPrice);
eventJeetDetected(address who, uint256 amountSold, uint256 taxPaid);
bool inSwap =false;
modifierlockTheSwap() {
inSwap =true;
_;
inSwap =false;
}
receive() externalpayable{}
functionallowance(address owner, address spender) publicviewoverridereturns (uint256) {
return _allowances[owner][spender];
}
functionapprove(address spender, uint256 amount) publicoverridereturns (bool) {
_approve(_msgSender(), spender, amount);
returntrue;
}
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_spendAllowance(address owner, address spender, uint256 amount) private{
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance !=type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
functiontransfer(address recipient, uint256 amount) externalreturns (bool) {
_transfer(_msgSender(), recipient, amount);
emit Transfer(msg.sender, recipient, amount);
returntrue;
}
functiontransferFrom(address sender, address recipient, uint256 amount) externalreturns (bool) {
_spendAllowance(sender, _msgSender(), amount);
_transfer(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
returntrue;
}
function_transfer(addressfrom, 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 (!tradingOpen) {
require(isExcludedFromTax[from], "Can't trade yet");
}
uint256 taxAmount =0;
if (isTimeToYeet &&!isExcludedFromTax[from] &&!isExcludedFromTax[to]) {
if (from==address(uniswapV2Pair) && to !=address(uniswapV2Router)) {
require(balanceOf[to] + amount <= maxWallet, "Max wallet exceeded");
}
if (to ==address(uniswapV2Pair) &&from!=address(this)) {
taxAmount = getTaxAmount(amount);
emit JeetDetected(from, amount, taxAmount);
}
if (taxAmount >0) {
balanceOf[address(this)] += taxAmount;
emit Transfer(from, address(this), taxAmount);
}
uint256 contractTokenBalance = balanceOf[address(this)];
bool canSwap = contractTokenBalance >0;
if (canSwap &&!inSwap && to ==address(uniswapV2Pair)) {
swapAndBurn(contractTokenBalance);
}
}
balanceOf[from] -= amount;
balanceOf[to] += amount - taxAmount;
}
functionswapAndBurn(uint256 tokenAmount) privatelockTheSwap{
(uint256 toSwap, uint256 toBurn) = getSwapAndBurnAmounts(tokenAmount);
burnFrom(address(this), toBurn);
swapTokensForEth(toSwap);
}
functionburnFrom(address account, uint256 amount) private{
address deadAddress =0x000000000000000000000000000000000000dEaD;
balanceOf[account] -= amount;
balanceOf[deadAddress] += amount;
emit Transfer(account, deadAddress, amount);
}
functionswapTokensForEth(uint256 tokenAmount) private{
address[] memory path =newaddress[](2);
path[0] =address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount, 0, path, address(this), block.timestamp
);
uint256 contractEth =address(this).balance;
uint256 ethToDev = (contractEth *70) /100;
uint256 ethToMarketing = contractEth - ethToDev;
(bool success1,) = devWallet.call{value: ethToDev}("");
require(success1);
(bool success2,) = marketingWallet.call{value: ethToMarketing}("");
require(success2);
}
functionmanualSwap() external{
require(_msgSender() == devWallet, "Not authorized");
uint256 tokenBalance = balanceOf[address(this)];
if (tokenBalance >0) {
swapAndBurn(tokenBalance);
}
}
/**
* This function both sets new floor and maintains it by yeeting
*/functionyeet() publicnonReentrant{
require(isTimeToYeet, "Yeet machine broke");
require(getTimeLeft() ==0, "Yeet cooldown not met");
// Sync first in case pair is disbalanced
uniswapV2Pair.sync();
// Get $yeet priceuint256 currentPrice = getCurrentPrice();
uint256 floorPrice = getFloorPrice();
// Get LP reserves
(uint112 prevYeetReserve, uint112 prevEthReserve) = getReserves();
// If we dump below floor, proceed with yeetingif (floorPrice > currentPrice) {
// Burn $yeet from lpuint256 toBurn = getBurnAmount();
burnFrom(address(uniswapV2Pair), toBurn);
// Sync again
uniswapV2Pair.sync();
// Get reserves after burn
(uint112 newYeetReserve, uint112 newEthReserve) = getReserves();
// Let everyone knowemit Yeeted(
prevYeetReserve, prevEthReserve, newYeetReserve, newEthReserve, currentPrice, getCurrentPrice(), toBurn
);
} else {
// Set new floor
floorYeetReserve = prevYeetReserve;
floorEthReserve = prevEthReserve;
// Let everyone knowemit NewFloorSet(floorPrice, currentPrice);
}
// Reset cooldown
lastYeetTimestamp =block.timestamp;
}
/**
* VIEW FUNCS
*//**
* Returns amount to swap and burn
* When dynamic tax is on, we want to keep swap amount at fixed
* 5% rate and burn the rest
*/functiongetSwapAndBurnAmounts(uint256 tokenAmount) publicviewreturns (uint256, uint256) {
uint256 sellTax = getSellTax();
uint256 toSwap;
uint256 toBurn;
if (sellTax > baseSellTax) {
toSwap = ((tokenAmount * ((baseSellTax *1e12) / sellTax)) /1e12) /2;
toBurn = tokenAmount - toSwap;
} else {
toSwap = tokenAmount /2;
toBurn = tokenAmount - toSwap;
}
return (toSwap, toBurn);
}
/**
* A helper function that returns exact amount to tax
*/functiongetTaxAmount(uint256 amount) publicviewreturns (uint256 taxAmount) {
uint256 sellTax = getSellTax();
return (amount * sellTax) /100e12;
}
/**
* Dynamic tax mechanism
* If price dumps further than 10% under floor sell tax will be equal
* to exact % of the dump percent value
* Returns percent value of tax (divide by 1e12)
*/functiongetSellTax() publicviewreturns (uint256 actualSellTax) {
if (dynamicTaxOn) {
uint256 dumpAmount = getDumpAmount();
if (dumpAmount > baseSellTax) {
return dumpAmount;
} else {
return baseSellTax;
}
} else {
return baseSellTax;
}
}
/**
* Returns the percent value of how much price is down below floor
* for use in dynamic tax calculation. Divide output by 1e12
*/functiongetDumpAmount() publicviewreturns (uint256 pumpAmount) {
uint256 currentPrice = getCurrentPrice();
uint256 floorPrice = getFloorPrice();
if (floorPrice > currentPrice) {
return (100*1e12) - (((currentPrice *1e12) / floorPrice) *100);
} else {
return0;
}
}
/**
* Returns the percent difference between current price and floor
* Purely for front end purposes. Divide output by 1e12
*/functiongetPumpAmount() publicviewreturns (uint256 pumpAmount) {
uint256 currentPrice = getCurrentPrice();
uint256 floorPrice = getFloorPrice();
if (floorPrice > currentPrice) {
return (((floorPrice *1e12) / currentPrice) -1e12) *100;
} else {
return0;
}
}
/**
* Returns exact amount of YEET to burn to bring price back up
*/functiongetBurnAmount() publicviewreturns (uint256 toBurn) {
(uint112 currentYeetReserve, uint112 currentEthReserve) = getReserves();
uint256 targetYeetReserve = (currentEthReserve *1e12) / getFloorPrice();
if (currentYeetReserve > targetYeetReserve) {
return currentYeetReserve - targetYeetReserve;
} else {
return0;
}
}
/**
* Returns floor price in ETH
* Divide the output by 1e12 and multiply by ETH price to get USD price
*/functiongetFloorPrice() publicviewreturns (uint256 floorPrice) {
return (floorEthReserve *1e12) / floorYeetReserve;
}
/**
* Returns current price in ETH
* Divide the output by 1e12 and multiply by ETH price to get USD price
*/functiongetCurrentPrice() publicviewreturns (uint256 currentPrice) {
(uint112 currentYeetReserve, uint112 currentEthReserve) = getReserves();
return (currentEthReserve *1e12) / currentYeetReserve;
}
/**
* Debug only, this should always be equal to floor price
* Divide the output by 1e12 and multiply by ETH price to get USD price
*/functiongetPriceAfterYeet() publicviewreturns (uint256 currentPrice) {
(uint112 currentYeetReserve, uint112 currentEthReserve) = getReserves();
uint256 toBurn = getBurnAmount();
return (currentEthReserve *1e12) / (currentYeetReserve - toBurn);
}
/**
* Returns time left in seconds until yeet button becomes available
*/functiongetTimeLeft() publicviewreturns (uint256 timeLeft) {
if (lastYeetTimestamp + yeetCooldown >block.timestamp) {
return (lastYeetTimestamp + yeetCooldown) -block.timestamp;
} else {
return0;
}
}
/**
* This function always returns currentYeetReserve at first slot of the tuple,
* which is not always the case with calling pair for reserves
*/functiongetReserves() publicviewreturns (uint112, uint112) {
(uint112 reserve0, uint112 reserve1,) = uniswapV2Pair.getReserves();
bool isYeetReserve =address(this) < uniswapV2Router.WETH();
uint112 yeetReserve = isYeetReserve ? reserve0 : reserve1;
uint112 ethReserve =!isYeetReserve ? reserve0 : reserve1;
return (yeetReserve, ethReserve);
}
/**
* OWNER FUNCS
*//**
* Sets initial floor price at launch
*/functionsetFloorPrice() publiconlyOwner{
(uint112 yeetReserve, uint112 ethReserve) = getReserves();
floorYeetReserve = yeetReserve;
floorEthReserve = ethReserve;
if (lastYeetTimestamp ==0) {
lastYeetTimestamp =block.timestamp;
}
}
/**
* Emergency only, toggles dynamic tax system on/off
*/functiontoggleDynamicTax() publiconlyOwner{
dynamicTaxOn =!dynamicTaxOn;
}
/**
* Start the protocol
*/functiontimeToYeet(bool isIt) publiconlyOwner{
isTimeToYeet = isIt;
}
/**
* Add liquidity
*/functionaddLiquidity(uint256 tokenAmount) publicpayableonlyOwner{
this.transferFrom(owner(), address(this), tokenAmount);
this.approve(address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: msg.value}(address(this), tokenAmount, 0, 0, owner(), block.timestamp);
setFloorPrice();
}
/**
* Open trading on Uniswap
* Can never be disabled once called
*/functionopenTrading() publicpayableonlyOwner{
tradingOpen =true;
}
functionsetDevWallet(address _devWallet) publiconlyOwner{
devWallet =payable(_devWallet);
}
functionsetMarketingWallet(address _marketingWallet) publiconlyOwner{
marketingWallet =payable(_marketingWallet);
}
functionsetMaxWallet(uint256 _maxWallet) publiconlyOwner{
maxWallet = _maxWallet;
}
functionaddExcludedFromTax(address toBeExcluded) publicpayableonlyOwner{
isExcludedFromTax[toBeExcluded] =true;
}
functionremoveExcludedFromTax(address toBeRemoved) publicpayableonlyOwner{
isExcludedFromTax[toBeRemoved] =false;
}
functionmin(uint256 a, uint256 b) internalpurereturns (uint256) {
return a < b ? a : b;
}
}