Constants
Deposit fee bps are capped at5,000. Immediate release bps are capped at 10,000.
Sale success
A sale is completed when the current timestamp is at or afterpresale_end_time and total net deposits meet the minimum cap:
If total deposits are below the minimum cap after the sale ends, the sale is failed.
Deposit fee
The deposit amount tracked for allocation excludes the deposit fee. If a buyer deposits a net amountD into a registry with fee rate f bps, the gross amount required before Token-2022 transfer fees is rounded up:
The fee is tracked separately on the escrow, registry, and presale. In Pro Rata, the fee attributable to refunded overflow quote is refundable.
Fixed Price
Fixed Price mode storesq_price as a Q64.64 value:
For a net quote deposit D, bought base units are rounded down:
When the program needs the quote amount for a base amount, quote is rounded up:
For each registry, total sold base token is capped by 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: 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: Overflow quote is calculated at the presale level: Each registry receives a share of that remaining quote: Each buyer receives a share of the registry refund: Refundable deposit fee for Pro Rata overflow is calculated proportionally from the registry’s collected fee:Failed sale refund
If the sale fails, each buyer can withdraw their full remaining net deposit and 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: 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: The immediate portion is included only once the current timestamp is at or afterimmediate_release_timestamp.
The vested portion starts at:
and ends at:
If vest_duration is zero, the vested portion becomes claimable at vesting_start_time. Otherwise it unlocks linearly:
The user’s cumulative claimable token is their deposit share of the released amounts:
The next claim is cumulative claimable minus already claimed and pending claim amounts.

