# Partner Referral Program

### Overview

When users trade through a partner's front-end, trading interface, or integration, the partner earns a percentage rebate on the trading fees generated. This creates a sustainable incentive for developers and businesses to build on Flash and drive volume to the protocol.

Builder codes are assigned to partner accounts and tracked on-chain via the `token_stake` account. Each trade executed through a partner's builder code automatically calculates and attributes the appropriate rebate.

### How It Works

Every trade on Flash generates fees. When a trade is routed through a partner's builder code, the protocol calculates a rebate based on the partner's tier and credits it accordingly. The rebate rate is stored directly in the partner's `token_stake` account, ensuring consistent and efficient processing at execution time.

The system handles all order types including market, limit, and trigger orders. Anti-spoofing protections are built in to ensure rebates are only attributed to the legitimate referring partner.

### Rebate Tiers

Partners earn rebates based on their staking level. Higher tiers require staking more FAF tokens in the `token_stake` account.

| Tier             | Staking Requirement    | Rebate Rate |
| ---------------- | ---------------------- | ----------- |
| 1                | 20,000 FAF             | 2.5%        |
| 2                | 40,000 FAF             | 3%          |
| 3                | 100,000 FAF            | 4%          |
| 4                | 200,000 FAF            | 5.5%        |
| 5                | 1,000,000 FAF          | 7.5%        |
| 6 (Builder Code) | Assigned by Flash team | 10%         |

Builder code accounts receive a higher rebate rate than standard referral tiers, reflecting the value that integrated partners bring to the protocol.

{% hint style="warning" %} If a referred user stakes above 40,000 FAF, referral rewards for that user will be disabled. {% endhint %}

### 24-Hour Rebate Limits

To maintain sustainability and prevent abuse, rebates are subject to a rolling 24-hour cap. These limits differ based on account type:

| Account Type               | 24-Hour Rebate Cap       |
| -------------------------- | ------------------------ |
| Standard Referral Accounts | 1,000 USD                |
| Builder Code Accounts      | Custom (set per partner) |

Once the cap is reached within a 24-hour window, additional trades will still execute normally but will not generate further rebate credits until the window resets.

### Rebate Distribution

Rebates are recorded in the partner's `token_stake` account as `claimable_rebate_usd` on every qualifying transaction. Every 12 hours, accrued rebates are settled from the pool into a separate `rebate_vault`. Partners can then collect their rebates from the vault at any time.

Rebates are denominated in USD.

### Getting Started

1. **Reach out to the Flash team** to request a builder code.
2. **Receive your builder code** — the team will assign it and configure your rebate tier manually.
3. **Integrate the builder code** into your trading interface by passing it as a parameter when constructing trade instructions.
4. **Begin earning rebates** on qualifying trades routed through your code.

### Integration Guide

Partners integrate their builder code by passing it as a parameter when constructing trade instructions. The protocol validates the builder code on-chain and automatically handles rebate attribution.

For detailed SDK usage, refer to the Flash Rust SDK documentation and the `perpetuals_client.rs` reference.

### FAQ

**Who is eligible for the Partner Referral Program?** Any partner app, trading interface, or integrator building on Flash. To receive a builder code, reach out to the Flash team directly.

**How is my rebate tier determined?** Standard referral tiers are based on the amount of FAF staked in your `token_stake` account. Builder code accounts are assigned a custom tier by the Flash team.

**Can I upgrade my tier?** Yes — stake more FAF to move up through the standard tiers. To apply for a builder code with a custom rate, contact the Flash team.

**When do I receive my rebates?** Rebates accrue per trade and are settled into the `rebate_vault` every 12 hours. You can collect from the vault at any time after settlement.
