// Sample tokens for the pedby.com marketplace — playful, Base-themed, fictional.

function pedbySeedCurve(realEth) {
  const fresh = PEDBY_CURVE.init();
  return PEDBY_CURVE.buy(fresh, realEth).curve;
}

// Deterministic pseudo-random sparkline seeded from a string
function pedbySpark(seed, n = 24) {
  let h = 0;
  for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0;
  const out = [];
  let v = 5 + (h % 6);
  for (let i = 0; i < n; i++) {
    h = (h * 1103515245 + 12345) >>> 0;
    const drift = ((h % 100) / 100 - 0.36) * 3;
    v = Math.max(1, v + drift);
    out.push(v);
  }
  return out;
}

const PEDBY_TOKENS = [
  {
    id: 'frog', ticker: 'FROG', name: 'BasedFrog', tag: 'the frog that finally found onchain peace',
    description: 'BasedFrog is a community coin for people who mint first and ask questions later. No utility, just vibes and a green candle.',
    creator: '0x71c…4e2', createdAgo: '2h ago', replies: 34, realEth: 0.15,
  },
  {
    id: 'saw', ticker: 'SAW', name: 'ChainSaw', tag: 'cutting through gas fees since today',
    description: 'ChainSaw is a satirical take on L2 gas wars. Holders get nothing but bragging rights and a sharp-looking chart.',
    creator: '0x9ab…117', createdAgo: '6h ago', replies: 112, realEth: 0.9,
  },
  {
    id: 'goblin', ticker: 'GOBLIN', name: 'GasGoblin', tag: 'hoards gwei, spends none',
    description: 'GasGoblin is closing in on graduation. Once it crosses the curve it moves straight to a locked liquidity pool.',
    creator: '0x4f0…caa', createdAgo: '1d ago', replies: 341, realEth: 2.65, featured: true,
  },
  {
    id: 'meow', ticker: 'MEOW', name: 'OnchainCat', tag: 'graduated. now trades like a real coin.',
    description: 'OnchainCat was the fastest graduate this week — curve filled and liquidity locked on a Base DEX pool.',
    creator: '0x2d1…908', createdAgo: '3d ago', replies: 892, realEth: 2.8, forceGraduated: true,
  },
  {
    id: 'pod', ticker: 'POD', name: 'DegenDolphin', tag: 'just launched, still warming up the curve',
    description: 'DegenDolphin dropped minutes ago. Virtual reserves are fresh — earliest buyers get the steepest part of the curve.',
    creator: '0x88e…5c3', createdAgo: '9m ago', replies: 4, realEth: 0.02,
  },
  {
    id: 'blu', ticker: 'BLU', name: 'BlueChip', tag: 'ironically named, extremely not a blue chip',
    description: 'BlueChip is a joke about what people call things right before they aren\'t worth anything. Trade responsibly.',
    creator: '0x1aa…3f9', createdAgo: '11h ago', replies: 201, realEth: 1.8,
  },
  {
    id: 'wiz', ticker: 'WIZ', name: 'WAGMIWizard', tag: 'casting spells, none of them financial advice',
    description: 'WAGMIWizard is a mid-curve mainstay with a steady stream of small buys. No roadmap, no promises.',
    creator: '0x60b…d21', createdAgo: '19h ago', replies: 156, realEth: 0.55,
  },
  {
    id: 'rex', ticker: 'REX', name: 'RugPullRex', tag: 'self-aware name, allegedly not a rug',
    description: 'RugPullRex leans into the joke on purpose. Curve\'s public, contract\'s public, judge for yourself.',
    creator: '0xd44…8b0', createdAgo: '4h ago', replies: 63, realEth: 0.31,
  },
];

// Attach live curve state + sparkline to each token
PEDBY_TOKENS.forEach(t => {
  t.curve = pedbySeedCurve(t.realEth);
  t.graduated = t.forceGraduated || PEDBY_CURVE.graduated(t.curve);
  t.spark = pedbySpark(t.id);
});

window.PEDBY_TOKENS = PEDBY_TOKENS;
