Verified contractExactMIT
NeiroToken
Address0xeecd98ecbded6aaf3008b74c6268be4d771d95b8
- Balance
0 ETH
- Transactions
88
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,826,021
- Creation transaction
- 0x777d0c9a1a…658c55ba69
NeiroToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// woof
// Website https://neiroshiba.com
// X https://x.com/NeiroShiba
/// @title Neiro
/// @notice Standard ERC20 with a one-way "enable trading" switch.
/// Before trading is enabled only the owner and explicitly exempt
/// addresses (deployer, claim contract) can move tokens. That lets the
/// owner seed the Uniswap v4 position and fund the claim contract
/// without anyone being able to buy or sell first.
contract NeiroToken {
string public constant name = "Neiro";
string public constant symbol = "NEIRO";
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
address public owner;
bool public tradingEnabled;
/// @notice Addresses allowed to send/receive while trading is disabled.
mapping(address => bool) public isTransferExempt;
// ------------------------------------------------------------- limits
/// @notice Launch limits. Once removed they can never be reinstated.
bool public limitsEnabled = true;
/// @notice Largest single transfer while limits are on.
uint256 public maxTxAmount;
/// @notice Largest balance an address may hold while limits are on.
uint256 public maxWalletAmount;
/// @notice Skips both limits entirely (deployer, claim contract).
mapping(address => bool) public isLimitExempt;
/// @notice Skips only the max-wallet cap. The Uniswap PoolManager holds the
/// whole LP, so without this every sell into the pool would revert.
mapping(address => bool) public isMaxWalletExempt;
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 TradingEnabled(uint256 timestamp);
event TransferExemptSet(address indexed account, bool exempt);
event LimitsRemoved(uint256 timestamp);
event LimitsUpdated(uint256 maxTxAmount, uint256 maxWalletAmount);
event LimitExemptSet(address indexed account, bool exempt);
event MaxWalletExemptSet(address indexed account, bool exempt);
error NotOwner();
error TradingNotEnabled();
error ZeroAddress();
error AlreadyEnabled();
error LimitsAlreadyRemoved();
error MaxTxExceeded();
error MaxWalletExceeded();
error LimitTooLow();
modifier onlyOwner() {
if (msg.sender != owner) revert NotOwner();
_;
}
constructor(uint256 initialSupply, address initialOwner) {
if (initialOwner == address(0)) revert ZeroAddress();
owner = initialOwner;
totalSupply = initialSupply;
balanceOf[initialOwner] = initialSupply;
isTransferExempt[initialOwner] = true;
isLimitExempt[initialOwner] = true;
isMaxWalletExempt[initialOwner] = true;
// 0.2% max transaction, 2% max wallet
maxTxAmount = (initialSupply * 20) / 10000;
maxWalletAmount = (initialSupply * 200) / 10000;
emit OwnershipTransferred(address(0), initialOwner);
emit TransferExemptSet(initialOwner, true);
emit LimitExemptSet(initialOwner, true);
emit MaxWalletExemptSet(initialOwner, true);
emit LimitsUpdated(maxTxAmount, maxWalletAmount);
emit Transfer(address(0), initialOwner, initialSupply);
}
// ---------------------------------------------------------------- ERC20
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
require(allowed >= value, "ERC20: insufficient allowance");
unchecked {
allowance[from][msg.sender] = allowed - value;
}
}
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
if (to == address(0)) revert ZeroAddress();
if (!tradingEnabled && !isTransferExempt[from] && !isTransferExempt[to]) {
revert TradingNotEnabled();
}
_checkLimits(from, to, value);
uint256 fromBalance = balanceOf[from];
require(fromBalance >= value, "ERC20: insufficient balance");
unchecked {
balanceOf[from] = fromBalance - value;
balanceOf[to] += value;
}
emit Transfer(from, to, value);
}
function burn(uint256 value) external {
uint256 fromBalance = balanceOf[msg.sender];
require(fromBalance >= value, "ERC20: insufficient balance");
unchecked {
balanceOf[msg.sender] = fromBalance - value;
totalSupply -= value;
}
emit Transfer(msg.sender, address(0), value);
}
/// @dev Limits apply to ordinary transfers only. The deployer (seeding the
/// pool) and the claim contract (paying out airdrop allocations that
/// are deliberately larger than the caps) skip them entirely.
function _checkLimits(address from, address to, uint256 value) internal view {
if (!limitsEnabled) return;
if (isLimitExempt[from] || isLimitExempt[to]) return;
if (value > maxTxAmount) revert MaxTxExceeded();
if (!isMaxWalletExempt[to] && balanceOf[to] + value > maxWalletAmount) {
revert MaxWalletExceeded();
}
}
// ---------------------------------------------------------------- admin
/// @notice One-way switch. Once trading is on it can never be turned off.
function enableTrading() external onlyOwner {
if (tradingEnabled) revert AlreadyEnabled();
tradingEnabled = true;
emit TradingEnabled(block.timestamp);
}
function setTransferExempt(address account, bool exempt) external onlyOwner {
if (account == address(0)) revert ZeroAddress();
isTransferExempt[account] = exempt;
emit TransferExemptSet(account, exempt);
}
function setTransferExemptBatch(address[] calldata accounts, bool exempt) external onlyOwner {
for (uint256 i; i < accounts.length; ++i) {
if (accounts[i] == address(0)) revert ZeroAddress();
isTransferExempt[accounts[i]] = exempt;
emit TransferExemptSet(accounts[i], exempt);
}
}
/// @notice Drop both limits permanently. One-way.
function removeLimits() external onlyOwner {
if (!limitsEnabled) revert LimitsAlreadyRemoved();
limitsEnabled = false;
emit LimitsRemoved(block.timestamp);
}
/// @notice Raise (or lower) the caps while limits are still on. Neither cap
/// may be set below 0.1% of supply, so the token cannot be frozen
/// by setting an unusably small limit.
function setLimits(uint256 newMaxTx, uint256 newMaxWallet) external onlyOwner {
if (!limitsEnabled) revert LimitsAlreadyRemoved();
uint256 floor = totalSupply / 1000;
if (newMaxTx < floor || newMaxWallet < floor) revert LimitTooLow();
if (newMaxWallet < newMaxTx) revert LimitTooLow();
maxTxAmount = newMaxTx;
maxWalletAmount = newMaxWallet;
emit LimitsUpdated(newMaxTx, newMaxWallet);
}
function setLimitExempt(address account, bool exempt) external onlyOwner {
if (account == address(0)) revert ZeroAddress();
isLimitExempt[account] = exempt;
emit LimitExemptSet(account, exempt);
}
function setMaxWalletExemptBatch(address[] calldata accounts, bool exempt) external onlyOwner {
for (uint256 i; i < accounts.length; ++i) {
if (accounts[i] == address(0)) revert ZeroAddress();
isMaxWalletExempt[accounts[i]] = exempt;
emit MaxWalletExemptSet(accounts[i], exempt);
}
}
function transferOwnership(address newOwner) external onlyOwner {
if (newOwner == address(0)) revert ZeroAddress();
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/// @notice Permanently give up admin control. Only callable once trading is
/// live, so the contract can never be bricked in a non-tradable state.
function renounceOwnership() external onlyOwner {
require(tradingEnabled, "enable trading first");
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.