Verified contractExactMIT
YOSHI3
Address0x5b06fa0b04a317ee1ee6a34c44dfb4fa3f3701af
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.8.20
- Same code
Only this contract
Details
- Compiler
- solc 0.8.20+commit.a1b79de6
- Language
- solidity
- Optimization
- No
- EVM version
- paris
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 21,082,983
- Creation transaction
- 0xbc7839e664…55e7dc0a20
contracts/Main.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.20;
library SafeERC20 {
function safeTransfer(address token, address to, uint value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.transfer.selector, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: INTERNAL TRANSFER_FAILED"
);
}
}
interface IERC20 {
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external;
}
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 swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
)
external
payable
returns (uint amountToken, uint amountETH, uint liquidity);
}
contract YOSHI3 {
string private constant _name = unicode"YOSHI3";
string private constant _symbol = unicode"YOSHI3";
uint private constant _totalSupply = 1_000_000_000 ether;
uint public maxTransactionAmount = 100_000 ether;
uint public maxWallet = 2_000_000 ether;
uint public swapTokensAtAmount = (_totalSupply * 2) / 10000;
address private treasuryWallet = 0xb16d6790C85bf3C505882B3AA2CD2CC6b02a7115;
address private _owner = 0xb16d6790C85bf3C505882B3AA2CD2CC6b02a7115;
address private constant WETH = 0xb16d6790C85bf3C505882B3AA2CD2CC6b02a7115;
uint8 public buyTotalFees = 50; // denominator = 1000
uint8 public sellTotalFees = 50;
bool private swapping;
bool public limitsInEffect = true;
bool private launched;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) private _isExcludedMaxTransactionAmount;
mapping(address => bool) private automatedMarketMakerPairs;
event SwapAndLiquify(uint tokensSwapped, uint TreasuryETH);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
IUniswapV2Router02 public constant uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public immutable uniswapV2Pair;
constructor() {
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
address(this),
WETH
);
automatedMarketMakerPairs[uniswapV2Pair] = true;
_isExcludedFromFees[owner()] = true;
_isExcludedFromFees[address(this)] = true;
_isExcludedFromFees[address(0xdead)] = true;
_isExcludedFromFees[treasuryWallet] = true;
_isExcludedMaxTransactionAmount[owner()] = true;
_isExcludedMaxTransactionAmount[address(uniswapV2Router)] = true;
_isExcludedMaxTransactionAmount[address(this)] = true;
_isExcludedMaxTransactionAmount[address(0xdead)] = true;
_isExcludedMaxTransactionAmount[address(uniswapV2Pair)] = true;
_isExcludedMaxTransactionAmount[treasuryWallet] = true;
_balances[treasuryWallet] = _totalSupply;
emit Transfer(address(0), treasuryWallet, _balances[treasuryWallet]);
_approve(address(this), address(uniswapV2Router), type(uint).max);
}
receive() external payable {}
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 18;
}
function totalSupply() public pure returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function allowance(
address _owner_,
address spender
) public view returns (uint) {
return _allowances[_owner_][spender];
}
function approve(address spender, uint amount) external returns (bool) {
_approve(msg.sender, spender, amount);
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 recipient, uint amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint amount
) external returns (bool) {
uint currentAllowance = _allowances[sender][msg.sender];
if (currentAllowance != type(uint).max) {
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, msg.sender, currentAllowance - amount);
}
}
_transfer(sender, recipient, amount);
return true;
}
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");
if (
!launched &&
(from != owner() && from != address(this) && to != owner())
) {
revert("Trading not enabled");
}
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!swapping
) {
if (
automatedMarketMakerPairs[from] &&
!_isExcludedMaxTransactionAmount[to]
) {
require(
amount <= maxTransactionAmount,
"Buy transfer amount exceeds the maxTx"
);
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
} else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTx"
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
}
}
bool canSwap = balanceOf(address(this)) >= swapTokensAtAmount;
if (
canSwap &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
swapping = true;
swapBack();
swapping = false;
}
bool takeFee = !swapping;
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint senderBalance = _balances[from];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
uint fees = 0;
if (takeFee) {
if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {
fees = (amount * sellTotalFees) / 1000;
} else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = (amount * buyTotalFees) / 1000;
}
if (fees > 0) {
unchecked {
amount = amount - fees;
_balances[from] -= fees;
_balances[address(this)] += fees;
}
emit Transfer(from, address(this), fees);
}
}
unchecked {
_balances[from] -= amount;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
}
function removeLimits() external onlyOwner {
limitsInEffect = false;
}
function setFees(
uint8 _buyTotalFees,
uint8 _sellTotalFees
) external onlyOwner {
require(
_buyTotalFees <= 50,
"Buy fees must be less than or equal to 5%"
);
require(
_sellTotalFees <= 50,
"Sell fees must be less than or equal to 5%"
);
buyTotalFees = _buyTotalFees;
sellTotalFees = _sellTotalFees;
}
function setExcludedFromFees(
address account,
bool excluded
) public onlyOwner {
_isExcludedFromFees[account] = excluded;
}
function setExcludedFromMaxTransaction(
address account,
bool excluded
) public onlyOwner {
_isExcludedMaxTransactionAmount[account] = excluded;
}
function openTrade() external {
require(
owner() == msg.sender || treasuryWallet == msg.sender,
"not allowed"
);
require(!launched, "Already launched");
launched = true;
}
function addLiquidity() external payable {
require(
owner() == msg.sender || treasuryWallet == msg.sender,
"not allowed"
);
require(!launched, "Already launched");
uniswapV2Router.addLiquidityETH{value: msg.value}(
address(this),
_balances[address(this)],
0,
0,
treasuryWallet,
block.timestamp
);
}
function setAutomatedMarketMakerPair(
address pair,
bool value
) external onlyOwner {
require(pair != uniswapV2Pair, "The pair cannot be removed");
automatedMarketMakerPairs[pair] = value;
}
function setSwapAtAmount(uint newSwapAmount) external onlyOwner {
require(
newSwapAmount >= (totalSupply() * 1) / 100000,
"Swap amount cannot be lower than 0.001% of the supply"
);
require(
newSwapAmount <= (totalSupply() * 5) / 1000,
"Swap amount cannot be higher than 0.5% of the supply"
);
swapTokensAtAmount = newSwapAmount;
}
function setMaxTxnAmount(uint newMaxTx) external onlyOwner {
require(
newMaxTx >= ((totalSupply() * 5) / 1000) / 1e18,
"Cannot set max transaction lower than 0.5%"
);
maxTransactionAmount = newMaxTx * (10 ** 18);
}
function setMaxWalletAmount(uint newMaxWallet) external onlyOwner {
require(
newMaxWallet >= ((totalSupply() * 5) / 1000) / 1e18,
"Cannot set max wallet lower than 0.5%"
);
maxWallet = newMaxWallet * (10 ** 18);
}
function updateTreasuryWallet(address newAddress) external onlyOwner {
require(newAddress != address(0), "Address cannot be zero");
treasuryWallet = newAddress;
}
function excludedFromFee(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
function withdrawStuckToken(address token, address to) external onlyOwner {
uint _contractBalance = IERC20(token).balanceOf(address(this));
SafeERC20.safeTransfer(token, to, _contractBalance); // Use safeTransfer
}
function withdrawStuckETH() external onlyOwner {
(bool s, ) = treasuryWallet.call{value: address(this).balance}("");
require(s, "Withdrawal failed");
}
function swapBack() private {
uint swapThreshold = swapTokensAtAmount;
bool success;
if (balanceOf(address(this)) > swapTokensAtAmount * 20) {
swapThreshold = swapTokensAtAmount * 20;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = WETH;
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
swapThreshold,
0,
path,
address(this),
block.timestamp
);
uint ethBalance = address(this).balance;
if (ethBalance > 0) {
(success, ) = address(treasuryWallet).call{value: ethBalance}("");
emit SwapAndLiquify(swapThreshold, ethBalance);
}
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_owner = address(0);
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.