Verified contractExactMIT
SpectrumToken
Address0xcec652995c7af21e6c93d2dd9f228a80f96cf6b2
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.8.35
- Same code
Only this contract
Details
- Compiler
- solc 0.8.35+commit.47b9dedd
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,275,957
- Creation transaction
- 0x6e19e77947…625fc08303
Spectrum/SpectrumToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
// Spectrum index token
// https://spectrum.0xsolazy.eth.limo
// https://x.com/spectrumindexes
// built on Prism — https://x.com/prism_lp
//
// ERC-20 deployed per index by SpectrumFactory.
// basket is immutable after launch. fees accrue to holders via per-share accumulator.
// sell-side fees are burned — supply only goes down.
contract SpectrumToken {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public totalSupply;
uint256 public totalBurned;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
address public hook;
address public owner;
// ── Launch limits ─────────────────────────────────────────────────────────
uint256 public maxBuy;
uint256 public maxWallet;
bool public limitsActive = true;
mapping(address => bool) public isPair; // AMM pairs (no max wallet check)
mapping(address => bool) public isExempt; // wallets exempt from limits
// ── Events ────────────────────────────────────────────────────────────────
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner_, address indexed spender, uint256 value);
event HookBurn(uint256 amount, uint256 newSupply);
event HookSet(address indexed hook);
event LimitsLifted();
event PairSet(address indexed account, bool status);
event ExemptSet(address indexed account, bool status);
// ── Errors ────────────────────────────────────────────────────────────────
error ZeroAddress();
error InsufficientBalance();
error InsufficientAllowance();
error NotOwner();
error NotHook();
error HookAlreadySet();
error MaxBuyExceeded(uint256 amount, uint256 max);
error MaxWalletExceeded(uint256 newBalance, uint256 max);
// ── Constructor ───────────────────────────────────────────────────────────
constructor(
string memory _name,
string memory _symbol,
uint256 _initialSupply
) {
name = _name;
symbol = _symbol;
owner = msg.sender;
totalSupply = _initialSupply;
balanceOf[msg.sender] = _initialSupply;
// 3% max buy and max wallet
maxBuy = _initialSupply * 3 / 100;
maxWallet = _initialSupply * 3 / 100;
// owner and contract are exempt from limits
isExempt[msg.sender] = true;
isExempt[address(this)] = true;
isExempt[address(0)] = true;
emit Transfer(address(0), msg.sender, _initialSupply);
}
// ── ERC-20 ────────────────────────────────────────────────────────────────
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) {
_move(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 a = allowance[from][msg.sender];
if (a != type(uint256).max) {
if (a < value) revert InsufficientAllowance();
unchecked { allowance[from][msg.sender] = a - value; }
}
_move(from, to, value);
return true;
}
function _move(address from, address to, uint256 value) internal {
if (to == address(0)) revert ZeroAddress();
if (balanceOf[from] < value) revert InsufficientBalance();
// Apply launch limits on buys from pairs
if (limitsActive && !isExempt[from] && !isExempt[to]) {
// buying from a pair → enforce max buy
if (isPair[from]) {
if (value > maxBuy) revert MaxBuyExceeded(value, maxBuy);
}
// receiving tokens → enforce max wallet (skip if recipient is a pair)
if (!isPair[to]) {
if (balanceOf[to] + value > maxWallet)
revert MaxWalletExceeded(balanceOf[to] + value, maxWallet);
}
}
unchecked { balanceOf[from] -= value; balanceOf[to] += value; }
emit Transfer(from, to, value);
}
// ── Hook ──────────────────────────────────────────────────────────────────
/// @notice Burns tokens collected from buy-side fee. Called by hook only.
function burnFromHook(uint256 amount) external {
if (msg.sender != hook) revert NotHook();
if (balanceOf[hook] < amount) revert InsufficientBalance();
unchecked {
balanceOf[hook] -= amount;
totalSupply -= amount;
totalBurned += amount;
}
emit Transfer(hook, address(0), amount);
emit HookBurn(amount, totalSupply);
}
// ── Admin ─────────────────────────────────────────────────────────────────
/// @notice Set hook address (once only).
function setHook(address _hook) external {
if (msg.sender != owner) revert NotOwner();
if (hook != address(0)) revert HookAlreadySet();
if (_hook == address(0)) revert ZeroAddress();
hook = _hook;
isExempt[_hook] = true;
emit HookSet(_hook);
}
/// @notice Mark an address as an AMM pair (no max wallet check on it).
function setPair(address account, bool status) external {
if (msg.sender != owner) revert NotOwner();
isPair[account] = status;
isExempt[account] = status;
emit PairSet(account, status);
}
/// @notice Exempt an address from all limits (e.g. router, treasury).
function setExempt(address account, bool status) external {
if (msg.sender != owner) revert NotOwner();
if (account == address(0)) revert ZeroAddress();
isExempt[account] = status;
emit ExemptSet(account, status);
}
/// @notice Permanently lift all launch limits.
function liftLimits() external {
if (msg.sender != owner) revert NotOwner();
limitsActive = false;
maxBuy = type(uint256).max;
maxWallet = type(uint256).max;
emit LimitsLifted();
}
function transferOwnership(address newOwner) external {
if (msg.sender != owner) revert NotOwner();
if (newOwner == address(0)) revert ZeroAddress();
owner = newOwner;
}
receive() external payable {}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.