# PrismPad — integration guide

Website: https://prismpad.vercel.app
Docs: https://prismpad.vercel.app/docs
Manifest: https://prismpad.vercel.app/api/integrations

## Contracts (Arc mainnet)

- factory: `0x29a5feaca44e6434ee60fe3b86ad7a4f1349c01f`
- router: `0x874e1b77fce168cfde4fca6ef0ad91aa0d4668cd`
- hook: `0xa1dd660d7252f225F0C908A273b0d6898bF040CC`
- poolManager: `0x8366a39CC670B4001A1121B8F6A443A643e40951`
- stateView: `0xF3334192D15450CdD385c8B70e03f9A6bD9E673b`
- quoter: `0x8Dc178eFB8111BB0973Dd9d722ebeFF267c98F94`
- quote: `0x3600000000000000000000000000000000000000`
- treasury: `0x6F98d2930fAd2AbCd06C46d23b5CaE9151D93FfB`

## Overview

PrismPad is a token launchpad on Arc mainnet (chain ID 5042). It creates non-mintable ERC20 tokens and immediately initializes USDC markets in the deployed Uniswap V4 PoolManager. Launches and wallet-signed trading are enabled.

Initial token supply is 1,000,000,000 tokens with 18 decimals. Tokens have no owner minting, transfer tax, blacklist or upgrade mechanism. Nearly the entire supply is seeded into a single-sided concentrated-liquidity position; rounding dust stays locked in the factory. No initial USDC deposit is required to create the token.

## Network and deployment

Chain ID: 5042 (0x13b2). RPC: https://rpc.mainnet.arc.io. Explorer: https://explorer.arc.io. Active factory starts at block 21238224, inclusive. Index every deployment listed in /api/integrations to retain older markets.

USDC ERC20: 0x3600000000000000000000000000000000000000, 6 decimals. Arc native gas USDC uses 18 decimals in eth_getBalance and gas calculations. Do not use native-gas decimals for ERC20 swaps.

## Discover launches

Read TokenLaunched logs emitted by the PrismPad factory, starting at the deployment block. Use token, creator and poolId from the indexed topics. The event also contains metadataHash, name, symbol, seeded and dust.

Validate each launch with factory.launches(token) and factory.poolKey(token). Use tokenForPool(poolId) for reverse lookup. tokenCount() and allTokens(index) are available for enumeration.

Initialize and ModifyLiquidity are emitted by PoolManager earlier in the same launch transaction, before TokenLaunched. Process the entire launch receipt or backfill PoolManager logs from the launch block; otherwise those initial events can be missed.

```solidity
event TokenLaunched(address indexed token, address indexed creator, bytes32 indexed poolId, bytes32 metadataHash, string name, string symbol, uint256 seeded, uint256 dust)
event Bonded(address indexed token, int24 poolTick)
event FeesCollected(address indexed token, address indexed treasury, uint256 amount0, uint256 amount1)
```

## Optional initial buy

PrismV4FactoryV3 supports launchWithBuy(name,symbol,metadataHash,userSalt,quoteAmount,minimumTokens,deadline). Enter quoteAmount in USDC base units (6 decimals). Approve that exact amount to the active factory before launch. launch() remains available without a purchase.

Pool creation and the initial purchase execute atomically. The contract sends purchased tokens to the creator and rejects output greater than 30,000,000 tokens (3% of the original 1 billion supply). This limits the optional launch purchase, not subsequent market trades or wallet holdings. A failed purchase reverts the entire launch.

Read maxInitialQuote() for the conservative USDC input limit and previewInitialBuy(amount,tokenFirst) for a fee-inclusive estimate. The frontend uses both address orderings and a 0.5% minimum-output tolerance. Standard pool/protocol fees apply; gas is separate.

TokenLaunched is emitted before the initial Swap in the same transaction, followed by InitialBuy(token,creator,quoteSpent,tokensReceived). Index swaps from the launch block and do not restrict Swap.sender to the router: the factory executes this initial trade.

```solidity
event InitialBuy(address indexed token,address indexed creator,uint256 quoteSpent,uint256 tokensReceived);
```

## Identify V4 pools

Use (chainId, PoolManager address, poolId) as the pool identity. V4 uses a singleton PoolManager; there is no per-token pool contract. The REST pool field is null for V4. Use pool_id, pool_manager and hook instead.

The pool key sorts currency0 and currency1 by numeric address. Fee is 10000 in V4 units (1%), tick spacing is 200, and hooks is the PrismPad hook address. Compute the pool ID with ABI encoding, not packed encoding.

```solidity
poolId = keccak256(abi.encode(currency0, currency1, uint24(fee), int24(tickSpacing), hooks))
fee = 10000
tickSpacing = 200
hooks = 0x0142aF02477d8452d579F9Bb54c7c81582d6C0cc
```

## Pool events and swaps

Read Initialize, ModifyLiquidity and Swap from the canonical PoolManager, filtering by the registered pool IDs. The integration manifest includes their parsed ABIs. Index all swaps for these pool IDs, including swaps submitted by other routers.

