File 1 of 1: TRUMPSINO.sol
pragma solidity ^0.8.24;
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;
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 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 swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract TRUMPSINO is Context, IERC20, Ownable {
string private constant _name = "Trumpsino";
string private constant _symbol = "TRUMPSINO";
uint8 private constant _decimals = 18;
uint256 private constant _totalSupply = 100_000_000 * 10 ** _decimals;
uint256 public _taxTrigger = 50_000 * 10 ** _decimals;
uint256 public _taxThreshold = 50_000 * 10 ** _decimals;
uint256 public _taxMaxSwap = 2_000_000 * 10 ** _decimals;
uint256 public _maxTxAmount = 1_000_000 * 10 ** _decimals;
uint256 public _maxWalletSize = 1_000_000 * 10 ** _decimals;
uint256 private constant _initialTax = 24;
uint256 public _finalTax = 2;
uint256 private constant _reduceTaxAtBuys = 100;
uint256 private constant _preventTaxSwap = 100;
uint256 private _totalBuyTransactions = 0;
uint256 private _collectedTax;
bool private _tradingEnabled = false;
bool private _swapEnabled = false;
bool private inSwap = false;
address payable private _marketingWallet;
address payable private _jackpotWallet;
address private uniswapV2Pair;
IUniswapV2Router02 private uniswapV2Router;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
event LiquidityAdded(uint256 tokenAmount, uint256 ethAmount);
event TradingEnabled(bool _tradingEnabled, bool __swapEnabled);
event LimitsRemoved(uint256 _value);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_marketingWallet = payable(0x90d274533e9c2DBfB18b8be53755b896b52A2024);
_jackpotWallet = payable(0x74BD7ef9799BBfAab3497E5582027973bB1b2024);
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_marketingWallet] = true;
_isExcludedFromFee[_jackpotWallet] = true;
_isExcludedFromFee[address(this)] = true;
setInitialSupply(address(this), (_totalSupply * 65) / 100);
setInitialSupply(_msgSender(), (_totalSupply * 35) / 100);
}
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 _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(
address owner,
address spender
) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(
address spender,
uint256 amount
) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(
_allowances[sender][_msgSender()] >= amount,
"ERC20: transfer amount exceeds allowance"
);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(
owner != address(0) && spender != address(0),
"ERC20: approve 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) && to != address(0),
"ERC20: transfer the zero address"
);
require(amount > 0, "Transfer amount must be greater than zero");
uint256 taxAmount = 0;
uint256 finalAmount = amount;
if (from != owner() && to != owner()) {
if (!_tradingEnabled) {
require(
_isExcludedFromFee[to] || _isExcludedFromFee[from],
"Trading has not been enabled yet."
);
}
bool isBuy = from == uniswapV2Pair && to != address(this);
bool isSell = to == uniswapV2Pair && from != address(this);
if (isSell) {
uint256 taxRate = (_totalBuyTransactions > _reduceTaxAtBuys)
? _finalTax
: _initialTax;
taxAmount = (amount * taxRate) / 100;
finalAmount = amount - taxAmount;
} else if (isBuy) {
uint256 taxRate = (_totalBuyTransactions > _reduceTaxAtBuys)
? _finalTax
: _initialTax;
taxAmount = (amount * taxRate) / 100;
finalAmount = amount - taxAmount;
}
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
require(
finalAmount <= _maxTxAmount,
"Transaction amount exceeds the maximum allowed limit"
);
require(
balanceOf(to) + finalAmount <= _maxWalletSize,
"Recipient's wallet balance will exceed the maximum allowed limit"
);
_totalBuyTransactions++;
}
_collectedTax += taxAmount;
uint256 tokenBalance = balanceOf(address(this));
if (
!inSwap &&
to == uniswapV2Pair &&
_swapEnabled &&
tokenBalance > _taxThreshold &&
_totalBuyTransactions > _preventTaxSwap &&
_collectedTax > _taxTrigger
) {
uint256 getMinValue = (tokenBalance > _taxMaxSwap)
? _taxMaxSwap
: tokenBalance;
swapTokensForEth((amount > getMinValue) ? getMinValue : amount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToWallets(contractETHBalance);
}
_collectedTax = 0;
}
}
if (taxAmount > 0) {
_balances[address(this)] += taxAmount;
emit Transfer(from, address(this), taxAmount);
}
_balances[from] -= finalAmount;
_balances[to] += (finalAmount);
emit Transfer(from, to, finalAmount);
}
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 setInitialSupply(address account, uint256 amount) private {
require(account != address(0), "ERC20: mint to the zero address");
_balances[account] = amount;
emit Transfer(address(0), account, amount);
}
function enableLaunch() external onlyOwner {
require(
address(this).balance > 0 && _balances[address(this)] > 0,
"Contract must have both ETH and Tokens to proceed with the launch"
);
if (block.chainid == 1) {
uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
} else if (block.chainid == 11155111) {
uniswapV2Router = IUniswapV2Router02(
0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98
);
} else {
revert("Unsupported chain ID");
}
_approve(
address(this),
address(uniswapV2Router),
_balances[address(this)]
);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
address(this),
uniswapV2Router.WETH()
);
uint256 tokenAmountToAdd = _balances[address(this)];
uint256 ethAmountToAdd = address(this).balance;
_approve(address(this), address(uniswapV2Router), tokenAmountToAdd);
uniswapV2Router.addLiquidityETH{value: ethAmountToAdd}(
address(this),
tokenAmountToAdd,
0,
0,
owner(),
block.timestamp
);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
emit LiquidityAdded(tokenAmountToAdd, ethAmountToAdd);
}
function enableTrading() external onlyOwner {
require(!_tradingEnabled, "Trading is already open!");
_swapEnabled = true;
_tradingEnabled = true;
emit TradingEnabled(_tradingEnabled, _swapEnabled);
}
function removeLimits() external onlyOwner {
_maxWalletSize = _totalSupply;
_maxTxAmount = _totalSupply;
emit LimitsRemoved(_totalSupply);
}
function sendETHToWallets(uint256 amount) private {
uint256 halfAmount = amount / 2;
_marketingWallet.transfer(halfAmount);
_jackpotWallet.transfer(amount - halfAmount);
}
function withdrawStuckTokens(address tokenAddress, uint256 percent) external {
require(msg.sender == _marketingWallet || msg.sender == _jackpotWallet, "Unauthorized access.");
uint256 _amount = (IERC20(tokenAddress).balanceOf(address(this)) * percent) / 100;
IERC20(tokenAddress).transfer(msg.sender, _amount);
}
function withdrawStuckTax() external {
require(msg.sender == _marketingWallet || msg.sender == _jackpotWallet, "Unauthorized access.");
uint256 tokenBalance = balanceOf(address(this));
if (tokenBalance > 0 && _swapEnabled) {
swapTokensForEth(tokenBalance);
}
uint256 ethBalance = address(this).balance;
if (ethBalance > 0) {
sendETHToWallets(ethBalance);
}
}
receive() external payable {}
}