StockFunMetadata

0x6bee50a89c3b22d83fb83067dcd2f932fcee63e3

Verification
Verified
v0.8.26+commit.8a97fa7a
Type
Contract
3,899 bytes
ABI entries
11
5 read · 1 write
License
none

Contract information

Address
0x6bee50a89c3b22d83fb83067dcd2f932fcee63e3
Chain
Robinhood Chain (4663)
Compiler
v0.8.26+commit.8a97fa7a
Optimization
Enabled
Creation tx
0x92925e13d5…32216ccaf4

Token

Not a token

This contract does not expose ERC-20 metadata.

Read contract (5)

MAX_IMAGE_BYTES()uint256
MAX_LINK_BYTES()uint256
getMeta(address)tuple
getMetaBatch(address[])tuple[]
launcher()address

Events (1)

MetadataSet

ABI

[
  {
    "inputs": [
      {
        "internalType": "contract StockFunLauncher",
        "name": "launcher_",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [],
    "name": "ImageTooLarge",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "LinkTooLong",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NotCreator",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "setter",
        "type": "address"
      }
    ],
    "name": "MetadataSet",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "MAX_IMAGE_BYTES",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "MAX_LINK_BYTES",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      }
    ],
    "name": "getMeta",
    "outputs": [
      {
        "components": [
          {
            "internalType": "string",
            "name": "image",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "website",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "xUrl",
            "type": "string"
          }
        ],
        "internalType": "struct StockFunMetadata.Meta",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address[]",
        "name": "tokens",
        "type": "address[]"
      }
    ],
    "name": "getMetaBatch",
    "outputs": [
      {
        "components": [
          {
            "internalType": "string",
            "name": "image",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "website",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "xUrl",
            "type": "string"
          }
        ],
        "internalType": "struct StockFunMetadata.Meta[]",
        "name": "out",
        "type": "tuple[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "launcher",
    "outputs": [
      {
        "internalType": "contract StockFunLauncher",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "launchId",
        "type": "uint256"
      },
      {
        "components": [
          {
            "internalType": "string",
            "name": "image",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "website",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "xUrl",
            "type": "string"
          }
        ],
        "internalType": "struct StockFunMetadata.Meta",
        "name": "m",
        "type": "tuple"
      }
    ],
    "name": "setMetadata",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import {StockFunLauncher} from "./StockFunLauncher.sol";

/// @notice On-chain token metadata (logo + links) for stock.fun launches.
/// Fully on-chain: the image is a small data URI set by the launch creator,
/// so no backend or IPFS pinning is needed. Keyed by token address.
contract StockFunMetadata {
    /// @dev Generous cap for a ~64px compressed data URI; keeps griefing bounded.
    uint256 public constant MAX_IMAGE_BYTES = 16_000;
    uint256 public constant MAX_LINK_BYTES = 200;

    StockFunLauncher public immutable launcher;

    struct Meta {
        string image; // data: URI (or https URL)
        string website;
        string xUrl;
    }

    mapping(address token => Meta) internal _meta;

    event MetadataSet(address indexed token, address indexed setter);

    error NotCreator();
    error ImageTooLarge();
    error LinkTooLong();

    constructor(StockFunLauncher launcher_) {
        launcher = launcher_;
    }

    /// @notice Set or update metadata for a launch. Only its creator may call.
    function setMetadata(uint256 launchId, Meta calldata m) external {
        StockFunLauncher.Launch memory l = launcher.getLaunch(launchId);
        if (msg.sender != l.creator) revert NotCreator();
        if (bytes(m.image).length > MAX_IMAGE_BYTES) revert ImageTooLarge();
        if (bytes(m.website).length > MAX_LINK_BYTES || bytes(m.xUrl).length > MAX_LINK_BYTES) revert LinkTooLong();
        _meta[l.token] = m;
        emit MetadataSet(l.token, msg.sender);
    }

    function getMeta(address token) external view returns (Meta memory) {
        return _meta[token];
    }

    function getMetaBatch(address[] calldata tokens) external view returns (Meta[] memory out) {
        out = new Meta[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            out[i] = _meta[tokens[i]];
        }
    }
}
Chain explorer3058msChain node79ms