Swap amounts are signed deltas: negative is paid by the swapper and positive is received by the swapper. Determine token ordering first. A positive token delta is a buy; a negative token delta is a sell. Use abs(quote delta) / 10^6 for USDC volume and abs(token delta) / 10^18 for token quantity.

Swap.sender is typically a router, not the end user. transaction.from is only a heuristic for direct wallet transactions; relayers and smart wallets require additional attribution. Deduplicate by chainId, transactionHash and logIndex, preserve transaction/log order, and handle chain reorganizations. PrismPad’s own feed indexes finalized blocks.

```solidity
event Initialize(bytes32 indexed id,address indexed currency0,address indexed currency1,uint24 fee,int24 tickSpacing,address hooks,uint160 sqrtPriceX96,int24 tick)
event ModifyLiquidity(bytes32 indexed id,address indexed sender,int24 tickLower,int24 tickUpper,int256 liquidityDelta,bytes32 salt)
event Swap(bytes32 indexed id,address indexed sender,int128 amount0,int128 amount1,uint160 sqrtPriceX96,uint128 liquidity,int24 tick,uint24 fee)
```

## Price, liquidity and bonding

Compute the human-readable spot price from sqrtPriceX96 using exact integer or decimal arithmetic. This is the post-swap marginal pool price, not necessarily the average execution price. Average execution price is normalized USDC amount divided by normalized token amount.

The factory’s normalized token/USDC ticks are start −405400, bonding milestone −376400 and end −345400. Reverse-order pools mirror their tick range. The bonding milestone is latched by the hook and emits Bonded once. It does not migrate the pool or change the fee.

Liquidity is a direct V4 core position owned by the factory, not a PositionManager NFT. The factory exposes no withdrawal, rescue, ownership transfer or upgrade path for its initial position. The curve has a finite range; buys may run out of liquidity at the upper bound. Do not interpret a milestone as a liquidity migration.

```solidity
r = sqrtPriceX96² / 2^192
USDC per token = r × 10^12       // token is currency0
USDC per token = (1 / r) × 10^12 // token is currency1
market cap = USDC per token × current totalSupply / 10^18
```

## Hook and fee behavior

New launches use fee version 2: beforeSwap and afterSwap with return deltas (permission mask 0x00cc). Hook: 0x0142aF02477d8452d579F9Bb54c7c81582d6C0cc. Only exact-input, fully filled swaps are supported. Empty hookData is supported; there is no router allowlist. The hook also observes the bonding milestone.

The pool LP fee remains 1%. Fees earned by PrismPad's locked position are collected to 0x6F98d2930fAd2AbCd06C46d23b5CaE9151D93FfB through factory.collect(token). Other LP positions and any Uniswap protocol share affect that position's earnings. This LP fee is separate from the following protocol fee.

The hook charges 1% in USDC: on gross USDC input for buys, and on pool USDC output for sells. Fees are sequential: a 100 USDC buy allocates 1 USDC to protocol fees, then the 1% LP fee applies to the remaining 99 USDC. Combined fees are approximately 1.99%, excluding gas and price impact.

The protocol fee is split 70% to the token creator, 10% to that token's buyback reserve, and 20% to PrismPad. Creator and burn allocations round down in USDC base units; rounding dust goes to PrismPad. PoolManager ERC6909 USDC claims back the ledger. There is no fee on ordinary ERC20 transfers.

PoolManager Swap events describe pool execution, excluding the hook's additional accounting. ProtocolFeeAccrued reports the extra fee and allocation. Do not treat pool deltas alone as a user's gross wallet payment. Buyback swaps are real pool swaps and are followed by BuybackBurned and an ERC20 Transfer to zero.

## Creator claims and buybacks

The wallet menu's My tokens page filters launches by their immutable onchain creator. Fee balances are read from the hook at a finalized block, not estimated from volume. claimCreator(token) pays only the recorded creator; claimTreasury(token) pays only PrismPad. Both require the matching wallet and cannot redirect the payout.

Buyback USDC accrues automatically. The creator or treasury explicitly calls buybackAndBurn(token,amount,minimumOut,deadline) to spend the reserve through the same pool and burn the purchased tokens, reducing totalSupply. There is no reserve withdrawal. Slippage/deadline or partial-fill failures revert the entire action. Internal buybacks pay the pool LP fee but do not recursively charge the protocol fee. A reserve balance is not a completed burn.

Use rewards(token) for total protocol accrual, creator available/claimed, treasury available/claimed, burn available/spent, and tokensBurned. Fee amounts use 6 decimals; burned token amounts use 18. GET /api/tokens/{address}/fees?chainId=5042 exposes these finalized balances. GET /api/tokens?creator={wallet}&chainId=5042 supports creator-filtered pagination.

```solidity
claimCreator(address token)
claimTreasury(address token)
buybackAndBurn(address token,uint256 amount,uint256 minimumOut,uint256 deadline)
```

## Original pools and compatibility

