> ## 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.

# Initialize Tranching Market

> Low-level instruction to create and initialize a tranching market

# createInitializeTranchingMarketInstruction

Builds a raw instruction that initializes the market account, return model storage account, SY escrow, and Senior/Junior LP mints.

## Usage

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

const seedId = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
const derived = TranchingMarket.deriveAddresses(seedId);

const ix = createInitializeTranchingMarketInstruction(
  {
    payer: wallet.publicKey,
    adminSigner: admin.publicKey,
    market: derived.market,
    returnModelStorage: derived.returnModelStorage,
    addressLookupTable,
    syProgram,
    syMint,
    tokenSyEscrow: derived.tokenSyEscrow,
    mintLpSenior: derived.mintLpSenior,
    mintLpJunior: derived.mintLpJunior,
    tokenProgram,
    systemProgram,
    admin: adminState,
  },
  {
    roles: { admin: [admin.publicKey], sentinel: [] },
    riskConfig,
    protocolFeeConfig,
    returnModel,
    syCpiAccounts,
    maxSeniorLpSupply: 0n,
    maxJuniorLpSupply: 0n,
    seedId,
  }
);
```

## Accounts

| Name                 | Type        | Signer | Writable | Description                                     |
| -------------------- | ----------- | ------ | -------- | ----------------------------------------------- |
| `payer`              | `PublicKey` | Yes    | Yes      | Rent and transaction payer                      |
| `adminSigner`        | `PublicKey` | Yes    | No       | Admin signer authorized by Exponent admin state |
| `market`             | `PublicKey` | No     | Yes      | Market PDA                                      |
| `returnModelStorage` | `PublicKey` | No     | Yes      | Return model storage PDA                        |
| `addressLookupTable` | `PublicKey` | No     | No       | ALT used by market CPI account indexes          |
| `syProgram`          | `PublicKey` | No     | No       | Linked SY program                               |
| `syMint`             | `PublicKey` | No     | No       | SY mint                                         |
| `tokenSyEscrow`      | `PublicKey` | No     | Yes      | Market SY escrow PDA                            |
| `mintLpSenior`       | `PublicKey` | No     | Yes      | Senior LP mint PDA                              |
| `mintLpJunior`       | `PublicKey` | No     | Yes      | Junior LP mint PDA                              |
| `tokenProgram`       | `PublicKey` | No     | No       | SPL Token program                               |
| `systemProgram`      | `PublicKey` | No     | No       | System program                                  |
| `admin`              | `PublicKey` | No     | No       | Exponent admin state                            |

## Args

| Name                | Type                         | Description                                                       |
| ------------------- | ---------------------------- | ----------------------------------------------------------------- |
| `roles`             | `TranchingMarketRoles`       | Admin and sentinel role lists                                     |
| `riskConfig`        | `TranchingRiskConfig`        | Coverage, recovery, liquidation, and minimum amount parameters    |
| `protocolFeeConfig` | `TranchingProtocolFeeConfig` | Fee recipient and fee rates                                       |
| `returnModel`       | `TrancheReturnModelUpdate`   | Initial return allocation model                                   |
| `syCpiAccounts`     | `CpiAccounts`                | ALT indexes for SY CPI account groups                             |
| `maxSeniorLpSupply` | `u64`                        | Optional Senior LP supply cap. `0` means uncapped except coverage |
| `maxJuniorLpSupply` | `u64`                        | Optional Junior LP supply cap. `0` means uncapped                 |
| `seedId`            | `[u8; 8]`                    | Market seed ID                                                    |

## Returns

`TransactionInstruction` - a transaction instruction ready to be added to a transaction.
