Verified contractExactMIT
LaunchToken
Address0x21d7ef01e1efe07eb2bc54a1efad9e68a46b72e2
- Balance
0 ETH
- Transactions
161
- Compiler
solc 0.8.26
- Same code
4 more contracts
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,979,769
- Creation transaction
- 0x7cd1bde355…739f931453
2 files
- src/LaunchToken.solmain2.91 KB
- src/interfaces/IERC20.sol880 B
src/LaunchToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import {IERC20} from "./interfaces/IERC20.sol";
/// @notice Fixed-supply ERC20 minted once at deploy. No owner, no mint, no burn, no pause.
/// @dev The entire supply goes to the deployer -- the LaunchFactory -- which puts all of it into a
/// single permanently locked Uniswap position in the same transaction. Because there is no
/// privileged role after construction, a launch cannot be rugged by supply inflation, and
/// because nothing is held back, there is nothing to rug by selling either: every token that
/// will ever exist has to be bought out of the pool first.
contract LaunchToken is IERC20 {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public immutable totalSupply;
/// @notice IPFS URI (or https URL) for the token image and metadata, frozen at launch.
string public metadataURI;
/// @notice The address that paid to create this launch. Informational only -- carries no rights.
address public immutable creator;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
error InsufficientBalance();
error InsufficientAllowance();
error TransferToZero();
constructor(
string memory _name,
string memory _symbol,
uint256 _totalSupply,
string memory _metadataURI,
address _creator
) {
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
metadataURI = _metadataURI;
creator = _creator;
balanceOf[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, 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) {
if (allowed < value) revert InsufficientAllowance();
unchecked {
allowance[from][msg.sender] = allowed - value;
}
}
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) private {
if (to == address(0)) revert TransferToZero();
uint256 bal = balanceOf[from];
if (bal < value) revert InsufficientBalance();
unchecked {
balanceOf[from] = bal - value;
balanceOf[to] += value;
}
emit Transfer(from, to, value);
}
}
src/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"forge-std/=lib/forge-std/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.