Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

3.7 KB
Raw Blame
import { describe, it, expect } from 'vitest'
import { encodeFunctionData } from 'viem'
import { noxaLauncherAbi } from '../../src/rails/abis.js'

/**
 * Proves `noxaLauncherAbi`'s `launchToken` reproduces a REAL, SUCCESSFUL
 * historical NOXA launch transaction's calldata byte-for-byte, selector
 * included. All fields below were decoded from the real transaction's raw
 * calldata via `viem`'s own `decodeFunctionData` (not hand-transcribed) and
 * this test re-encodes them and diffs against the original bytes.
 */
describe('NOXA launchToken calldata', () => {
  it('reproduces the real "ROBIN DOG" (ROBINDOG) launch tx byte-for-byte', () => {
    // Real tx: 0x63da3b0a80cbc836806ed055ed797667e7ec59391cf7aeb5a3dcfeb9152756d0
    // to: 0xD9eC2db5f3D1b236843925949fe5bd8a3836FCcB (NOXA launchFactory), mainnet 4663
    // status: 0x1 (SUCCESS — 18 logs emitted, TokenLaunched fired), value 0.1405 ETH
    const REAL_CALLDATA = '0x686399cb000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000325efe279a17234d81d7257365a70cce7246bc06be3d36c9d21d0a07e5644e9b00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000030b0a6c97cf015495e022219ba0f9a3787c901770000000000000000000000000000000000000000000000000000000000000009524f42494e20444f4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008524f42494e444f470000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569683675706e717566707635377166706e667468746a6364776764626c6d736d6f6137366d6a6e677a69636c63346b63697a763665000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f742e6d652f726f62696e686f6f64646f676f6666696369616c706f7274616c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'

    const built = encodeFunctionData({
      abi: noxaLauncherAbi,
      functionName: 'launchToken',
      args: [
        {
          name: "ROBIN DOG",
          symbol: "ROBINDOG",
          logo: "ipfs://bafkreih6upnqufpv57qfpnfthtjcdwgdblmsmoa76mjngziclc4kcizv6e",
          description: "",
          socials: {
            telegram: "https://t.me/robinhooddogofficialportal",
            twitter: "",
            discord: "",
            website: "",
            farcaster: "",
          },
          devWallet: "0x30B0A6c97Cf015495e022219bA0F9a3787c90177",
        },
        0n,
        0n,
        "0x325efe279a17234d81d7257365a70cce7246bc06be3d36c9d21d0a07e5644e9b",
      ],
    })

    expect(built.toLowerCase()).toBe(REAL_CALLDATA.toLowerCase())
    expect(built.slice(0, 10)).toBe('0x686399cb')
  })
})