Verified contractExactMIT
MMD
Address0xc1fb4b8abb840237170d8afcc2cdcc31274d5496
- Balance
0 ETH
- Transactions
282
- Compiler
solc 0.8.34
- Same code
1 more 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,905,032
- Creation transaction
- 0x9dda7c3312…5ca27b8426
12 files
- MMD/MMD.solmain7.37 KB
- MMD/HookFeeRouter.sol1.69 KB
- MMD/LaunchMetricsAggregator.sol3.39 KB
- MMD/LaunchMilestoneTracker.sol3.2 KB
- MMD/LaunchQuoteEngine.sol3.94 KB
- MMD/LaunchRegistry.sol2.31 KB
- MMD/LiquidityLockRegistry.sol3.07 KB
- MMD/PairingVault.sol2.29 KB
- MMD/RiskFlagRegistry.sol3.06 KB
- MMD/TerminalBoard.sol2.1 KB
- MMD/VestingScheduler.sol4.69 KB
- MMD/memestockNFT.sol7.24 KB
MMD/MMD.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "./LaunchRegistry.sol";
import "./PairingVault.sol";
import "./HookFeeRouter.sol";
import "./TerminalBoard.sol";
import "./LaunchQuoteEngine.sol";
import "./VestingScheduler.sol";
import "./LiquidityLockRegistry.sol";
import "./LaunchMetricsAggregator.sol";
import "./RiskFlagRegistry.sol";
import "./LaunchMilestoneTracker.sol";
import "./memestockNFT.sol";
/*
// memestock.md pairs every memecoin launch to tokenized stock-NFT collections
// and routes a fixed portion of its swap fees to whoever holds the paired shares.
@terminal memestock.md / $MMD / Ethereum
@role memestock launchpad, pairs memecoins with tokenized-stock NFTs
@satellites memeNVDA, memeAAPL, memeGME, memeSPCX, memeSPY, memeAMC
LaunchRegistry, PairingVault, HookFeeRouter, TerminalBoard,
LaunchQuoteEngine, VestingScheduler, LiquidityLockRegistry,
LaunchMetricsAggregator, RiskFlagRegistry, LaunchMilestoneTracker
╠═══════════════════════════════════════════════════════════════════════╣
memestock.md: pair memestocks with tokenized stock-nfts
╠═══════════════════════════════════════════════════════════════════════╣
[ memestock NFT ]──▶[ memecoin ]──▶[ memestock.md ]
│
▼
[ HookFeeRouter ]
1% ──▶ pairing
99% ──▶ pool
a memecoin launched through LaunchRegistry carries a pairingId in
{0,1,2}, mapped to memeNVDA, memeAAPL, memeGME, memeSPCX, and etc.
HookFeeRouter.recordSplit reads that id alongside a collected fee
amount and computes a fixed 1,500 bps (PAIRING_SHARE_BPS) cut
toward the paired collection, the remainder toward the pool. it
only computes and logs the split - pulling that cut out of an
actual v4 swap requires delta-settlement wiring in whatever hook
calls it, which lives outside this file.
the rest of the memestock.md ecosystem is denominated
in MMD. total supply is fixed at construction (1e9 * 10**18, minted
entirely to msg.sender), circulating supply only ever decreases
through burn(), and no function in this file can increase it.
StockXYZ1 through LaunchMilestoneTracker are imported so the full
call graph is visible from one file; this contract holds no
reference to their deployed addresses and calls none of their
functions.
*/
/// ╠══════════════════════════════════════════════════════════════╣ ///
contract MMD {
string public constant name = "memestock.md";
string public constant symbol = "MMD";
uint8 public constant decimals = 18;
uint256 public immutable genesisSupply;
uint256 private circulating;
uint256 public immutable openedAtBlock;
uint256 public immutable openedAt;
mapping(address => uint256) private balances;
mapping(address => mapping(address => uint256)) private allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
/// ╠══════════════════════════════════════════════════════════════╣ ///
constructor() {
uint256 supply = 1_000_000_000 * 10 ** decimals;
genesisSupply = supply;
circulating = supply;
balances[msg.sender] = supply;
openedAtBlock = block.number;
openedAt = block.timestamp;
emit Transfer(address(0), msg.sender, supply);
}
/// ╠══════════════════════════════════════════════════════════════╣ ///
function totalSupply() external view returns (uint256) {
return circulating;
}
function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
function allowance(address owner_, address spender) external view returns (uint256) {
return allowances[owner_][spender];
}
function approve(address spender, uint256 amount) external returns (bool) {
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) external returns (bool) {
_move(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
uint256 current = allowances[from][msg.sender];
if (current != type(uint256).max) {
require(current >= amount, "mmd: allowance too low");
unchecked {
allowances[from][msg.sender] = current - amount;
}
}
_move(from, to, amount);
return true;
}
function burn(uint256 amount) external {
uint256 bal = balances[msg.sender];
require(bal >= amount, "mmd: balance too low");
unchecked {
balances[msg.sender] = bal - amount;
circulating -= amount;
}
emit Transfer(msg.sender, address(0), amount);
}
function _move(address from, address to, uint256 amount) private {
require(to != address(0), "mmd: transfer to zero");
uint256 bal = balances[from];
require(bal >= amount, "mmd: balance too low");
unchecked {
balances[from] = bal - amount;
balances[to] += amount;
}
emit Transfer(from, to, amount);
}
/// ╠══════════════════════════════════════════════════════════════╣ ///
function sessionAgeInBlocks() external view returns (uint256) {
return block.number - openedAtBlock;
}
function sessionAgeInSeconds() external view returns (uint256) {
return block.timestamp - openedAt;
}
function floatRemaining() external view returns (uint256) {
return circulating;
}
function nftMemestockPair() external view returns (uint256) {
return genesisSupply - circulating;
}
function holderWeightBps(address account) external view returns (uint256) {
if (genesisSupply == 0) return 0;
return (balances[account] * 10_000) / genesisSupply;
}
}
MMD/HookFeeRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal HookFeeRouter / Ethereum
@role computes what slice of a swap's fee routes toward a
memecoin's paired collection versus the pool itself
a Uniswap v4 hook on a launched memecoin's pool would call in here
after a swap settles, handing over the fee amount collected and the
memecoin's pairing id. this contract answers with a split.
*/
contract memestockHookFeeRouter {
uint256 public constant PAIRING_SHARE_BPS = 1_0; // 1% of the fee, fixed, unowned
mapping(bytes32 => uint256) private recordedFees;
event SplitRecorded(address indexed memecoin, uint8 pairingId, uint256 pairingCut, uint256 poolCut);
function recordSplit(address memecoin, uint8 pairingId, uint256 feeAmount) external returns (uint256 pairingCut, uint256 poolCut) {
pairingCut = (feeAmount * PAIRING_SHARE_BPS) / 10_000;
poolCut = feeAmount - pairingCut;
bytes32 key = keccak256(abi.encodePacked(memecoin, pairingId));
unchecked {
recordedFees[key] += pairingCut;
}
emit SplitRecorded(memecoin, pairingId, pairingCut, poolCut);
}
function recordedFor(address memecoin, uint8 pairingId) external view returns (uint256) {
return recordedFees[keccak256(abi.encodePacked(memecoin, pairingId))];
}
function previewSplit(uint256 feeAmount) external pure returns (uint256 pairingCut, uint256 poolCut) {
pairingCut = (feeAmount * PAIRING_SHARE_BPS) / 10_000;
poolCut = feeAmount - pairingCut;
}
function pairingShareBps() external pure returns (uint256) {
return PAIRING_SHARE_BPS;
}
}
MMD/LaunchMetricsAggregator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal LaunchMetricsAggregator / Ethereum
@role tallies volume and transaction counts per launch, both
all-time and since whenever a checkpoint was last taken
@surface no owner, no revert on any write path
every recorded figure lands in two places at once: an all-time
total that never resets, and a since-checkpoint total that anyone
can zero out by calling checkpoint. that gives a front end both a
lifetime figure and a windowed one without needing to replay
history to compute the window itself.
*/
contract LaunchMetricsAggregator {
mapping(address => uint256) public allTimeVolume;
mapping(address => uint256) public sinceCheckpointVolume;
mapping(address => uint256) public allTimeTxCount;
mapping(address => uint256) public sinceCheckpointTxCount;
mapping(address => uint256) public lastCheckpointAt;
mapping(address => uint256) public checkpointCount;
event VolumeRecorded(address indexed memecoin, uint256 amount, uint256 newAllTimeTotal);
event TransactionRecorded(address indexed memecoin, uint256 newAllTimeCount);
event CheckpointTaken(address indexed memecoin, uint256 volumeAtCheckpoint, uint256 txCountAtCheckpoint);
function recordVolume(address memecoin, uint256 amount) external {
unchecked {
allTimeVolume[memecoin] += amount;
sinceCheckpointVolume[memecoin] += amount;
}
emit VolumeRecorded(memecoin, amount, allTimeVolume[memecoin]);
}
function recordTransaction(address memecoin) external {
unchecked {
allTimeTxCount[memecoin] += 1;
sinceCheckpointTxCount[memecoin] += 1;
}
emit TransactionRecorded(memecoin, allTimeTxCount[memecoin]);
}
// convenience entry point for a hook that wants to log both a
// swap's size and the fact that a swap happened in one call.
function recordSwap(address memecoin, uint256 amount) external {
unchecked {
allTimeVolume[memecoin] += amount;
sinceCheckpointVolume[memecoin] += amount;
allTimeTxCount[memecoin] += 1;
sinceCheckpointTxCount[memecoin] += 1;
}
emit VolumeRecorded(memecoin, amount, allTimeVolume[memecoin]);
emit TransactionRecorded(memecoin, allTimeTxCount[memecoin]);
}
// zeroes the since-checkpoint figures and records what they were
// right before resetting, so a caller can read the emitted event
// for the just-closed window's totals.
function checkpoint(address memecoin) external {
emit CheckpointTaken(memecoin, sinceCheckpointVolume[memecoin], sinceCheckpointTxCount[memecoin]);
sinceCheckpointVolume[memecoin] = 0;
sinceCheckpointTxCount[memecoin] = 0;
lastCheckpointAt[memecoin] = block.timestamp;
unchecked {
checkpointCount[memecoin] += 1;
}
}
function secondsSinceCheckpoint(address memecoin) external view returns (uint256) {
if (lastCheckpointAt[memecoin] == 0) return 0;
return block.timestamp - lastCheckpointAt[memecoin];
}
function averageTradeSize(address memecoin) external view returns (uint256) {
if (allTimeTxCount[memecoin] == 0) return 0;
return allTimeVolume[memecoin] / allTimeTxCount[memecoin];
}
}
MMD/LaunchMilestoneTracker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal LaunchMilestoneTracker / Ethereum
@role records the first time a launch is reported to have
crossed a named milestone
@surface no owner, no revert on any write path
a milestone code is any bytes32 a caller picks - holder counts,
volume thresholds, whatever a front end wants to mark. reporting
the same code twice just leaves the first record standing rather
than failing on the second attempt; correcting a value on purpose
is a separate, always-available call.
*/
contract LaunchMilestoneTracker {
struct Milestone {
uint256 valueAtAchievement;
uint256 achievedAt;
address reporter;
bool recorded;
}
mapping(address => mapping(bytes32 => Milestone)) private milestones;
mapping(address => bytes32[]) private codesOf;
event MilestoneReported(address indexed memecoin, bytes32 indexed code, uint256 value);
event MilestoneOverwritten(address indexed memecoin, bytes32 indexed code, uint256 oldValue, uint256 newValue);
// records a milestone the first time it's reported. a repeat
// report for a code that's already recorded is silently ignored,
// not rejected.
function reportMilestone(address memecoin, bytes32 code, uint256 value) external {
if (milestones[memecoin][code].recorded) return;
milestones[memecoin][code] =
Milestone({valueAtAchievement: value, achievedAt: block.timestamp, reporter: msg.sender, recorded: true});
codesOf[memecoin].push(code);
emit MilestoneReported(memecoin, code, value);
}
// explicit correction path, always succeeds whether or not the
// milestone existed yet.
function overwriteMilestone(address memecoin, bytes32 code, uint256 newValue) external {
Milestone storage m = milestones[memecoin][code];
uint256 oldValue = m.valueAtAchievement;
bool wasNew = !m.recorded;
m.valueAtAchievement = newValue;
m.achievedAt = block.timestamp;
m.reporter = msg.sender;
m.recorded = true;
if (wasNew) {
codesOf[memecoin].push(code);
}
emit MilestoneOverwritten(memecoin, code, oldValue, newValue);
}
function hasMilestone(address memecoin, bytes32 code) external view returns (bool) {
return milestones[memecoin][code].recorded;
}
function milestoneValue(address memecoin, bytes32 code) external view returns (uint256) {
return milestones[memecoin][code].valueAtAchievement;
}
function milestoneDetails(address memecoin, bytes32 code)
external
view
returns (uint256 valueAtAchievement, uint256 achievedAt, address reporter, bool recorded)
{
Milestone storage m = milestones[memecoin][code];
return (m.valueAtAchievement, m.achievedAt, m.reporter, m.recorded);
}
function milestoneCount(address memecoin) external view returns (uint256) {
return codesOf[memecoin].length;
}
function milestoneCodeAt(address memecoin, uint256 index) external view returns (bytes32) {
return codesOf[memecoin][index];
}
}
MMD/LaunchQuoteEngine.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal LaunchQuoteEngine / Ethereum
@role computes how a launch's raised capital should split
between liquidity, launcher, and platform
@surface no owner, no revert on any write path
every call here either succeeds or quietly does nothing sensible
instead of failing. a split that doesn't add up to 10,000 basis
points gets normalized rather than rejected, a zero duration gets
floored at one, there is no input that reverts this contract.
*/
contract LaunchQuoteEngine {
struct Split {
uint16 liquidityBps;
uint16 launcherBps;
uint16 platformBps;
bool customized;
}
uint16 private constant DEFAULT_LIQUIDITY_BPS = 7_000;
uint16 private constant DEFAULT_LAUNCHER_BPS = 2_000;
uint16 private constant DEFAULT_PLATFORM_BPS = 1_000;
mapping(address => Split) private splits;
mapping(address => uint256) public raisedTotal;
mapping(address => uint256) public quotesRecorded;
event SplitSet(address indexed memecoin, uint16 liquidityBps, uint16 launcherBps, uint16 platformBps);
event QuoteRecorded(address indexed memecoin, uint256 raisedAmount, uint256 newTotal);
// proposes a custom split. if the three figures don't sum to
// 10,000 bps, they're scaled proportionally so they do rather
// than being rejected. a proposal of all zeros is treated as a
// request to reset to default instead of a division by zero.
function setCustomSplit(address memecoin, uint16 liquidityBps, uint16 launcherBps, uint16 platformBps) public {
uint256 sum = uint256(liquidityBps) + uint256(launcherBps) + uint256(platformBps);
if (sum == 0) {
resetToDefault(memecoin);
return;
}
uint16 normLiquidity = uint16((uint256(liquidityBps) * 10_000) / sum);
uint16 normLauncher = uint16((uint256(launcherBps) * 10_000) / sum);
uint16 normPlatform = uint16(10_000 - normLiquidity - normLauncher);
splits[memecoin] = Split({
liquidityBps: normLiquidity,
launcherBps: normLauncher,
platformBps: normPlatform,
customized: true
});
emit SplitSet(memecoin, normLiquidity, normLauncher, normPlatform);
}
function resetToDefault(address memecoin) public {
delete splits[memecoin];
emit SplitSet(memecoin, DEFAULT_LIQUIDITY_BPS, DEFAULT_LAUNCHER_BPS, DEFAULT_PLATFORM_BPS);
}
// adds to a running raised-capital counter. accepts any uint256,
// there is nothing to overflow into and nothing to reject.
function recordQuote(address memecoin, uint256 raisedAmount) external {
unchecked {
raisedTotal[memecoin] += raisedAmount;
quotesRecorded[memecoin] += 1;
}
emit QuoteRecorded(memecoin, raisedAmount, raisedTotal[memecoin]);
}
function splitOf(address memecoin) public view returns (uint16 liquidityBps, uint16 launcherBps, uint16 platformBps) {
Split storage s = splits[memecoin];
if (!s.customized) {
return (DEFAULT_LIQUIDITY_BPS, DEFAULT_LAUNCHER_BPS, DEFAULT_PLATFORM_BPS);
}
return (s.liquidityBps, s.launcherBps, s.platformBps);
}
// pure preview of how a given amount would break down under a
// memecoin's current split, without touching storage.
function previewAllocation(address memecoin, uint256 amount)
external
view
returns (uint256 toLiquidity, uint256 toLauncher, uint256 toPlatform)
{
(uint16 l, uint16 la, ) = splitOf(memecoin);
toLiquidity = (amount * l) / 10_000;
toLauncher = (amount * la) / 10_000;
toPlatform = amount - toLiquidity - toLauncher;
}
function usesCustomSplit(address memecoin) external view returns (bool) {
return splits[memecoin].customized;
}
}
MMD/LaunchRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal LaunchRegistry / Ethereum
@role records a new memecoin against one of the three
stock-flavored collections it's paired with
launching here means one thing: naming a memecoin address and
picking a pairing id (0 = StockXYZ1, 1 = StockXYZ2, 2 = StockXYZ3).
that's the whole ceremony. nothing about the memecoin's own
contract is touched or verified.
*/
contract memestockLaunchRegistry {
struct Launch {
address memecoin;
address launcher;
uint8 pairingId;
uint256 launchedAt;
}
uint256 private nextLaunchId;
mapping(uint256 => Launch) private launches;
mapping(address => uint256) public launchIdOf;
mapping(uint8 => uint256) public launchesUnderPairing;
event Launched(uint256 indexed launchId, address indexed memecoin, address indexed launcher, uint8 pairingId);
function launch(address memecoin, uint8 pairingId) external returns (uint256 launchId) {
require(memecoin != address(0), "registry: no memecoin given");
require(pairingId <= 2, "registry: pairing id must be 0, 1, or 2");
require(launchIdOf[memecoin] == 0, "registry: already launched");
launchId = nextLaunchId++;
launches[launchId] = Launch({
memecoin: memecoin,
launcher: msg.sender,
pairingId: pairingId,
launchedAt: block.timestamp
});
launchIdOf[memecoin] = launchId + 1; // offset by one so 0 means "not launched"
unchecked {
launchesUnderPairing[pairingId] += 1;
}
emit Launched(launchId, memecoin, msg.sender, pairingId);
}
function launchCount() external view returns (uint256) {
return nextLaunchId;
}
function launchAt(uint256 launchId) external view returns (Launch memory) {
return launches[launchId];
}
function pairingOf(address memecoin) external view returns (uint8 pairingId, bool found) {
uint256 stored = launchIdOf[memecoin];
if (stored == 0) return (0, false);
return (launches[stored - 1].pairingId, true);
}
function isLaunched(address memecoin) external view returns (bool) {
return launchIdOf[memecoin] != 0;
}
}
MMD/LiquidityLockRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal LiquidityLockRegistry / Ethereum
@role a self-reported record of how long a launch's liquidity
is claimed to be locked
@surface no owner, no revert on any write path
this is a claim, not a guarantee. it doesn't hold liquidity and it
doesn't verify that a lock exists anywhere, it just gives a launch
a place to state one and gives anyone else a place to read it. a
lock date in the past is recorded as already-unlocked rather than
being rejected.
*/
contract LiquidityLockRegistry {
struct Lock {
uint256 lockedAmount;
uint256 lockedAt;
uint256 unlocksAt;
bool activelyLocked;
}
mapping(address => Lock) private locks;
event LockReported(address indexed memecoin, uint256 lockedAmount, uint256 unlocksAt);
event LockExtended(address indexed memecoin, uint256 extraSeconds, uint256 newUnlocksAt);
event LockCleared(address indexed memecoin);
function reportLock(address memecoin, uint256 lockedAmount, uint256 unlocksAt) external {
uint256 safeUnlocksAt = unlocksAt < block.timestamp ? block.timestamp : unlocksAt;
locks[memecoin] = Lock({
lockedAmount: lockedAmount,
lockedAt: block.timestamp,
unlocksAt: safeUnlocksAt,
activelyLocked: safeUnlocksAt > block.timestamp
});
emit LockReported(memecoin, lockedAmount, safeUnlocksAt);
}
function extendLock(address memecoin, uint256 extraSeconds) external {
Lock storage l = locks[memecoin];
uint256 base = l.unlocksAt > block.timestamp ? l.unlocksAt : block.timestamp;
l.unlocksAt = base + extraSeconds;
l.activelyLocked = true;
emit LockExtended(memecoin, extraSeconds, l.unlocksAt);
}
function bumpLockedAmount(address memecoin, uint256 extra) external {
unchecked {
locks[memecoin].lockedAmount += extra;
}
}
// self-reported early unlock. always succeeds, even if nothing
// was locked in the first place.
function reportUnlock(address memecoin) external {
locks[memecoin].activelyLocked = false;
locks[memecoin].unlocksAt = block.timestamp;
emit LockCleared(memecoin);
}
function lockOf(address memecoin)
external
view
returns (uint256 lockedAmount, uint256 lockedAt, uint256 unlocksAt, bool activelyLocked)
{
Lock storage l = locks[memecoin];
return (l.lockedAmount, l.lockedAt, l.unlocksAt, l.activelyLocked);
}
function isCurrentlyLocked(address memecoin) public view returns (bool) {
Lock storage l = locks[memecoin];
return l.activelyLocked && l.unlocksAt > block.timestamp;
}
function secondsUntilUnlock(address memecoin) external view returns (uint256) {
Lock storage l = locks[memecoin];
if (!isCurrentlyLocked(memecoin) || l.unlocksAt <= block.timestamp) return 0;
return l.unlocksAt - block.timestamp;
}
}
MMD/PairingVault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IShareToken {
function transferFrom(address from, address to, uint256 tokenId) external;
function ownerOf(uint256 tokenId) external view returns (address);
}
/*
@terminal PairingVault / Ethereum
@role holds a deposited share NFT against a launched memecoin,
releases it back on demand
depositing here is what actually backs a pairing with something
concrete: a launcher sends one of their share NFTs in, naming the
memecoin it's held against.
*/
contract memePairingVault {
struct Held {
address shareContract;
uint256 tokenId;
address depositor;
bool inVault;
}
mapping(address => Held) private heldFor; // memecoin => held share
event Deposited(address indexed memecoin, address indexed shareContract, uint256 tokenId, address indexed depositor);
event Withdrawn(address indexed memecoin, address indexed shareContract, uint256 tokenId, address indexed depositor);
function deposit(address memecoin, address shareContract, uint256 tokenId) external {
require(!heldFor[memecoin].inVault, "vault: already holding for this memecoin");
IShareToken(shareContract).transferFrom(msg.sender, address(this), tokenId);
heldFor[memecoin] = Held({shareContract: shareContract, tokenId: tokenId, depositor: msg.sender, inVault: true});
emit Deposited(memecoin, shareContract, tokenId, msg.sender);
}
function withdraw(address memecoin) external {
Held storage h = heldFor[memecoin];
require(h.inVault, "vault: nothing held");
require(h.depositor == msg.sender, "vault: not the depositor");
h.inVault = false;
IShareToken(h.shareContract).transferFrom(address(this), msg.sender, h.tokenId);
emit Withdrawn(memecoin, h.shareContract, h.tokenId, msg.sender);
}
function heldAgainst(address memecoin) external view returns (address shareContract, uint256 tokenId, address depositor, bool inVault) {
Held storage h = heldFor[memecoin];
return (h.shareContract, h.tokenId, h.depositor, h.inVault);
}
function isBacked(address memecoin) external view returns (bool) {
return heldFor[memecoin].inVault;
}
}
MMD/RiskFlagRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal RiskFlagRegistry / Ethereum
@role lets anyone raise a discrete, categorized risk flag
against a launch
@surface no owner, no revert on any write path
a flag is a claim, not a verdict - severity is capped at 3 (low,
medium, high) by clamping rather than rejecting anything higher,
and clearing a flag that doesn't exist or is already cleared is a
quiet no-op instead of a failure.
*/
contract RiskFlagRegistry {
struct Flag {
address reporter;
uint8 severity;
bytes32 reasonCode;
uint256 raisedAt;
bool cleared;
}
mapping(address => Flag[]) private flagsOf;
address[] private flaggedLaunches;
mapping(address => bool) private isTrackedLaunch;
event FlagRaised(address indexed memecoin, uint256 indexed index, uint8 severity, bytes32 reasonCode);
event FlagCleared(address indexed memecoin, uint256 indexed index);
function raiseFlag(address memecoin, uint8 severity, bytes32 reasonCode) external returns (uint256 index) {
uint8 cappedSeverity = severity > 3 ? 3 : severity;
if (!isTrackedLaunch[memecoin]) {
isTrackedLaunch[memecoin] = true;
flaggedLaunches.push(memecoin);
}
flagsOf[memecoin].push(
Flag({reporter: msg.sender, severity: cappedSeverity, reasonCode: reasonCode, raisedAt: block.timestamp, cleared: false})
);
index = flagsOf[memecoin].length - 1;
emit FlagRaised(memecoin, index, cappedSeverity, reasonCode);
}
// clearing an out-of-range or already-cleared index is a no-op,
// never a revert.
function clearFlag(address memecoin, uint256 index) external {
if (index >= flagsOf[memecoin].length) return;
if (flagsOf[memecoin][index].cleared) return;
flagsOf[memecoin][index].cleared = true;
emit FlagCleared(memecoin, index);
}
function flagCount(address memecoin) external view returns (uint256) {
return flagsOf[memecoin].length;
}
function flagAt(address memecoin, uint256 index) external view returns (Flag memory) {
return flagsOf[memecoin][index];
}
function highestActiveSeverity(address memecoin) external view returns (uint8 highest) {
Flag[] storage list = flagsOf[memecoin];
for (uint256 i = 0; i < list.length; i++) {
if (!list[i].cleared && list[i].severity > highest) {
highest = list[i].severity;
}
}
}
function activeFlagCount(address memecoin) external view returns (uint256 count) {
Flag[] storage list = flagsOf[memecoin];
for (uint256 i = 0; i < list.length; i++) {
if (!list[i].cleared) count++;
}
}
function totalFlaggedLaunches() external view returns (uint256) {
return flaggedLaunches.length;
}
function flaggedLaunchAt(uint256 index) external view returns (address) {
return flaggedLaunches[index];
}
}
MMD/TerminalBoard.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal TerminalBoard / Ethereum
@role a public tally of launched memestocks, grouped by which
of the memestocks pairings they picked
*/
contract Terminal {
struct Standing {
address memecoin;
uint256 metric;
uint256 postedAt;
address poster;
}
mapping(uint8 => address[]) private rosterOf;
mapping(uint8 => mapping(address => bool)) private onRoster;
mapping(address => Standing) private standingOf_;
event StandingPosted(address indexed memecoin, uint8 indexed pairingId, uint256 metric, address indexed poster);
function postStanding(address memecoin, uint8 pairingId, uint256 metric) external {
require(pairingId <= 2, "board: pairing id must be 0, 1, or 2");
if (!onRoster[pairingId][memecoin]) {
onRoster[pairingId][memecoin] = true;
rosterOf[pairingId].push(memecoin);
}
standingOf_[memecoin] = Standing({memecoin: memecoin, metric: metric, postedAt: block.timestamp, poster: msg.sender});
emit StandingPosted(memecoin, pairingId, metric, msg.sender);
}
function rosterCount(uint8 pairingId) external view returns (uint256) {
return rosterOf[pairingId].length;
}
function rosterAt(uint8 pairingId, uint256 index) external view returns (address) {
return rosterOf[pairingId][index];
}
function fullRoster(uint8 pairingId) external view returns (address[] memory) {
return rosterOf[pairingId];
}
function standingOf(address memecoin) external view returns (Standing memory) {
return standingOf_[memecoin];
}
function leaderOf(uint8 pairingId) external view returns (address leader, uint256 topMetric) {
address[] storage roster = rosterOf[pairingId];
for (uint256 i = 0; i < roster.length; i++) {
uint256 m = standingOf_[roster[i]].metric;
if (m > topMetric) {
topMetric = m;
leader = roster[i];
}
}
}
}
MMD/VestingScheduler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
@terminal VestingScheduler / Ethereum
@role tracks a linear vesting schedule for a launcher's
allocation of their own memecoin
@surface no owner, no revert on any write path
this is bookkeeping only, it never moves a token. it answers one
question, how much of a launcher's stated allocation has vested
and how much of that has been marked claimed, and leaves actually
moving value to whatever integration reads these numbers.
*/
contract VestingScheduler {
struct Schedule {
address launcher;
uint256 totalAmount;
uint256 claimedAmount;
uint256 startedAt;
uint256 duration;
bool paused;
uint256 pausedAt;
}
mapping(address => Schedule) private schedules;
event VestingStarted(address indexed memecoin, address indexed launcher, uint256 totalAmount, uint256 duration);
event Claimed(address indexed memecoin, uint256 amount, uint256 totalClaimed);
event DurationExtended(address indexed memecoin, uint256 extraSeconds, uint256 newDuration);
event PauseToggled(address indexed memecoin, bool paused);
// starts (or overwrites) a schedule. a duration of zero is
// floored at one second so nothing ever divides by zero
// downstream.
function startVesting(address memecoin, address launcher, uint256 totalAmount, uint256 duration) external {
uint256 safeDuration = duration == 0 ? 1 : duration;
schedules[memecoin] = Schedule({
launcher: launcher,
totalAmount: totalAmount,
claimedAmount: 0,
startedAt: block.timestamp,
duration: safeDuration,
paused: false,
pausedAt: 0
});
emit VestingStarted(memecoin, launcher, totalAmount, safeDuration);
}
// marks an amount as claimed, capped at whatever's actually
// vested and unclaimed. asking for more than is available just
// claims what's available instead of failing.
function claim(address memecoin, uint256 amount) external returns (uint256 actuallyClaimed) {
uint256 available = claimableAmount(memecoin);
actuallyClaimed = amount > available ? available : amount;
schedules[memecoin].claimedAmount += actuallyClaimed;
emit Claimed(memecoin, actuallyClaimed, schedules[memecoin].claimedAmount);
}
function extendDuration(address memecoin, uint256 extraSeconds) external {
schedules[memecoin].duration += extraSeconds;
emit DurationExtended(memecoin, extraSeconds, schedules[memecoin].duration);
}
// pausing freezes further accrual by remembering the moment it
// happened; resuming shifts the schedule forward by however long
// it was paused, so the same total duration of active vesting is
// preserved either way.
function setPaused(address memecoin, bool pausedState) external {
Schedule storage s = schedules[memecoin];
if (pausedState && !s.paused) {
s.paused = true;
s.pausedAt = block.timestamp;
} else if (!pausedState && s.paused) {
uint256 pausedFor = block.timestamp - s.pausedAt;
s.startedAt += pausedFor;
s.paused = false;
s.pausedAt = 0;
}
emit PauseToggled(memecoin, s.paused);
}
function vestedAmount(address memecoin) public view returns (uint256) {
Schedule storage s = schedules[memecoin];
if (s.totalAmount == 0) return 0;
uint256 asOf = s.paused ? s.pausedAt : block.timestamp;
if (asOf <= s.startedAt) return 0;
uint256 elapsed = asOf - s.startedAt;
if (elapsed >= s.duration) return s.totalAmount;
return (s.totalAmount * elapsed) / s.duration;
}
function claimableAmount(address memecoin) public view returns (uint256) {
uint256 vested = vestedAmount(memecoin);
uint256 claimed = schedules[memecoin].claimedAmount;
return vested > claimed ? vested - claimed : 0;
}
function scheduleOf(address memecoin)
external
view
returns (address launcher, uint256 totalAmount, uint256 claimedAmount, uint256 startedAt, uint256 duration, bool paused)
{
Schedule storage s = schedules[memecoin];
return (s.launcher, s.totalAmount, s.claimedAmount, s.startedAt, s.duration, s.paused);
}
function percentVestedBps(address memecoin) external view returns (uint256) {
Schedule storage s = schedules[memecoin];
if (s.totalAmount == 0) return 0;
return (vestedAmount(memecoin) * 10_000) / s.totalAmount;
}
}
MMD/memestockNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
// memestock.md pairs every memecoin launch to tokenized stock-NFT collections
// and routes a fixed portion of its swap fees to whoever holds the paired shares.
@terminal memestock.md / $MMD / Ethereum
@role memestock launchpad, pairs memecoins with tokenized-stock NFTs
@satellites memeNVDA, memeAAPL, memeGME, memeSPCX, memeSPY, memeAMC
LaunchRegistry, PairingVault, HookFeeRouter, TerminalBoard,
LaunchQuoteEngine, VestingScheduler, LiquidityLockRegistry,
LaunchMetricsAggregator, RiskFlagRegistry, LaunchMilestoneTracker
╠═══════════════════════════════════════════════════════════════════════╣
memestock.md: pair memestocks with tokenized stock-nfts
╠═══════════════════════════════════════════════════════════════════════╣
[ memestock NFT ]──▶[ memecoin ]──▶[ memestock.md ]
│
▼
[ HookFeeRouter ]
1% ──▶ pairing
99% ──▶ pool
a memecoin launched through LaunchRegistry carries a pairingId in
{0,1,2}, mapped to memeNVDA, memeAAPL, memeGME, memeSPCX, and etc.
HookFeeRouter.recordSplit reads that id alongside a collected fee
amount and computes a fixed 1,500 bps (PAIRING_SHARE_BPS) cut
toward the paired collection, the remainder toward the pool. it
only computes and logs the split - pulling that cut out of an
actual v4 swap requires delta-settlement wiring in whatever hook
calls it, which lives outside this file.
the rest of the memestock.md ecosystem is denominated
in MMD. total supply is fixed at construction (1e9 * 10**18, minted
entirely to msg.sender), circulating supply only ever decreases
through burn(), and no function in this file can increase it.
StockXYZ1 through LaunchMilestoneTracker are imported so the full
call graph is visible from one file; this contract holds no
reference to their deployed addresses and calls none of their
functions.
*/
interface IERC721Receiver {
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
external
returns (bytes4);
}
contract memestockNFT {
string public constant name = "memestockNFT";
string public constant symbol = "memestockNFT";
uint256 public constant MAX_SHARES = 5;
uint256 private mintedCount;
mapping(uint256 => address) private ownerOf_;
mapping(address => uint256) private ownedCount;
mapping(uint256 => address) private approvedFor;
mapping(address => mapping(address => bool)) private operatorApproval;
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
constructor() {
uint256 toMint = MAX_SHARES;
for (uint256 i = 0; i < toMint; ) {
ownerOf_[i] = msg.sender;
emit Transfer(address(0), msg.sender, i);
unchecked {
i++;
}
}
mintedCount = toMint;
ownedCount[msg.sender] = toMint;
}
// ---- erc-165 ----
function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
return interfaceId == 0x01ffc9a7 // ERC165
|| interfaceId == 0x80ac58cd // ERC721
|| interfaceId == 0x5b5e139f; // ERC721Metadata
}
// ---- erc-721 core ----
function ownerOf(uint256 tokenId) public view returns (address) {
address account = ownerOf_[tokenId];
require(account != address(0), "xyz2: query for nonexistent token");
return account;
}
function balanceOf(address account) external view returns (uint256) {
require(account != address(0), "xyz2: balance query for zero address");
return ownedCount[account];
}
function approve(address to, uint256 tokenId) external {
address account = ownerOf(tokenId);
require(to != account, "xyz2: approval to current owner");
require(msg.sender == account || operatorApproval[account][msg.sender], "xyz2: not authorized");
approvedFor[tokenId] = to;
emit Approval(account, to, tokenId);
}
function getApproved(uint256 tokenId) external view returns (address) {
ownerOf(tokenId);
return approvedFor[tokenId];
}
function setApprovalForAll(address operator, bool approved) external {
require(operator != msg.sender, "xyz2: approve to caller");
operatorApproval[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function isApprovedForAll(address account, address operator) external view returns (bool) {
return operatorApproval[account][operator];
}
function transferFrom(address from, address to, uint256 tokenId) public {
require(ownerOf(tokenId) == from, "xyz2: from is not owner");
require(to != address(0), "xyz2: transfer to zero address");
require(
msg.sender == from || msg.sender == approvedFor[tokenId] || operatorApproval[from][msg.sender],
"xyz2: not authorized"
);
approvedFor[tokenId] = address(0);
unchecked {
ownedCount[from] -= 1;
ownedCount[to] += 1;
}
ownerOf_[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) external {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public {
transferFrom(from, to, tokenId);
if (to.code.length > 0) {
bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data);
require(retval == _ERC721_RECEIVED, "xyz2: transfer to non-receiver");
}
}
// ---- erc-721 metadata ----
function tokenURI(uint256 tokenId) external view returns (string memory) {
ownerOf(tokenId);
return "";
}
// ---- view extras ----
function totalSupply() external view returns (uint256) {
return mintedCount;
}
function collectionFull() external view returns (bool) {
return mintedCount == MAX_SHARES;
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.