Verified contractExactMIT
UnisToken
Address0x49237b3cc6be0339da880147703df416ff4f77f4
- Balance
0 ETH
- Transactions
39
- Compiler
solc 0.8.34
- Same code
Only this contract
Details
- Compiler
- solc 0.8.34+commit.80d5c536
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,189,591
- Creation transaction
- 0x26fc3d1fc2…c8c777da27
unisdev/UnisToken.sol
// SPDX-License-Identifier: MIT
// Objectized Asset: onchain objects, not just tokens or NFTs.
// https://x.com/unisdotdev
pragma solidity 0.8.34;
/// @title UNIS - protocol governance and fee-routing token
/// @notice Receives ETH fees from the Factory (object forge fees, Domains registrations)
/// and from the shared Hook (50% of every swap skim on UNIS pools).
contract UnisToken {
string public constant name = "UNIS";
string public constant symbol = "UNIS";
uint8 public constant decimals = 18;
uint256 public constant SUPPLY = 100_000_000 * 1e18;
uint256 public totalSupply = SUPPLY;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
address public admin;
address public treasury;
bool public live;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed holder, address indexed spender, uint256 value);
event Incinerated(address indexed from, uint256 amount);
event Ignited(uint64 atTimestamp);
event TreasurySet(address indexed prev, address indexed next);
event AdminPassed(address indexed prev, address indexed next);
event EthSwept(address indexed to, uint256 amount);
error InsufficientBalance();
error InsufficientAllowance();
error ZeroAddress();
error NotAdmin();
error NotLive();
error AlreadyLive();
modifier onlyAdmin() { if (msg.sender != admin) revert NotAdmin(); _; }
constructor() {
admin = msg.sender;
balanceOf[msg.sender] = SUPPLY;
emit Transfer(address(0), msg.sender, SUPPLY);
}
receive() external payable {}
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();
if (!live && from != admin && to != admin) revert NotLive();
unchecked {
balanceOf[from] -= value;
balanceOf[to] += value;
}
emit Transfer(from, to, value);
}
function incinerate(uint256 value) external {
if (balanceOf[msg.sender] < value) revert InsufficientBalance();
unchecked {
balanceOf[msg.sender] -= value;
totalSupply -= value;
}
emit Transfer(msg.sender, address(0), value);
emit Incinerated(msg.sender, value);
}
function setTreasury(address t) external onlyAdmin {
if (t == address(0)) revert ZeroAddress();
emit TreasurySet(treasury, t);
treasury = t;
}
function ignite() external onlyAdmin {
if (live) revert AlreadyLive();
live = true;
emit Ignited(uint64(block.timestamp));
}
function sweepEth(address payable to, uint256 amount) external onlyAdmin {
if (to == address(0)) revert ZeroAddress();
(bool ok,) = to.call{value: amount}("");
require(ok, "eth sweep failed");
emit EthSwept(to, amount);
}
function passAdmin(address next) external onlyAdmin {
if (next == address(0)) revert ZeroAddress();
emit AdminPassed(admin, next);
admin = next;
}
function cedeAdmin() external onlyAdmin {
emit AdminPassed(admin, address(0));
admin = address(0);
}
}
Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.