Existing pools retain fee version 1: a 1% LP fee and an observation-only afterSwap hook (0x0040), with no creator rewards or buyback reserve. Their contracts cannot be upgraded. The deployments array in /api/integrations lists both versions, factory addresses, routers, hooks and start blocks. Index every listed factory and match each token to its own pool key and router. Never route an original token through the new factory.

New token contracts have a burn(uint256) function that only burns the caller's own balance. Initial supply is one billion; query totalSupply for current circulating supply after burns. There is still no mint authority, blacklist, token transfer tax, or principal withdrawal.

## Public API and metadata

No API key is required for these read-only GET endpoints. Examples use https://prismpad.vercel.app as the base URL. Consume them server-to-server; unrestricted browser CORS is not promised. Use the blockchain for authoritative discovery and our API to enrich token metadata.

GET /api/tokens?chainId=5042&limit=50 returns {tokens,next}. limit is 1–100. When next is present, pass both before=next.before and afterAddress=next.afterAddress, URL-encoded, with the same limit.

GET /api/tokens/{address}?chainId=5042 returns {token}. Fields include name, symbol, description, socials, image_path, supply, decimals, quote_address, quote_symbol, quote_decimals, protocol, pool_id, pool_manager, hook, launch_tx and metrics. Blank socials are omitted; descriptions may be empty and images may be null. Do not fabricate values.

GET /api/tokens/{address}/trades?chainId=5042 returns the latest 30 trades in {trades}; it is not a complete historical export. token_amount and usdc_amount are raw-unit strings; prices are decimal strings. Backfill older history from chain logs.

GET /api/tokens/{address}/candles?chainId=5042&period=24H returns {candles,period,quote,source}. Periods: 1H (60-second buckets), 6H (300), 24H (900), 7D (3600). Candles contain time, open, high, low, close and volume. Candles open at the preceding pool price; the first occupied candle uses the launch price derived from the stored initialization tick. Empty buckets are omitted, not synthetic trades.

GET /api/integrations is the machine-readable deployment manifest. GET /api/onchain describes enabled features and deployment configuration. Token metadata is offchain; metadataHash is a commitment, not a tokenURI or IPFS URL. API results can lag a launch until finality. A temporary 404 does not invalidate an onchain launch. Retry with backoff.

Uploaded image URLs can be resolved with the metadata image base URL in the manifest plus URL-encoded image_path segments. Metadata associated with a launch outside the PrismPad website may be absent. Supply, quote amounts and block numbers should be handled without floating-point integer conversion.

## ABI downloads and source

A runnable read-only discovery example is available at /integration/discover.mjs (requires Node.js and viem). Download full compiler-produced JSON ABIs for PrismV4FactoryV3, PrismV4FactoryV2, PrismV4RewardsHook, PrismV4BurnableToken and PrismV4Router (plus the original V1 contracts) from /integration/abi/{contractName}.json. PoolManager event, quoter and ERC20 read ABIs are included in /api/integrations.

The PrismPad Solidity sources are available under /integration/source/. Compiler: Solidity 0.8.26, optimizer enabled with 200 runs, viaIR enabled, EVM Cancun. Dependencies: OpenZeppelin 5.4.0, Uniswap V4 core 1.0.2, V4 periphery 1.0.3. Published source and runtime-hash checks are not a claim of explorer source verification or an independent audit.

## Routing

PrismPad’s router provides exact-input swaps for registered markets. It checks deadline, nonzero minimumOut, caller token allowance and full input consumption. It rejects partial fills. The input ERC20 allowance is for the router address. Independent V4-compatible routers can also use these pools if they support Arc and this hook.

Use the deployed V4Quoter for quotes with the complete pool key, direction, raw input quantity and hookData 0x. Obtain a fresh quote and simulate before presenting a wallet transaction. This guide describes integration and does not submit trades.

```solidity
swap(address token,bool buy,uint256 amountIn,uint256 minimumOut,address recipient,uint256 deadline,uint160 sqrtPriceLimitX96) returns(uint256 amountOut)
```

## Live integration fixture

Native atomic initial-buy verification. Initial buy, launch, trading, claims, burn and LP fee collection confirmed.

Token: 0xC78f740AE08b0C1f7D0f66D7DBD8a141E1488305

Pool ID: 0x6f03d76d9c76395091f70e25fe8cd7dce7ad86e65c2c123e0c535df6f70dbf04

Launch and initial-buy transaction: 0x54b099293e119f85f369e1faff611e87d5ae2de53cd4cf177de4e8ac550491c0

Launch block: 21238355

The current fixture is /integration/example-pool.json; previous fixtures remain at /integration/example-pool-v2.json and /integration/example-pool-v1.json.

## Integration acceptance checklist

Discover the example token from factory events; recompute and match its pool ID; recognize the appropriate hook permissions; backfill initialization and liquidity events from the launch receipt; decode the example buy; confirm 18/6 decimal normalization; resolve optional metadata; deduplicate replayed logs; index future launches automatically.

Launch and buy activity are visible onchain. The deployment manifest records native verification evidence for the active contract version. External listing is controlled by each indexer; this documentation is not confirmation of inclusion on any third-party platform.
