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

# Lend Referral Overview

> Offer Jupiter Lend Earn yield under your own token and earn a fee on your users' yield.

Lend Referral lets an app or wallet offer Jupiter Lend Earn yield under its own token, and take a fee on the yield its users earn. Jupiter creates a **wrapper** for you over one Earn market. Your users deposit the market's underlying token, such as USDC, or its jlToken, and receive your **xToken** in return. The wrapper charges your **partner fee** on the yield and pays it to you, minus Jupiter's share.

This section is for two readers: the **partner** who owns a wrapper, and the front end that moves user funds through it. It assumes you know [Jupiter Lend Earn](https://developers.jup.ag/docs/lend/earn.md) and jlTokens.

The Lend Referral program address is `LrefWFcNXGnLxnQUdKmuJ1U3fUrFBdNkm6xCfVfWwQW`. Guardian and Cantina audited the program: see the [audit reports](https://developers.jup.ag/docs/resources/audits.md#jupiter-lend-referral). Lend Referral is a separate product from the [Jupiter Referral Program](https://developers.jup.ag/docs/tool-kits/referral-program.md), which earns integrator fees on trades.

## How a wrapper works

A wrapper holds jlTokens for its users in a vault, one vault per wrapper. A deposit in the underlying token goes through the Earn market first, and the wrapper keeps the jlTokens Earn mints. A deposit in jlTokens goes straight to the vault. Either way, the user receives xTokens.

The vault's jlTokens are split into three balances: the users', the partner's, and Jupiter's. The jlTokens earn Earn yield. At each **accrue**, the wrapper takes the partner fee out of the yield on the users' balance and moves it to the two fee balances. An accrue runs at the start of every deposit, withdrawal and claim, and anyone can trigger one. You claim your balance to your fee recipient. Jupiter claims its own.

```mermaid theme={null}
flowchart TB
  User["User (receives xTokens)"]
  Earn["Jupiter Lend Earn market"]
  subgraph Vault["Wrapper vault (jlTokens)"]
    Users["Users' balance"]
    Partner["Partner's balance"]
    Jup["Jupiter's balance"]
  end
  Recipient["Your fee recipient (jlToken account)"]
  Protocol["Jupiter"]

  User -- "deposits the underlying token" --> Earn
  Earn -- "mints jlTokens" --> Users
  User -- "or deposits jlTokens" --> Users
  Users -- "accrue: partner fee minus protocol share" --> Partner
  Users -- "accrue: protocol share" --> Jup
  Partner -- "partner claim" --> Recipient
  Jup -- "Jupiter's claim" --> Protocol
```

What this means for your users:

* **The xToken balance stays the same.** Yield shows up as a rising xToken value in jlTokens, net of the partner fee.
* **The xToken is a plain token.** It has the jlToken's decimals and the market's token program (Token or Token-2022). The wrapper is its mint authority, and it has no freeze authority.
* **Exits stay open.** A user can redeem xTokens for the underlying token or for jlTokens. If the underlying path is blocked, the jlToken exit still works. See [Exit in edge cases](https://developers.jup.ag/docs/lend/referral/deposits-and-withdrawals.md#exit-in-edge-cases).

You get one wrapper per market. Several partners can wrap the same market, and each wrapper has its own xToken and vault, so code identifies a wrapper by its xToken mint. For how the fee is charged and split, see [Fees and Yield](https://developers.jup.ag/docs/lend/referral/fees.md).

## Roles

| Role | Who | Can do |
| - | - | - |
| Jupiter | The protocol authority | Create wrappers. Set the protocol share, for all wrappers or for one. Pause and unpause the whole protocol. Claim the protocol share. |
| Wrapper authority | Jupiter at creation, then your admin address | Change the partner fee, the fee recipient and the claim authority. Rename the xToken. Transfer the wrapper authority. |
| Claim authority | Optional address you choose | Trigger partner claims. When it is set, only the claim authority, the wrapper authority, or the owner of the fee recipient account can trigger a claim. |
| Fee recipient | A jlToken token account you choose | Receives partner fees. |
| Users | Anyone | Deposit, redeem and withdraw. |
| Anyone | Any wallet | Call `accrue`. Trigger a partner claim when no claim authority is set. |

A claim always pays the stored fee recipient, whoever triggers it. That is why claims are open to anyone by default.

After Jupiter transfers the wrapper authority to you, Jupiter cannot change your partner fee, fee recipient, claim authority or xToken metadata. Jupiter keeps two controls over your wrapper: the protocol share, and the global pause. A pause blocks every deposit, redeem and withdrawal, `accrue`, and claims, for as long as it lasts.

## Get a wrapper

Jupiter creates every wrapper.

### What you send Jupiter

| Item | Constraints |
| - | - |
| Market | One wrapper per Earn market, identified by the underlying mint. List each market you want. |
| Partner fee | 0 to 1000 bps, which is 0% to 10% of your users' yield. Jupiter's protocol share comes out of this fee, not on top of it. |
| Fee recipient | A wallet or multisig: Jupiter creates its jlToken associated token account if it is missing. Or an existing jlToken token account under the market's token program. The program rejects an account for another mint and the wrapper's own vault. |
| Wrapper admin address | Receives the wrapper authority. Use a multisig. Confirm this address with Jupiter out of band, for example with a signed message. |
| xToken name | At most 32 bytes. |
| xToken symbol | At most 10 bytes. |
| Metadata URI | Points to the Metaplex JSON (name, symbol, description, image). You host it, or Jupiter hosts it for you. At most 200 bytes. |
| Claim policy | Anyone can trigger claims (the default), or only a claim authority you name. You can change it later. |

### What Jupiter does

Jupiter seeds the wrapper with a small amount of jlTokens that stay locked in the vault permanently. The seed makes share-price manipulation on a new wrapper expensive (see [Share price and the seed](https://developers.jup.ag/docs/lend/referral/fees.md#share-price-and-the-seed)). Jupiter then creates the xToken mint, the wrapper config and the vault, and writes the xToken metadata. It sets a claim authority if you asked for one, and transfers the wrapper authority to your admin address.

```mermaid theme={null}
sequenceDiagram
  participant Partner
  participant Jupiter
  participant Program as Lend Referral program
  Partner->>Jupiter: Wrapper details
  Partner->>Jupiter: Confirm the admin address
  Jupiter->>Program: Create the wrapper, lock the seed
  opt Claim authority requested
    Jupiter->>Program: Set the claim authority
  end
  Jupiter->>Program: Transfer the wrapper authority
  Jupiter-->>Partner: Wrapper addresses
```

> [!WARNING]
>
> The wrapper authority transfer is one step and Jupiter cannot undo it. If it goes to a wrong address, you lose control of the wrapper permanently. Check the admin address before you send it.

### What you get back

* The **xToken mint** address. Your code passes it to the SDK to find your wrapper.
* The **wrapper config** address: the program PDA `["wrapper_config", xTokenMint]`.
* The market's **jlToken mint** and **Lending account**, the Earn market's on-chain account.
* The **vault** address: the wrapper config's associated token account for the jlToken mint.
* The **fee recipient** as stored on the wrapper.

## Integrate

> [card] [Fees and Yield](https://developers.jup.ag/docs/lend/referral/fees.md)
>
> How the partner fee is charged, split and claimed, and what fee your users pay in practice.

> [card] [SDK Quick Start](https://developers.jup.ag/docs/lend/referral/sdk.md)
>
> Install the SDK, read a wrapper, and send your first deposit.

> [card] [Deposit and Withdraw](https://developers.jup.ag/docs/lend/referral/deposits-and-withdrawals.md)
>
> Move user funds in and out of a wrapper, with slippage bounds and edge cases.

> [card] [Manage Your Wrapper](https://developers.jup.ag/docs/lend/referral/manage-wrapper.md)
>
> Read your earnings, claim fees, and change your wrapper's settings.

> [card] [Reference](https://developers.jup.ag/docs/lend/referral/reference.md)
>
> Addresses, accounts, fields, limits, instructions, errors and events.


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