> ## Documentation Index
> Fetch the complete documentation index at: https://pons-labs-llc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Reading a launch

> The two v3 launch records, the v2 fields that no longer apply, unswept fees, and reading the buyback vest.

A launch has two records. The factory's is keyed by token address and holds the
settings the launch was created with. The hook's is keyed by pool id and holds
the settings fees are paid out under.

```text The hook's launch record theme={null}
launches(poolId) decodes as a flat 13-value tuple:

  0  bool    registered               7  uint16  protocolFeeShareBps
  1  bool    memecoinIsCurrency0      8  uint16  buybackBurnBps
  2  address memecoin                 9  uint16  hookFeeBps
  3  address quoteToken              10  uint16  maxInternalPriceImpactBps
  4  address creator                 11  bool    buybackEnabled
  5  address buybackCreatorRecipient 12  uint64  buybackVestingSeconds
  6  uint16  creatorTaxBps

In v2 this had 14 fields, with protocolFeeRecipient at index 6.
```

> [!WARNING]
>
> The hook's launch record has one field fewer than on v2. `protocolFeeRecipient`
> was at index 6 on v2 and has been removed, since the protocol's share now goes to
> the hook's current recipient. Every field after it is now one index lower.
> Decoding the record with the v2 ABI fails because it is one field shorter, but
> code that reads fields by position with the v2 indexes gets the wrong value for
> every field from index 6 on, without reverting.

`creator` is the launch's current creator fee recipient, the address fees are
paid to. It starts as the fee recipient set at launch, or the launching wallet if
none was set, and changes when the recipient is transferred or replaced by Pons.
`buybackCreatorRecipient` is the vest recipient recorded at launch and never
changes, so don't use it to find the current vest recipient. The vest goes to the
same address as `creator`. The vault's `vestingTerms(token)` also returns it, but
only once a vest has started or the recipient has changed. Before that it returns
the zero address.

## Unused v2 fields

`getLaunchedToken` on the factory still returns the v2 struct, so some of its
fields don't mean anything on v3. They still have values, so it's easy to branch
on them by mistake.

| Field | On v3 |
| - | - |
| `curve` | Always the zero address, since there's no curve contract. |
| `graduationThreshold`, `sweptQuote`, `sweptTokens` | Always zero. |
| `phase` | Always `PoolCreated`, since a launch only has one state. |
| `sweptAt` | The launch time, not a sweep time. The owner's delay for changing the fee recipient counts from this. |

## Unswept fees

```ts Pending balances theme={null}
// Pre-sweep balances, always keyed by the launch's quote asset.
// For a native launch that key is the zero address.
const hookAbi = parseAbi([
  "function pendingFees(bytes32 poolId, address currency) view returns (uint256)",
  "function pendingCreatorTax(bytes32 poolId, address currency) view returns (uint256)",
  "function pendingBuyback(bytes32 poolId, address currency) view returns (uint256)",
  "function launches(bytes32 poolId) view returns (bool registered, bool memecoinIsCurrency0, address memecoin, address quoteToken, address creator, address buybackCreatorRecipient, uint16 creatorTaxBps, uint16 protocolFeeShareBps, uint16 buybackBurnBps, uint16 hookFeeBps, uint16 maxInternalPriceImpactBps, bool buybackEnabled, uint64 buybackVestingSeconds)",
]);

// launches returns its 13 values as an array, in the order shown above.
const [, , , quoteToken] = await client.readContract({
  address: memeHook,
  abi: hookAbi,
  functionName: "launches",
  args: [poolId],
});

// Fees only build up in the quote asset, so there's no token-side balance.
const pending = await client.readContract({
  address: memeHook,
  abi: hookAbi,
  functionName: "pendingFees",
  args: [poolId, quoteToken],
});
```

These are balances before a sweep. What a recipient can actually withdraw is in
the escrow, and the two numbers won't match. Show them separately.

## Reading the vest

```ts Vault reads theme={null}
const vaultAbi = parseAbi([
  "struct VestTranche { uint128 amount; uint64 openedAt; uint64 maturesAt; }",
  "function releasable(address token) view returns (uint256)",
  "function vestedAmount(address token) view returns (uint256)",
  "function vestSchedule(address token) view returns (VestTranche[])",
  "function totalLocked(address token) view returns (uint256)",
  "function totalReleased(address token) view returns (uint256)",
  "function vestingDuration(address token) view returns (uint64)",
  "function release(address token)",
  "function releaseMatured(address token)",
  "function releaseBurnCreator(address token) returns (uint256 released, uint256 burned)",
]);

const [locked, released, vested, releasable, schedule] = await Promise.all(
  (["totalLocked", "totalReleased", "vestedAmount", "releasable", "vestSchedule"] as const)
    .map((functionName) =>
      client.readContract({
        address: buybackVault,
        abi: vaultAbi,
        functionName,
        args: [token],
      }),
    ),
);

// Tranches mature on their own schedules, so base progress on the vested
// amount rather than a start and end date.
const progress = Number(vested) / Number(locked);
```

`vestingStart` returns a weighted average start time. It's only for display and
can't be used to work out the vested amount, since each tranche has its own
schedule. For any number a user will rely on, use the vested and releasable
amounts, or the schedule itself.

Releasing reverts while a buyback swap for that token is running. The check is
set and cleared inside the sweep transaction, so a normal caller never hits it.
You'd only hit it if your contract gets called back during a sweep and tries to
release from that callback. Release in a separate transaction instead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.