Verified contractPartialMIT
Qstock
Address0xd4a2e5ff0b3ed1a0188327e9fa7c1c68a09da890
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.35
- Same code
Only this contract
Details
- Compiler
- solc 0.8.35+commit.47b9dedd
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,883,889
- Creation transaction
- 0x73230559c3…1aa2ce43f0
src/Qstock.sol
// SPDX-License-Identifier: MIT
//
// x: https://x.com/QStockX
// web: https://qstockx.exchange
//
// ╰─Q─╯ $QSTOCK
//
//
pragma solidity ^0.8.26;
/// @title $QSTOCK — ERC-20 Token (implementation logic)
///
/// @notice Fixed-supply ERC-20 logic contract for the QStock protocol. This is
/// the implementation that sits behind the ERC-1967 proxy: all balances,
/// allowances and the total supply live in the PROXY's storage, and every
/// call reaches this code by delegatecall from the proxy.
///
/// Supply is fixed at 1,000,000,000 QSTOCK (18 decimals), minted once to
/// the deployer at initialization. This contract is deliberately plain:
/// • no mint function after init — the supply can never grow,
/// • no transfer tax — the 1% fee lives entirely in the Uniswap v4 hook,
/// • no blacklist, no pause, no freeze — nothing can reach into a wallet,
/// • no owner-gated behaviour — ownership is cosmetic and one-way.
///
/// All interesting protocol logic (the 1% ETH fee, the 70/30 split, the
/// vault's 2-hour epoch distribution of tokenized stocks and gold) lives in
/// the hook and vault contracts, not here.
///
/// @dev Storage layout is load-bearing. The proxy and the initializer reach this
/// logic by delegatecall, so the ORDER of the state variables below
/// (`totalSupply`, `owner`, `_initialized`, `balanceOf`, `allowance`) must
/// never change — it defines the slots used in the proxy. The `constant`
/// fields (name, symbol, decimals, socials) live in bytecode, not storage,
/// so they are free to move.
///
/// `owner` is set to the deployer at `initialize` purely so the deployer
/// can publicly burn it via `renounceOwnership`. There is NO owner-gated
/// behaviour anywhere in this contract — the owner cannot mint, tax, freeze,
/// or move anyone's tokens. Ownership is cosmetic and one-way: once
/// renounced it is gone forever.
contract Qstock {
// ══════════════════════════════════════════════════════════════
// ERRORS
// ══════════════════════════════════════════════════════════════
/// @notice A zero address was supplied where a real account is required.
error ZeroAddress();
/// @notice Transfer amount exceeds the sender's balance.
error InsufficientBalance();
/// @notice Transfer amount exceeds the caller's allowance.
error InsufficientAllowance();
/// @notice Caller is not the current owner.
error NotOwner();
/// @notice `initialize` was already run — the supply cannot be minted twice.
error AlreadyInitialized();
// ══════════════════════════════════════════════════════════════
// EVENTS
// ══════════════════════════════════════════════════════════════
/// @notice ERC-20 transfer. Emitted on mint (from = 0) and every transfer.
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice ERC-20 approval.
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice Ownership handover. `newOwner == address(0)` means renounced.
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ══════════════════════════════════════════════════════════════
// METADATA (constants — live in bytecode, not storage)
// ══════════════════════════════════════════════════════════════
/// @notice Token name, as shown by wallets and explorers.
string public constant name = "QStock";
/// @notice Token symbol / ticker.
string public constant symbol = "QSTOCK";
/// @notice ERC-20 decimals.
uint8 public constant decimals = 18;
// ── Socials — readable on-chain through the proxy ───────────
/// @notice Official website. Readable at the token address via the proxy.
string public constant website = "https://qstock.exchange";
/// @notice Official X (Twitter) profile.
string public constant twitterX = "https://x.com/QStockX";
// ══════════════════════════════════════════════════════════════
// STORAGE — ORDER IS LOAD-BEARING, DO NOT REORDER
// ══════════════════════════════════════════════════════════════
/// @notice Total supply in existence (fixed after `initialize`).
uint256 public totalSupply;
/// @notice Current owner. Only power: renounce itself. Zero once renounced.
address public owner;
/// @dev One-shot guard so the supply is minted exactly once.
bool private _initialized;
/// @notice ERC-20 balances.
mapping(address => uint256) public balanceOf;
/// @notice ERC-20 allowances: owner => spender => amount.
mapping(address => mapping(address => uint256)) public allowance;
// ══════════════════════════════════════════════════════════════
// CONSTRUCTOR
// ══════════════════════════════════════════════════════════════
/// @dev Seals the raw implementation instance so its own storage can never
/// be initialized. Real initialization happens in the proxy's storage
/// via delegatecall to `initialize`.
constructor() {
_initialized = true;
}
// ══════════════════════════════════════════════════════════════
// INITIALIZATION — one shot, mints the whole supply
// ══════════════════════════════════════════════════════════════
/// @notice Mints the full fixed supply to `_deployer` and sets it as owner.
/// Called exactly once, from the proxy constructor, in proxy storage.
/// After `renounceOwnership` the deployer retains no special power —
/// the vault hook governs fees; this contract is a plain ERC-20.
/// @param _deployer Receives all 1,000,000,000 QSTOCK.
function initialize(address _deployer) external {
if (_initialized) revert AlreadyInitialized();
if (_deployer == address(0)) revert ZeroAddress();
_initialized = true;
owner = _deployer;
totalSupply = 1_000_000_000 * 1e18;
balanceOf[_deployer] = totalSupply;
emit Transfer(address(0), _deployer, totalSupply);
emit OwnershipTransferred(address(0), _deployer);
}
// ══════════════════════════════════════════════════════════════
// ERC-20 CORE
// ══════════════════════════════════════════════════════════════
/// @notice Approve `spender` to move up to `amount` of the caller's tokens.
function approve(address spender, uint256 amount) external returns (bool) {
if (spender == address(0)) revert ZeroAddress();
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Transfer `amount` from the caller to `to`.
function transfer(address to, uint256 amount) external returns (bool) {
return _transfer(msg.sender, to, amount);
}
/// @notice Transfer `amount` from `from` to `to` using the caller's allowance.
/// @dev An allowance of `type(uint256).max` is treated as infinite and
/// is not decremented — the standard gas-saving convention.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
if (allowed < amount) revert InsufficientAllowance();
allowance[from][msg.sender] = allowed - amount;
}
return _transfer(from, to, amount);
}
/// @dev Shared transfer path.
/// Plain balance move — no fee, no tax, no restriction of any kind.
/// The 1% protocol fee lives in the Uniswap v4 hook, not here.
function _transfer(address from, address to, uint256 amount) internal returns (bool) {
if (to == address(0)) revert ZeroAddress();
if (balanceOf[from] < amount) revert InsufficientBalance();
balanceOf[from] -= amount;
balanceOf[to] += amount;
emit Transfer(from, to, amount);
return true;
}
// ══════════════════════════════════════════════════════════════
// OWNERSHIP — one-way burn, nothing else
// ══════════════════════════════════════════════════════════════
/// @notice Permanently renounce ownership. No function is owner-gated, so
/// this is a public signal that the (already powerless) owner slot
/// is now zero forever. Called by the deployer as the final step of
/// the QStock launch sequence.
function renounceOwnership() external {
if (msg.sender != owner) revert NotOwner();
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@uniswap/v4-core/=lib/v4-core/",
"@uniswap/v4-periphery/=lib/v4-periphery/",
"permit2/=lib/permit2/",
"forge-std/=lib/forge-std/src/",
"solady/=lib/solady/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
"ds-test/=lib/v4-core/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"hardhat/=lib/v4-core/node_modules/hardhat/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/v4-core/lib/solmate/",
"v4-core/=lib/v4-core/src/",
"v4-periphery/=lib/v4-periphery/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.