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

# Deposit

> Low-level instruction to deposit SY into a Senior or Junior tranche

# createDepositInstruction

Builds a raw instruction that deposits SY into the selected tranche and mints Senior or Junior LP shares.

## Usage

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

const ix = createDepositInstruction(
  {
    user: wallet.publicKey,
    market: marketAddress,
    returnModelStorage,
    addressLookupTable,
    syProgram,
    syMint,
    tokenSrc: userSyTokenAccount,
    tokenSyEscrow,
    tokenLpDst: userLpTokenAccount,
    mintLp: mintLpSenior,
    tokenProgram,
    eventAuthority,
    program: tranchingProgram,
  },
  {
    trancheSide: TrancheSide.Senior,
    amountIn: 1_000_000_000n, // raw SY units
    minLpOut: 0n,             // raw Senior LP units
  }
);
```

## Accounts

| Name                 | Type        | Signer | Writable | Description                  |
| -------------------- | ----------- | ------ | -------- | ---------------------------- |
| `user`               | `PublicKey` | Yes    | Yes      | Depositor                    |
| `market`             | `PublicKey` | No     | Yes      | Tranching market account     |
| `returnModelStorage` | `PublicKey` | No     | Yes      | Return model storage account |
| `addressLookupTable` | `PublicKey` | No     | No       | Market address lookup table  |
| `syProgram`          | `PublicKey` | No     | No       | Linked SY program            |
| `syMint`             | `PublicKey` | No     | Yes      | SY mint                      |
| `tokenSrc`           | `PublicKey` | No     | Yes      | User SY source account       |
| `tokenSyEscrow`      | `PublicKey` | No     | Yes      | Market SY escrow             |
| `tokenLpDst`         | `PublicKey` | No     | Yes      | Destination LP token account |
| `mintLp`             | `PublicKey` | No     | Yes      | Senior or Junior LP mint     |
| `tokenProgram`       | `PublicKey` | No     | No       | SPL Token program            |
| `eventAuthority`     | `PublicKey` | No     | No       | Event authority PDA          |
| `program`            | `PublicKey` | No     | No       | Exponent Tranching program   |

## Args

| Name          | Type          | Description                                                 |
| ------------- | ------------- | ----------------------------------------------------------- |
| `trancheSide` | `TrancheSide` | `Senior` or `Junior`                                        |
| `amountIn`    | `u64`         | SY amount to deposit, in raw SY token units                 |
| `minLpOut`    | `u64`         | Minimum selected-tranche LP shares to mint, in raw LP units |

## Remaining accounts

Append the market's `getSyState` and `depositSy` CPI remaining accounts after the generated keys.

## Returns

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