bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 68쪽
4 value:
```math theme={"system"}
\text{q\_price} = \text{quote smallest units per base smallest unit} \times 2^{64}
```
For a net quote deposit `D`, bought base units are rounded down:
```math theme={"system"}
\text{base\_bought} =
\left\lfloor
\frac{D \times 2^{64}}{\text{q\_price}}
\right\rfloor
```
When the program needs the quote amount for a base amount, quote is rounded up:
```math theme={"system"}
\text{quote\_needed} =
\left\lceil
\frac{\text{base\_amount} \times \text{q\_price}}{2^{64}}
\right\rceil
```
For each registry, total sold base token is capped by registry supply:
```math theme={"system"}
\text{registry\_sold} =
\min(\text{base\_bought\_from\_registry\_deposits},\ \text{registry\_supply})
```
The buyer's cumulative claimable amount is then based on their share of `registry_sold`, after applying the unlock schedule.
# FCFS allocation
For FCFS, each registry with at least one deposit sells its full registry supply. A buyer's cumulative allocation before vesting is:
```math theme={"system"}
\text{user\_allocation} =
\left\lfloor
\frac{\text{registry\_supply} \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
Registries with zero deposits sell zero base token, so their supply is unsold.
# Pro Rata allocation and overflow
Pro Rata uses the same registry-level allocation formula as FCFS:
```math theme={"system"}
\text{user\_allocation} =
\left\lfloor
\frac{\text{registry\_supply} \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
Overflow quote is calculated at the presale level:
```math theme={"system"}
\text{remaining\_quote} =
\max(\text{total\_deposit} - \text{presale\_maximum\_cap},\ 0)
```
Each registry receives a share of that remaining quote:
```math theme={"system"}
\text{registry\_remaining\_quote} =
\left\lfloor
\frac{\text{remaining\_quote} \times \text{registry\_total\_deposit}}
{\text{presale\_total\_deposit}}
\right\rfloor
```
Each buyer receives a share of the registry refund:
```math theme={"system"}
\text{user\_refund} =
\left\lfloor
\frac{\text{registry\_remaining\_quote} \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
Refundable deposit fee for Pro Rata overflow is calculated proportionally from the registry's collected fee:
```math theme={"system"}
\text{registry\_refund\_fee} =
\left\lfloor
\frac{\text{registry\_total\_fee} \times \text{registry\_remaining\_quote}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
```math theme={"system"}
\text{user\_refund\_fee} =
\left\lfloor
\frac{\text{user\_total\_fee} \times \text{registry\_refund\_fee}}
{\text{registry\_total\_fee}}
\right\rfloor
```
# Failed sale refund
If the sale fails, each buyer can withdraw their full remaining net deposit and deposit fee:
```math theme={"system"}
\text{failed\_sale\_refund} = \text{user\_deposit} + \text{user\_deposit\_fee}
```
The creator can withdraw the base-token supply from a failed sale.
# Creator withdrawal
After a successful sale, the creator can withdraw quote token once:
```math theme={"system"}
\text{creator\_quote\_withdrawal} =
\min(\text{total\_deposit},\ \text{presale\_maximum\_cap})
```
Deposit fees are collected through a separate instruction after completion. For Fixed Price and FCFS, the collectible fee is total deposit fee. For Pro Rata, the collectible fee excludes refundable overflow fee.
# Unlock and vesting
First, split the sold allocation into immediate and vested portions:
```math theme={"system"}
\text{immediate\_amount} =
\left\lfloor
\frac{\text{total\_sold\_token} \times \text{immediate\_release\_bps}}
{10{,}000}
\right\rfloor
```
```math theme={"system"}
\text{vested\_amount} = \text{total\_sold\_token} - \text{immediate\_amount}
```
The immediate portion is included only once the current timestamp is at or after `immediate_release_timestamp`.
The vested portion starts at:
```math theme={"system"}
\text{vesting\_start\_time} = \text{presale\_end\_time} + \text{lock\_duration}
```
and ends at:
```math theme={"system"}
\text{vesting\_end\_time} = \text{vesting\_start\_time} + \text{vest\_duration}
```
If `vest_duration` is zero, the vested portion becomes claimable at `vesting_start_time`. Otherwise it unlocks linearly:
```math theme={"system"}
\text{dripped\_vested\_amount} =
\left\lfloor
\frac{\text{vested\_amount} \times \min(\text{elapsed\_seconds},\ \text{vest\_duration})}
{\text{vest\_duration}}
\right\rfloor
```
The user's cumulative claimable token is their deposit share of the released amounts:
```math theme={"system"}
\text{user\_claimable} =
\left\lfloor
\frac{(\text{released\_immediate} + \text{dripped\_vested\_amount}) \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
The next claim is cumulative claimable minus already claimed and pending claim amounts.
# Transfer fees
If the base or quote mint is a supported Token-2022 mint with Transfer Fee enabled, transfers may require additional amount on deposit and may deliver less than the transferred amount on withdrawal or claim. Presale Vault accounts for transfer-fee-inclusive and transfer-fee-exclusive amounts when moving tokens, but allocation math is based on the net deposit tracked by the program.
# Presale Vault Token 2022 Support
Source: https://docs.meteora.ag/helper-products/presale-vault/token-2022-support
See how Presale Vault supports SPL Token and supported Token-2022 mints, transfer fees, transfer hooks, memo transfer, and token integration constraints.
Presale Vault can use standard SPL Token mints or supported Token-2022 mints for both the base token being sold and the quote token buyers deposit.
Unlike DLMM, Presale Vault does not use a token-badge review path in this program. A Token-2022 mint must use only the extensions accepted by the presale program.
## Supported Mints
Presale Vault accepts:
* standard SPL Token mints
* Token-2022 mints with only supported mint extensions
The Token-2022 native mint is rejected.
## Supported Token-2022 Extensions
If a base or quote mint is Token-2022, the program currently accepts only these mint extensions:
* `TransferFeeConfig`
* `MetadataPointer`
* `TokenMetadata`
* `TransferHook`
Any other Token-2022 mint extension fails validation with `UnsupportedToken2022MintOrExtension`.
<Warning>
Transfer hooks are supported by passing the hook accounts required by the hook program. Presale Vault does not require the transfer hook program or authority to be revoked.
</Warning>
## Transfer Fees
Presale Vault accounts for Token-2022 transfer fees when moving tokens.
### Deposits
When a buyer deposits a quote token with transfer fees, the program calculates the transfer-fee-included amount needed for the intended net deposit and registry deposit fee. The escrow and presale state track the net deposit used for allocation, while the buyer may transfer more than the net amount because of Token-2022 transfer fees.
### Claims and withdrawals
When tokens move from the presale vault to a user, the transfer amount may be reduced by the token's transfer fee. Events report transfer-fee-excluded amounts where applicable.
This affects:
* buyer withdrawals during the sale
* failed-sale quote refunds
* Pro Rata overflow quote refunds
* base-token claims
* creator withdrawals
* deposit-fee collection
* unsold base-token refunds
### 100% transfer-fee edge case
If a Token-2022 mint has a 100% transfer fee, the program uses the mint's maximum fee when calculating the inverse transfer fee needed for deposits. If that addition overflows, the instruction fails.
## Transfer Hooks
If the base or quote mint has a Transfer Hook extension, instructions that transfer that token must pass the required remaining accounts for the hook program.
The program separates hook account slices by token side:
| Accounts type | Used for |
| - | - |
| `TransferHookBase` | Base-token transfers, such as initialization funding, claims, failed creator withdrawal, and unsold base-token refunds. |
| `TransferHookQuote` | Quote-token transfers, such as deposits, buyer quote withdrawals, Pro Rata refunds, creator quote withdrawal, and fee collection. |
If a transfer hook exists and the required accounts are missing, the instruction fails. If hook accounts are supplied for a mint without a transfer hook, the instruction also fails.
## Memo Transfer
`MemoTransfer` is an account-level Token-2022 extension, not a mint extension. Presale Vault checks destination token accounts when the program transfers tokens out of the vault.
If the destination account requires incoming transfer memos, the program builds a memo with:
```text theme={"system"}
Presale
```
This applies to transfers from the presale vault to users or creator-controlled accounts. User-to-vault transfers do not include a memo context.
## Initialization Funding
At initialization, the creator funds the base-token vault with the sum of all registry supplies. If the base mint has a transfer fee, the creator may need to transfer a transfer-fee-included amount so the vault receives the intended base supply.
The same transfer-hook rules apply if the base mint uses Transfer Hook.
## Integration Checklist
* Confirm both base and quote mints are either SPL Token mints or supported Token-2022 mints.
* Reject unsupported Token-2022 extensions before showing a launch flow.
* Include transfer hook remaining accounts for every instruction that transfers a hook-enabled mint.
* Display net deposit separately from registry deposit fee and Token-2022 transfer fee.
* Explain to buyers that transfer-fee tokens may deliver less on claims or refunds.
* Ensure destination token accounts can receive memo-bearing transfers when `MemoTransfer` is enabled.
# Presale Vault Modes
Source: https://docs.meteora.ag/helper-products/presale-vault/vault-modes
Compare the Fixed Price, FCFS, and Pro Rata modes supported by Presale Vault.
Presale Vault supports three sale modes. The mode controls deposit capacity, withdrawal support, token-allocation math, and when the sale can end.
# Comparison
| Mode | Price behavior | Deposit capacity | During-sale withdrawal | Token allocation |
| - | - | - | - | - |
| Fixed Price | Creator sets a Q64.64 quote-per-base price | Cannot exceed the global maximum cap or available registry supply | Configurable | Based on fixed price, then vested |
| FCFS | Final implied price depends on deposits and supply | Cannot exceed the global maximum cap | Disabled | Registry supply is split by deposit share |
| Pro Rata | Final implied price depends on deposits and supply | Can exceed the global maximum cap, subject to buyer caps | Enabled | Registry supply is split by deposit share; overflow quote is refundable |
# Fixed Price
Fixed Price mode is for sales where buyers should know the quote-per-base price before participating.
The creator creates a fixed-price extra-params account before initializing the vault. That account stores:
* `q_price`, a Q64.64 price in quote-token smallest units per base-token smallest unit
* `disable_withdraw`, which controls whether buyers can withdraw during the ongoing sale
The program verifies that the configured price can buy at least one base-token unit for the relevant buyer caps, that the maximum cap can be fulfilled by the deposited base supply, and that the minimum and maximum caps buy different base-token amounts.
## Deposit behavior
Fixed Price deposits are capped by:
* remaining global quote capacity
* remaining personal and registry deposit capacity
* remaining base-token supply in the buyer's registry
The program may reduce a requested deposit to the largest amount that maps cleanly to purchasable base-token units. Fixed-price token amounts are rounded down in base-token units, and quote needed for those units is rounded up.
## Claim behavior
The sold amount for a registry is:
```math theme={"system"}
\min\left(\left\lfloor \frac{\text{registry\_total\_deposit} \times 2^{64}}{\text{q\_price}} \right\rfloor,\ \text{registry\_supply}\right)
```
Each buyer's claimable amount is their share of that sold amount, subject to the unlock schedule.
# FCFS
FCFS mode is for capped sales where deposits should stop once the sale reaches the maximum cap.
Deposits are capped by:
* remaining global quote capacity
* remaining personal and registry deposit capacity
FCFS does not support during-sale withdrawals. If early completion is not disabled, the program updates the presale end time to the current timestamp once total deposits reach the maximum cap.
## Claim behavior
For each registry that received deposits, the full registry supply is sold and split by deposit share:
```math theme={"system"}
\text{user\_allocation} =
\left\lfloor
\frac{\text{registry\_supply} \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
A registry with no deposits is not treated as sold, so its supply is unsold base token.
# Pro Rata
Pro Rata mode is for sales where buyers should be able to participate throughout the sale window even if demand exceeds the maximum cap.
Deposits are not capped by the global maximum cap. They are still capped by the buyer's remaining deposit quota. Pro Rata supports during-sale withdrawals.
## Claim and refund behavior
Token allocation uses the same registry-level share formula as FCFS:
```math theme={"system"}
\text{user\_allocation} =
\left\lfloor
\frac{\text{registry\_supply} \times \text{user\_deposit}}
{\text{registry\_total\_deposit}}
\right\rfloor
```
If total deposits exceed the maximum cap, the excess quote token is refundable after the sale completes. The creator can withdraw only up to `presale_maximum_cap`; buyers withdraw the remaining quote token proportionally.
Deposit fees on the refunded portion are also refundable. The creator's collectible fee in Pro Rata is the total fee minus the fee attributed to overflow quote.
<Note>
All three modes can be used with any whitelist mode. Registry and personal-cap constraints are covered in the [Configuration Guide](/helper-products/presale-vault/configuration-guide).
</Note>
# Choosing a mode
<CardGroup>
<Card title="Fixed Price" icon="tag">
Use when the sale needs an explicit price and predictable buyer communication.
</Card>
<Card title="FCFS" icon="stopwatch">
Use when the sale should be hard-capped and deposits are meant to be committed.
</Card>
<Card title="Pro Rata" icon="scale-balanced">
Use when the sale may be oversubscribed and unused quote should be refunded fairly.
</Card>
</CardGroup>
# What is Presale Vault?
Source: https://docs.meteora.ag/helper-products/presale-vault/what-is-presale-vault
Learn how Meteora's Presale Vault helps teams run standalone token presales with fixed-price, FCFS, and pro rata modes, permissioned access, registry buckets, refunds, fees, and vesting.
<Warning>
Presale Vault is still in beta and is subject to breaking changes.
</Warning>
Presale Vault is Meteora's on-chain infrastructure for teams that want to run a standalone token sale before market trading begins.
A creator deposits the token being sold into a program-owned base vault. Buyers deposit a quote token during the sale window. If the sale succeeds, buyers claim the sold token according to the selected sale mode and unlock schedule. If the sale fails, buyers can withdraw their deposited quote token and refundable fees.
<Info>
Presale Vault runs on the mainnet program `presSVxnf9UU8jMxhgSMqaRwNiT36qeBdNeTRKjTdbj`.
</Info>
## Why Presale Vault Exists
Pre-market token sales need more than a deposit address. Teams often need caps, allowlists, multiple participant tiers, predictable refund rules, vesting, and clean post-sale accounting before a token is listed on a live market.
Presale Vault brings those sale mechanics into one on-chain flow. A creator or launchpad can configure the sale terms up front, buyers participate through escrow accounts, and the program handles allocation, refunds, claims, fees, and unsold-token handling according to the configured mode.
<CardGroup>
<Card title="Standalone Fundraising" icon="coins">
Run a token sale before market trading begins, without requiring an AMM pool or automatic liquidity deployment.
</Card>
<Card title="Multiple Sale Modes" icon="shuffle">
Choose Fixed Price, FCFS, or Pro Rata depending on whether the sale needs a known price, capped urgency, or proportional allocation under oversubscription.
</Card>
<Card title="Participant Buckets" icon="users">
Use 1 to 5 registries to separate allocations, deposit fee bps, and buyer deposit ranges.
</Card>
<Card title="Permissioned Access" icon="shield-check">
Support public participation, operator-created escrows, or Merkle-proof allowlists with per-buyer registry and cap data.
</Card>
<Card title="Refund and Fee Accounting" icon="receipt">
Track net deposits and deposit fees separately, including failed-sale refunds and Pro Rata overflow refunds.
</Card>
<Card title="Unlock Control" icon="lock">
Configure immediate release, lock duration, and linear vesting for tokens bought in a successful sale.
</Card>
</CardGroup>
## How Presale Vault Works
A Presale Vault launch has two main phases.
During the **sale phase**, the creator initializes the vault, funds the base-token vault, and buyers create escrow accounts. Deposits are accepted only while the sale is ongoing. The selected mode controls whether deposits are capped at the maximum cap, whether buyers can withdraw during the sale, and how allocations are calculated.
During the **settlement phase**, the sale is either completed or failed. Completed sales allow buyer claims, creator quote withdrawal, deposit-fee collection, Pro Rata overflow refunds when applicable, and one-time unsold base-token handling. Failed sales allow buyers to withdraw their quote deposit and fee, while the creator can withdraw the unsold base supply.
| Stage | What Happens |
| - | - |
| Initialize vault | The creator sets the mode, whitelist mode, caps, timing, registries, unlock schedule, and unsold-token action. The base vault is funded with the total registry supply. |
| Create escrows | Buyers need an escrow before depositing. Permissionless escrows use registry `0`; permissioned escrows include registry and personal cap data. |
| Deposit quote | Buyers deposit net quote token plus any registry deposit fee and Token-2022 transfer fee. The program records the net amount used for allocation. |
| Sale ends | The sale completes if total net deposits meet the minimum cap. Fixed Price and FCFS can end early at the maximum cap unless disabled. |
| Settle buyers | Completed sales allow claims. Failed sales allow full remaining quote and fee refunds. Completed Pro Rata sales allow proportional overflow quote and fee refunds. |
| Settle creator | The creator can withdraw raised quote after completion, withdraw base supply after failure, and collect non-refundable deposit fees after completion. |
| Handle unsold supply | After completion, unsold base token can be returned to the creator or burned once, depending on the configured action. |
## Product Building Blocks
<CardGroup>
<Card title="Presale Vault Modes" href="/helper-products/presale-vault/vault-modes" icon="shuffle">
Compare Fixed Price, FCFS, and Pro Rata behavior around deposit capacity, withdrawals, allocation, and refunds.
</Card>
<Card title="Presale Vault Configuration Guide" href="/helper-products/presale-vault/configuration-guide" icon="gear">
Review the main setup constraints around tokens, timing, caps, registries, access, fees, vesting, and unsold-token handling.
</Card>
<Card title="Presale Vault Token 2022 Support" href="/helper-products/presale-vault/token-2022-support" icon="certificate">
See supported Token-2022 extensions, transfer-fee behavior, transfer hooks, and memo-transfer handling.
</Card>
<Card title="Presale Vault Access and States" href="/helper-products/pres프로젝트로 돌아가기