Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

Alpha Vault accounting is proportional: the vault buys as one account, then users receive token claims and quote refunds based on their escrow deposit share. All on-chain arithmetic uses integer token amounts. Division rounds down.

Key Terms

TermMeaning
total_depositTotal net quote amount recorded across all escrows.
escrow.total_depositNet quote amount recorded for one escrow.
max_buying_capPro Rata quote amount cap for vault fills.
max_depositing_capFCFS total accepted deposit cap.
swapped_amountTotal quote amount already used by vault fills.
bought_tokenTotal launch token bought by the vault.
claimed_tokenLaunch token already claimed by an escrow.
withdrawn_deposit_overflowPro Rata overflow quote already withdrawn by an escrow.

Max Swappable Amount

The max swappable amount is mode-dependent. Pro Rata Max Swappable=min(total_deposit,max_buying_cap)\text{Pro Rata Max Swappable} = \min(\text{total\_deposit}, \text{max\_buying\_cap}) FCFS Max Swappable=total_deposit\text{FCFS Max Swappable} = \text{total\_deposit} Each fill instruction also takes a max_amount, so the actual amount for that fill is: Fill Swappable Amount=min(Max Swappable Amountswapped_amount,max_amount)\text{Fill Swappable Amount} = \min(\text{Max Swappable Amount} - \text{swapped\_amount}, \text{max\_amount})

User Deposit Share

Most user-facing amounts use the escrow’s share of total vault deposits. User Share=escrow.total_deposittotal_deposit\text{User Share} = \frac{\text{escrow.total\_deposit}}{\text{total\_deposit}} Because this is integer math on-chain, the program multiplies before dividing and rounds down.

Linear Vesting

The program treats both endpoints as inclusive by adding 1 to the numerator and denominator. Vesting Duration=end_vesting_pointstart_vesting_point+1\text{Vesting Duration} = \text{end\_vesting\_point} - \text{start\_vesting\_point} + 1 Elapsed Duration=min(current_point,end_vesting_point)start_vesting_point+1\text{Elapsed Duration} = \min(\text{current\_point}, \text{end\_vesting\_point}) - \text{start\_vesting\_point} + 1 Total Claimable Token=bought_token×Elapsed DurationVesting Duration\text{Total Claimable Token} = \text{bought\_token} \times \frac{\text{Elapsed Duration}}{\text{Vesting Duration}} Claims are not allowed before start_vesting_point.

User Claimable Token

Escrow Dripped Token=Total Claimable Token×escrow.total_deposittotal_deposit\text{Escrow Dripped Token} = \text{Total Claimable Token} \times \frac{\text{escrow.total\_deposit}}{\text{total\_deposit}} User Claimable Token=Escrow Dripped Tokenescrow.claimed_token\text{User Claimable Token} = \text{Escrow Dripped Token} - \text{escrow.claimed\_token} After a claim, the program increments both the escrow’s claimed_token and the vault’s total_claimed_token.

Pro Rata Overflow Refund

Overflow is the part of total deposits that cannot be included in max swappable amount. Deposit Overflow=total_depositMax Swappable Amount\text{Deposit Overflow} = \text{total\_deposit} - \text{Max Swappable Amount} Escrow Overflow Refund=Deposit Overflow×escrow.total_deposittotal_deposit\text{Escrow Overflow Refund} = \text{Deposit Overflow} \times \frac{\text{escrow.total\_deposit}}{\text{total\_deposit}} An escrow can withdraw this overflow after last_join_point and through last_buying_point. The program tracks withdrawn_deposit_overflow so repeated withdrawals only receive the remaining overflow amount.

Final Remaining Quote Refund

After the pool’s last_buying_point, an escrow can withdraw its share of quote left in the vault. Remaining Quote=total_depositswapped_amount\text{Remaining Quote} = \text{total\_deposit} - \text{swapped\_amount} Escrow Total Refund Quote=Remaining Quote×escrow.total_deposittotal_deposit\text{Escrow Total Refund Quote} = \text{Remaining Quote} \times \frac{\text{escrow.total\_deposit}}{\text{total\_deposit}} Final Refund Transfer=Escrow Total Refund Quoteescrow.withdrawn_deposit_overflow\text{Final Refund Transfer} = \text{Escrow Total Refund Quote} - \text{escrow.withdrawn\_deposit\_overflow} The escrow is then marked as refunded so the final remaining quote path cannot be used twice.

FCFS Accepted Deposit

In FCFS mode, the program limits the accepted deposit amount before transfer. Remaining Vault Capacity=max_depositing_captotal_deposit\text{Remaining Vault Capacity} = \text{max\_depositing\_cap} - \text{total\_deposit} Remaining User Quota=User Capescrow.total_deposit\text{Remaining User Quota} = \text{User Cap} - \text{escrow.total\_deposit} Accepted Deposit=min(requested net amount,Remaining Vault Capacity,Remaining User Quota)\text{Accepted Deposit} = \min( \text{requested net amount}, \text{Remaining Vault Capacity}, \text{Remaining User Quota} ) If the accepted amount is 0, the deposit fails.

Token 2022 Transfer Fees

When the quote mint has a Token 2022 transfer fee, the vault records the fee-excluded amount as the deposit. It transfers the fee-included amount from the user so that the vault receives the intended net amount. Recorded Deposit=Transfer AmountTransfer Fee\text{Recorded Deposit} = \text{Transfer Amount} - \text{Transfer Fee} For outbound claims and refunds, emitted event amounts are fee-excluded when a transfer fee applies.
Formula examples describe the accounting path. Actual token balances can also be affected by Token 2022 transfer fees and transfer-memo requirements on destination accounts.