> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exponent.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Addresses and Token Accounts

> Derive Tranching market addresses, token mints, and user LP accounts

Use these helpers to derive market PDAs and user LP token accounts.

## Market addresses

```typescript theme={null}
const seedId = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);

const derived = TranchingMarket.deriveAddresses(seedId);

console.log("Market:", derived.market.toBase58());
console.log("Return model storage:", derived.returnModelStorage.toBase58());
console.log("SY escrow:", derived.tokenSyEscrow.toBase58());
console.log("Senior LP mint:", derived.mintLpSenior.toBase58());
console.log("Junior LP mint:", derived.mintLpJunior.toBase58());
```

| Field                | Description                                 |
| -------------------- | ------------------------------------------- |
| `market`             | Main `ExponentTranchingMarket` PDA          |
| `returnModelStorage` | PDA account storing the active return model |
| `tokenSyEscrow`      | Market-owned SY escrow                      |
| `mintLpSenior`       | Senior LP token mint                        |
| `mintLpJunior`       | Junior LP token mint                        |

## Loaded market addresses

```typescript theme={null}
console.log("SY mint:", market.syMint.toBase58());
console.log("SY program:", market.syProgram.toBase58());
console.log("Senior LP mint:", market.mintLpSenior.toBase58());
console.log("Junior LP mint:", market.mintLpJunior.toBase58());
console.log("SY escrow:", market.tokenSyEscrow.toBase58());
console.log("Base mint:", market.mintBase.toBase58());
```

| Getter                  | Returns     | Description                                             |
| ----------------------- | ----------- | ------------------------------------------------------- |
| `syMint`                | `PublicKey` | SY token mint backing the market                        |
| `syProgram`             | `PublicKey` | Linked SY program                                       |
| `mintLpSenior`          | `PublicKey` | Senior LP mint                                          |
| `mintLpJunior`          | `PublicKey` | Junior LP mint                                          |
| `tokenSyEscrow`         | `PublicKey` | Market SY escrow                                        |
| `mintBase`              | `PublicKey` | Underlying base asset mint exposed by the market flavor |
| `currentSyExchangeRate` | `number`    | Current exchange rate from the loaded SY flavor         |

## User LP accounts

```typescript theme={null}
import { TrancheSide } from "@exponent-labs/exponent-sdk/client/tranching";

const seniorLpAta = market.lpAta(TrancheSide.Senior, wallet.publicKey);
const juniorLpAta = market.lpAta(TrancheSide.Junior, wallet.publicKey);

console.log("Senior LP ATA:", seniorLpAta.toBase58());
console.log("Junior LP ATA:", juniorLpAta.toBase58());
```

| Function                    | Description                                                           |
| --------------------------- | --------------------------------------------------------------------- |
| `lpMint(trancheSide)`       | Returns the LP mint for `Senior` or `Junior`                          |
| `lpAta(trancheSide, owner)` | Returns the owner's associated token account for the selected LP mint |

<Tip>
  The wrapper deposit and withdraw methods create these associated token accounts idempotently through `setupIxs`.
</Tip>
