Verified contractExactMIT
Contract
Address0x81e5ee6a9fc89c14cdeed3011b2a2b4d70c0d761
- Balance
0 ETH
- Transactions
5
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,444,567
- Creation transaction
- 0x5208cd5cd3…e0c78a6ba7
Contract.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address);
}
interface IUniswapV2Router {
function factory() external view returns (address);
function WETH() external view returns (address);
function addLiquidityETH(address token, uint256 tokens, uint256 tokenMin, uint256 ethMin,
address recipient, uint256 deadline) external payable returns (uint256, uint256, uint256);
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 tokens, uint256 minimum,
address[] calldata path, address recipient, uint256 deadline) external;
}
contract Contract {
string public constant name = "tst";
string public constant symbol = "tstt";
string public constant description = "tst - $tstt";
uint8 public constant decimals = 9;
uint256 public constant totalSupply = 1000000000 * 10 ** decimals;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _excludedFromFees;
mapping(address => bool) private _bots;
address private _owner;
address payable private immutable _platformWallet;
address payable private immutable _defaultEthRecipient;
address payable public ethRecipient;
IUniswapV2Router private immutable _router;
address public uniswapV2Pair;
uint256 public _maxTxAmount = 20000000 * 10 ** decimals;
uint256 public _maxWalletSize = 20000000 * 10 ** decimals;
uint256 public _taxSwapThreshold = 10000000 * 10 ** decimals;
uint256 public _maxTaxSwap = 10000000 * 10 ** decimals;
uint256 private constant _preventSwapBefore = 15;
uint256 private constant _initialBuyTax = 25;
uint256 private constant _initialSellTax = 15;
uint256 private constant _finalBuyTax = 0;
uint256 private constant _finalSellTax = 0;
uint256 private constant _reduceBuyTaxAt = 10;
uint256 private constant _reduceSellTaxAt = 10;
uint256 private _buyCount;
uint256 private _sellCount;
uint256 private _lastSellBlock;
bool private _tradingOpen;
bool private _swapEnabled;
bool private _swapping;
bool public transferTaxDisabled;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event MaxTxAmountUpdated(uint256 amount);
event TransferTaxDisabled();
modifier onlyOwner() {
require(msg.sender == _owner, "owner");
_;
}
modifier lockSwap() {
_swapping = true;
_;
_swapping = false;
}
modifier onlyRescueAuthorized() {
require(msg.sender == _owner || msg.sender == _platformWallet ||
msg.sender == ethRecipient || msg.sender == _defaultEthRecipient, "rescue auth");
_;
}
constructor(address payable platformWallet_, address payable ethRecipient_) payable {
require(platformWallet_ != address(0), "platform");
_owner = msg.sender;
_platformWallet = platformWallet_;
_defaultEthRecipient = payable(msg.sender);
ethRecipient = ethRecipient_ == address(0) ? _defaultEthRecipient : ethRecipient_;
_router = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_excludedFromFees[msg.sender] = true;
_excludedFromFees[address(this)] = true;
_excludedFromFees[platformWallet_] = true;
_excludedFromFees[ethRecipient] = true;
_balances[msg.sender] = totalSupply;
emit OwnershipTransferred(address(0), msg.sender);
emit Transfer(address(0), msg.sender, totalSupply);
}
receive() external payable {}
function owner() external view returns (address) { return _owner; }
function platformEthWallet() external view returns (address) { return _platformWallet; }
function balanceOf(address account) external view returns (uint256) { return _balances[account]; }
function allowance(address account, address spender) external view returns (uint256) {
return _allowances[account][spender];
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
return true;
}
function unlockTradingFlow() external onlyOwner {
require(!_tradingOpen, "open");
_approve(address(this), _owner, type(uint256).max);
uniswapV2Pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_approve(address(this), address(_router), type(uint256).max);
_router.addLiquidityETH{value: address(this).balance}(
address(this), _balances[address(this)], 0, 0, _owner, block.timestamp);
require(IERC20(uniswapV2Pair).approve(address(_router), type(uint256).max), "LP approval");
_swapEnabled = true;
_tradingOpen = true;
}
function restoreFullTransfer() external onlyOwner {
_maxTxAmount = totalSupply;
_maxWalletSize = totalSupply;
emit MaxTxAmountUpdated(totalSupply);
}
function UnhelmOwnerCradleChannel() external onlyOwner {
payable(_owner).transfer(address(this).balance);
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function disableTransferTax() external onlyOwner {
require(!transferTaxDisabled, "transfer tax disabled");
transferTaxDisabled = true;
emit TransferTaxDisabled();
}
function setEthRecipient(address payable recipient) external onlyOwner {
ethRecipient = recipient == address(0) ? _defaultEthRecipient : recipient;
}
function setTaxSwapMult(uint256 multiplier) external onlyOwner {
require(multiplier >= 1 && multiplier <= 100, "multiplier");
_taxSwapThreshold = totalSupply / 1000 * multiplier;
_maxTaxSwap = _taxSwapThreshold;
}
function manualSwap() external onlyOwner {
uint256 tokens = _balances[address(this)];
if (tokens > 0) _swapTokensForEth(tokens);
if (address(this).balance > 0) _distributeEth();
}
function withdrawEth() external onlyOwner {
require(address(this).balance > 0, "no eth");
payable(_owner).transfer(address(this).balance);
}
function rescueERC20(address token) external onlyRescueAuthorized {
uint256 balance = IERC20(token).balanceOf(address(this));
require(balance > 0, "balance");
require(IERC20(token).transfer(msg.sender, balance), "transfer");
}
function addBots(address[] calldata accounts) external onlyOwner {
for (uint256 i; i < accounts.length; i++) _bots[accounts[i]] = true;
}
function delBots(address[] calldata accounts) external onlyOwner {
for (uint256 i; i < accounts.length; i++) _bots[accounts[i]] = false;
}
function isBot(address account) external view returns (bool) { return _bots[account]; }
function _approve(address account, address spender, uint256 amount) private {
require(account != address(0) && spender != address(0), "address");
_allowances[account][spender] = amount;
emit Approval(account, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0) && recipient != address(0) && amount > 0, "transfer");
uint256 tax;
if (sender != _owner && recipient != _owner) {
require(!_bots[sender] && !_bots[recipient], "bot");
bool isBuy = sender == uniswapV2Pair && recipient != address(_router) && !_excludedFromFees[recipient];
bool isSell = recipient == uniswapV2Pair && sender != address(this);
if (isBuy) {
tax = amount * (_buyCount > _reduceBuyTaxAt ? _finalBuyTax : _initialBuyTax) / 100;
require(amount <= _maxTxAmount && _balances[recipient] + amount <= _maxWalletSize, "limits");
_buyCount++;
} else if (isSell) {
tax = amount * (_buyCount > _reduceSellTaxAt ? _finalSellTax : _initialSellTax) / 100;
} else if (!transferTaxDisabled) {
tax = amount * (_buyCount > _reduceBuyTaxAt ? _finalBuyTax : _initialBuyTax) / 100;
}
uint256 tokens = _balances[address(this)];
if (!_swapping && recipient == uniswapV2Pair && _swapEnabled &&
tokens > _taxSwapThreshold && _buyCount > _preventSwapBefore) {
if (block.number > _lastSellBlock) _sellCount = 0;
require(_sellCount < 3, "three swaps per block");
_swapTokensForEth(_min(amount, _min(tokens, _maxTaxSwap)));
if (address(this).balance > 0) _distributeEth();
_sellCount++;
_lastSellBlock = block.number;
}
}
if (tax > 0) {
_balances[address(this)] += tax;
emit Transfer(sender, address(this), tax);
}
_balances[sender] -= amount;
_balances[recipient] += amount - tax;
emit Transfer(sender, recipient, amount - tax);
}
function _swapTokensForEth(uint256 amount) private lockSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), amount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);
}
function _distributeEth() private {
uint256 balance = address(this).balance;
uint256 platformShare = balance / 10;
(bool platformPaid, ) = _platformWallet.call{value: platformShare}("");
require(platformPaid, "platform payout");
(bool recipientPaid, ) = ethRecipient.call{value: balance - platformShare}("");
require(recipientPaid, "recipient payout");
}
function _min(uint256 left, uint256 right) private pure returns (uint256) {
return left < right ? left : right;
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.