What Are Migration Pools?

Migration pools are standalone token conversion facilities on Solana. They let projects swap users from an old token to a new one — or raise SOL for a new launch — with configurable rules around timing, caps, vesting, and referral incentives.

Unlike a regular AMM swap (which prices dynamically), migration pools have fixed conversion rules set by the pool creator. The authority deposits new tokens into a vault, users send old tokens in, and get new tokens out at the configured rate. Each pool is a 512-byte PDA on-chain. No off-chain servers, no centralized custody.

CREATE → DEPOSIT → [START_TIME] → ACTIVE → [END_TIME] → CLOSE | | | | | | | | | | | +-- Authority reclaims remaining tokens | | | | +-- No more swaps accepted | | | +-- Users swap old → new (+ referrals, vesting, caps) | | +-- Swaps begin (before this: ERR_MIG) | +-- Authority deposits new tokens into vault +-- Authority creates pool with type, flags, params, time window

Why Not Just Use a DEX?

FeatureDEX / AMMMigration Pool
PriceDynamic (supply/demand)Fixed (authority-set rate)
SlippageYesNo (rate is constant)
LiquidityBoth sides depositedOnly new tokens deposited
DurationPermanentTime-bounded (start → end)
DirectionBidirectionalOne-way (old → new)
VestingNoOptional (Types 3, 10, 11)
CapsNoOptional (Types 7, 9)
Access ControlOpen to allOptional whitelist (Type 8)
ReferralsNoBuilt-in multi-level system
Old TokenStays in poolStored in vault OR burned

The 13 Migration Types

Type 0 — Simple 1:1

Beginner

Send 1 old token, get 1 new token. Token rebrands, contract upgrades, mint rotations.

Type 1 — Fixed Ratio

Beginner

Convert at a fixed ratio (e.g., 10 old = 1 new). Handles decimal differences. Token consolidation.

Type 2 — Ratio + Fee

Beginner

Fixed ratio with an authority fee deducted from output. Revenue-generating migrations.

Type 3 — Vesting

Intermediate

New tokens unlock gradually over time with periodic claims. Prevents post-migration dumps.

Type 4 — Time-Decay Bonus

Intermediate

Early birds get a bonus that shrinks over time. Creates FOMO and rewards early adopters.

Type 5 — Burn-and-Mint

Intermediate

Old tokens permanently destroyed via CPI burn. Irreversible. Deflationary upgrades.

Type 6 — Multi-Token Merge

Advanced

Merge multiple old tokens into one new token. Separate pools per old token, each with own ratio.

Type 7 — Capped (FCFS)

Intermediate

Global cap on total distributed. First-come, first-served. Partial fills at the cap boundary.

Type 8 — Gated (Whitelist)

Intermediate

Authority must co-sign every swap. Only pre-approved wallets can migrate. Real-time gating.

Type 9 — Per-Wallet Cap

Beginner

Each wallet has a cumulative limit. Anti-whale fairness mechanism for fair distribution.

Type 10 — Vest + Bonus

Advanced

Time-decay bonus combined with gradual vesting. Rush for bonus, then tokens unlock over time.

Type 11 — Burn + Vest

Advanced

Old tokens burned immediately, new tokens vest gradually. Strongest commitment mechanism.

Type 12 — SOL-for-Token

Intermediate

Send SOL (not SPL tokens) to buy new tokens at a fixed rate. Direct lamport-to-token sale.

Accessing the Migration Panel

The TUI (aex tui) is a read-only dashboard — it shows live pool data, progress bars, referral configs, and stats. All actual operations go through CLI commands.

$ aex tui          ← Launch TUI
Press [8]          ← DeFi composite panel
Press [i]          ← Migration sub-tab
[j/k]              ← Navigate up/down
[Enter]            ← View pool details
[d]                ← Deposit hint
[p]                ← Pause/Unpause hint
[x]                ← Close hint
[b] or [Esc]       ← Back to list

Quick Reference — Commands by Type

TypeSwap CommandAfter SwapKey Flag
0 (1:1)aex migrate swap <pool> <amt>Nothing
1 (Ratio)aex migrate swap <pool> <amt>Nothing
2 (Ratio+Fee)aex migrate swap <pool> <amt>Nothing
3 (Vest)aex migrate swap <pool> <amt>claim periodicallyVEST
4 (Decay)aex migrate swap <pool> <amt> --min-outNothingDECAY
5 (Burn)aex migrate swap <pool> <amt>NothingBURN
6 (Merge)aex migrate swap <pool> <amt> (per pool)Nothing
7 (Capped)aex migrate swap <pool> <amt> --min-outNothing
8 (Gated)Requires authority co-signNothingGATED
9 (WlCap)aex migrate swap <pool> <amt>NothingWLCAP
10 (Vest+Bonus)aex migrate swap <pool> <amt>claim periodicallyVEST+DECAY
11 (Burn+Vest)aex migrate swap <pool> <amt>claim periodicallyBURN+VEST
12 (SOL)aex migrate swap <pool> <lamports>NothingSOL
Add --referrer <pubkey> to any swap command for referral rewards.

Step-by-Step Tutorials

Tutorial 1: Simple 1:1 Migration

BeginnerType 0

Swap old tokens for new tokens at a 1:1 rate. The simplest migration — send 1000 old, get 1000 new. No vesting, no bonus, no catches.

When You'll See This

Token rebrands (ALPHA → OMEGA), contract upgrades, mint rotations after security incidents.

Step 1 — Find the Pool in TUI

$ aex tui
[8] → DeFi panel
[i] → Migration sub-tab
[j/k] → Navigate to your pool
[Enter] → View details
Note the pool address — you'll need it for the CLI command. Check that Status is ACTIVE and Remaining balance > 0.

Step 2 — Check Your Token Balance

$ aex balance --keypair wallet.json

Step 3 — Execute the Migration

Amounts are in raw units (including decimals). For 6 decimals: 1,000 tokens = 1,000,000,000 raw.

$ aex migrate swap 7xKq...3nPd 5000000000 --keypair wallet.json

Migration swap submitted!
  Pool: 7xKq...3nPd
  Sent: 5,000.000000 ALPHA
  Received: 5,000.000000 OMEGA
  TX: 5Uxj...7kPm

Step 4 — Verify in TUI

Go back to the TUI (auto-refreshes every 5 seconds). Confirm your migration was counted in the stats.

Adding a Referral

$ aex migrate swap 7xKq...3nPd 5000000000 --referrer <referrer_pubkey> --keypair wallet.json

You get the same 5,000 OMEGA. The referrer gets a bonus from the vault (e.g., 250 OMEGA at 5% referral rate).

Common Errors

ErrorCauseFix
ERR_PAUSED (6000)Pool is pausedWait for authority to unpause
ERR_MIG (6031)Pool ended or not startedCheck time window in TUI
ERR_ZERO (6003)Amount too smallIncrease swap amount
SPL transfer failedVault emptyAuthority needs to deposit more

Tutorial 2: Fixed Ratio Migration

BeginnerType 1

Convert old tokens at a fixed ratio (e.g., 10 old = 1 new). The ratio is set in the pool's param0 (numerator) and param1 (denominator) fields.

How the Ratio Works

output = input_amount * param0 / param1

Example: param0=1, param1=10
  Send 10,000 old → get 1,000 new (10:1 consolidation)

Swap Command

$ aex migrate swap <pool> <amount_raw> --keypair wallet.json
The TUI detail view shows the ratio. Always check before swapping — the output may differ from 1:1.

Common Uses

Token consolidation (reduce circulating supply), decimal changes (e.g., 9 decimals → 6 decimals), cross-chain parity adjustments.

Tutorial 3: Ratio + Fee

BeginnerType 2

Fixed ratio conversion with an authority fee deducted from the output. The fee (in param2 as bps) lets the authority earn revenue from the migration.

Calculation

gross_output = input * param0 / param1
fee = gross_output * param2 / 10000
net_output = gross_output - fee

Example: ratio 1:1, fee 200 bps (2%)
  Send 1,000 → gross 1,000 → fee 20 → receive 980

Swap Command

$ aex migrate swap <pool> <amount> --keypair wallet.json
Use --min-out to protect against unexpected fee levels.

Tutorial 4: Vesting Migration

IntermediateType 3

Swap old tokens for new tokens, but the new tokens are locked and unlock gradually over time. You come back periodically to claim unlocked portions.

When You'll See This

Projects preventing post-migration dumps, loyalty rewards, token launches with gradual distribution.

Step 1 — Check Vesting Schedule in TUI

Type: 3 (Vesting)
Flags: VEST
Vest Duration: 2592000s (30 days)
Claim Interval: 604800s (7 days)
Ratio: 1:1

Tokens vest over 30 days. Claim once per week. Each claim: ~23.3% of total.

Step 2 — Execute the Initial Swap

$ aex migrate swap <pool> 10000000000000 --keypair wallet.json

This creates a MigrationClaimPDA linked to your wallet. You're entitled to 10,000 new tokens, but they're locked.

Step 3 — Claim Unlocked Tokens (Weekly)

$ aex migrate claim <pool> --keypair wallet.json

Vesting claim submitted!
  Entitled: 10,000.000000 V2
  Already claimed: 0.000000
  Now claimable: 2,333.333333 V2

Vesting Math

elapsed = min(now - first_deposit, vest_duration)
intervals_passed = floor(elapsed / claim_interval)
total_intervals = vest_duration / claim_interval
unlocked = total_entitled * intervals_passed / total_intervals
claimable = unlocked - already_claimed
Tokens unlock in discrete steps, not continuously. Day 6.9 = nothing. Day 7.0 = full chunk.

Automating Claims

# crontab -e
0 12 * * 1 /path/to/aex migrate claim <pool> --keypair /path/to/wallet.json

Tutorial 5: Time-Decay Bonus

IntermediateType 4

Early migrants get a bonus that shrinks over time. The bonus starts at param2 bps and linearly decays to 0 by the pool's end time.

Calculation

remaining = end_time - now
total_window = end_time - start_time
bonus_pct = param2 * remaining / total_window
output = input * (10000 + bonus_pct) / 10000

Day 1 of 30-day pool (bonus=2000 bps):
  bonus = 2000 * 29/30 = 1933 bps (19.33%)
  Send 1,000 → receive 1,193

Day 29:
  bonus = 2000 * 1/30 = 66 bps (0.66%)
  Send 1,000 → receive 1,006
Always use --min-out to lock in your expected bonus rate. The rate changes every second.

Tutorial 6: Burn-and-Mint

IntermediateType 5

Old tokens are permanently destroyed via CPI burn. The program calls the SPL Token burn instruction directly. This is irreversible — there is no old_vault to reclaim from.

How It Differs

Normal migration: old tokens go into old_vault (authority can reclaim later). Burn migration: old tokens are burned on the spot. Total old supply decreases permanently.

Swap Command

$ aex migrate swap <pool> <amount> --keypair wallet.json
This is irreversible. Once burned, old tokens are gone forever. Double-check the pool and amount.

Use Cases

Deflationary token upgrades, security incident remediation (destroy compromised mint supply), permanent token retirement.

Tutorial 7: Multi-Token Merge

AdvancedType 6

Merge multiple old token communities into one new token. The authority creates separate migration pools per old token, each with its own conversion ratio.

Example: 3-Token Merge

Pool A: OLD_A → NEW (ratio 1:1)     p0=1, p1=1
Pool B: OLD_B → NEW (ratio 2:1)     p0=1, p1=2
Pool C: OLD_C → NEW (ratio 5:1)     p0=1, p1=5

Each pool is independent. Users migrate from whichever old token they hold.
The authority must deposit enough NEW tokens across all pools to cover expected migrations. Track total across all pools.

Tutorial 8: Capped FCFS Migration

IntermediateType 7

First-come, first-served migration with a global cap on total tokens distributed. Once the cap is hit, the pool stops accepting swaps.

Cap Enforcement

cap = param2 (raw token units)

If total_distributed + output > cap:
  output = cap - total_distributed  (partial fill)

Next swap after cap: ERR_CAP
The last user before the cap may get a partial fill. Use --min-out to reject partial fills below your threshold.

Tutorial 9: Gated (Whitelist) Migration

IntermediateType 8

The authority must co-sign every swap transaction. Only wallets the authority approves can migrate. There's no on-chain whitelist — the authority's bot gates access in real-time.

How It Works

1. User requests migration via off-chain channel
2. Authority's bot verifies eligibility
3. Bot co-signs the transaction
4. User submits the co-signed TX
The authority must run a signing bot or manually co-sign. Without co-signature, swaps fail with ERR_AUTH.

Use Cases

KYC-gated migrations, holder snapshots (only snapshot holders approved), geographic restrictions, tiered access.

Tutorial 10: Per-Wallet Cap

BeginnerType 9

Each wallet has a cumulative limit on how much they can migrate. Tracked via the MigrationClaimPDA. Anti-whale mechanism for fair distribution.

How It Works

max_per_wallet = param2 (raw token units)

On each swap:
  if user_total_migrated + amount > max_per_wallet:
    ERR_CAP

Multiple swaps are fine as long as total stays under the cap. The claim PDA tracks cumulative amount.

Tutorial 11: Vest + Bonus

AdvancedType 10

Combines time-decay bonus (Type 4) with vesting (Type 3). Rush to lock in the early-bird bonus, then claim tokens gradually as they vest.

Parameters

param2 = bonus_bps (e.g., 2000 = 20% max bonus)
param3 = vest_duration (seconds)
param4 = claim_interval (seconds)

Example: 20% bonus, 28-day vest, daily claims
  Day 1: swap 1000 → entitled to 1190 (19% bonus)
  Day 2+: claim ~42.5 tokens per day for 28 days
The bonus is calculated at swap time and locked in. Vesting doesn't reduce the bonus — it just delays delivery.

Tutorial 12: Burn + Vest

AdvancedType 11

Old tokens burned immediately, new tokens vest gradually. The strongest commitment mechanism — irreversible destruction + illiquid new tokens.

Parameters

param2 = vest_duration (seconds)
param3 = claim_interval (seconds)

Example: 60-day vest, weekly claims
  Swap: 5000 old tokens burned forever
  Week 1: claim ~583 new tokens
  Week 8+: claim final remainder
This is the most extreme migration type. Old tokens are gone instantly. New tokens take weeks/months to fully unlock. Only for high-conviction communities.

Tutorial 13: SOL-for-Token Sale

IntermediateType 12

Send SOL (lamports, not SPL tokens) to buy new tokens at a fixed rate. Direct SOL-to-token sale.

Parameters

param0 = tokens_per_sol (in raw units per 1 SOL)
param2 = cap (optional, total tokens to sell)

Example: param0 = 1000000000 (1000 tokens per SOL, 6 decimals)
  Send 5 SOL → receive 5,000 tokens

Swap Command

# Amount is in lamports (1 SOL = 1,000,000,000 lamports)
$ aex migrate swap <pool> 5000000000 --keypair wallet.json
SOL is transferred via direct lamport transfer (not SPL). The old_vault is unused. Authority receives SOL directly.

Tutorial 14: The Referral System

IntermediateREF flag

Set up a referral link for any migration pool with the REF flag, share it with others, earn rewards when they migrate, and claim your accumulated rewards.

Step 1 — Create Your Referral Link

$ aex migrate ref-init <pool_address> --keypair your_wallet.json

Referral link created!
  Pool: <pool_address>
  Your RefLink PDA: 4Kxp...7mNq
  Level: 0 (direct)

Your referral "link" is just your public key. Share it — friends add --referrer <your_pubkey> to their swap.

Step 2 — Friends Migrate Through Your Link

$ aex migrate swap <pool> 5000000000 --referrer <your_pubkey> --keypair friend.json

Friend gets full 5,000 tokens.
You get credited: 5,000 * 5% = 250 tokens (from vault).

Step 3 — Check & Claim Earnings

$ aex migrate ref-show <pool> --keypair your_wallet.json
$ aex migrate ref-claim <pool> --keypair your_wallet.json

Multi-Level Chains

Alice (L3) → Bob (L2) → Carol (L1) → User Dave

$ aex migrate ref-init <pool> --keypair alice.json
$ aex migrate ref-init <pool> --parent <alice_pubkey> --keypair bob.json
$ aex migrate ref-init <pool> --parent <bob_pubkey> --keypair carol.json

Dave swaps 10,000 tokens:
  Carol (L1): 10,000 * 5% = 500 tokens
  Bob (L2):   500 * 50% = 250 tokens
  Alice (L3): 250 * 25% = 62 tokens
Referral rewards are not vested. Even on vesting pools, referral commissions are claimable immediately.

Earnings Table

Pool ConfigPer $10K MigrationYour L1 Earning
300 bps (3%)$10,000$300
500 bps (5%)$10,000$500
800 bps (8%)$10,000$800
1000 bps (10%)$10,000$1,000
1500 bps (15%)$10,000$1,500

Tutorial 15: Authority Operations

AdvancedAdmin

The complete guide for pool creators: create a pool, deposit tokens, monitor, handle emergencies, close, and reclaim.

Create a Migration Pool

$ aex migrate create <old_mint> <new_mint> --type 0 \
  --start $(date -d '+1 hour' +%s) \
  --end $(date -d '+30 days' +%s) \
  --name "ALPHA to OMEGA" \
  --desc "Token rebrand migration" \
  --keypair authority.json

Deposit New Tokens

$ aex migrate deposit <pool> <amount_raw> --keypair authority.json
Always deposit more than expected migration volume. Account for referral rewards (5-15% overhead), bonuses, and a 10% safety margin.

Monitor in TUI

$ aex tui → [8] → [i] → [Enter]
Watch: Migrated count, Users, Remaining balance, Progress bar.

Emergency: Pause

$ aex migrate pause <pool> --keypair authority.json

Close After End Time

$ aex migrate close <pool> --keypair authority.json

Remaining new tokens returned to your wallet.
Collected old tokens returned to your wallet.

Transfer Authority

$ aex migrate auth <pool> --step init --new-auth <pubkey> --keypair authority.json
$ aex migrate auth <pool> --step complete --keypair new_authority.json

20 Pre-Built Strategy Templates

Predefined configurations combining migration types with referral settings. Use aex migrate templates to list all templates in the CLI.

1. Basic Referral

Type 0 (1:1) · REF 500bps · 1 level · Simple referral on 1:1 swap

2. Tiered Affiliate

Type 0 · REF 500bps · 3 levels · 60/30/0 decay

3. Squad Migrate

Type 0 · REF 800bps · 3 levels · Community-driven migration

4. Leaderboard

Type 0 · REF 1000bps · 1 level · High reward, flat structure

5. Cross-DEX LP

Type 1 (Ratio) · REF 500bps · 1 level · LP migration between DEXes

6. Diamond Hands

Type 3 (Vest) · VEST+REF · 2 levels · Vested + referral rewards

7. Referral Farming

Type 3 (Vest) · VEST+REF · 2 levels · Farm referrals over time

8. Quest Chain

Type 3 (Vest) · VEST+REF 300bps · 2 levels · Gamified migration

9. Staking Direct

Type 3 (Vest) · VEST+REF · 1 level · Stake-like vesting

10. Early Bird

Type 4 (Decay) · DECAY+REF 300bps · 1 level · Bonus + referral

11. Flash Window

Type 4 (Decay) · DECAY+REF 500bps · 1 level · Short window, high bonus

12. Burn & Premium

Type 5 (Burn) · BURN+REF · 2 levels · Burn old + earn referrals

13. Multi-Merge

Type 6 (Merge) · REF 500bps · 2 levels · Multiple communities merge

14. Lottery Migration

Type 7 (FCFS) · REF 300bps · 1 level · Capped + referral

15. KOL Boost

Type 8 (Gated) · GATED+REF 1000bps · 2 levels · Influencer-gated

16. Vote-to-Migrate

Type 8 (Gated) · GATED+REF 300bps · 1 level · Governance-gated

17. Ambassador

Type 8 (Gated) · GATED+REF 1500bps · 3 levels · Deep referral chain

18. Whale Cap

Type 9 (WlCap) · WLCAP+REF 300bps · 1 level · Fair distribution

19. LP Bootstrap

Type 12 (SOL) · SOL+REF 500bps · 2 levels · SOL sale + referral

20. SOL Pairing

Type 12 (SOL) · SOL+REF 300bps · 2 levels · SOL-denominated sale

The Referral System

On-chain referral tracking via RefLink PDAs (128 bytes). Enabled by setting the REF flag (0x40) on a migration pool. Supports up to 3 levels with configurable decay.

Multi-level reward flow:

User swaps 10,000 tokens (pool: 5% L1, 50% L2 decay, 25% L3 decay)

  Carol (L1 referrer):  10,000 * 5%   = 500 tokens
  Bob   (L2 parent):    500 * 50%     = 250 tokens
  Alice (L3 grandparent): 250 * 25%   = 62 tokens

Total referral cost: 812 tokens (from vault)
User receives full 10,000 tokens (referral does NOT reduce output)

Key rules: Self-referral prevention (ERR_AUTH). Max referral cap: 2000 bps (20%). Referral rewards are never vested. Vault sufficiency checked before crediting.

Error Reference

CodeNameDescription
6000ERR_PAUSEDPool is paused by authority
6003ERR_ZEROAmount too small or nothing to claim
6010ERR_AUTHUnauthorized (wrong authority, self-referral)
6015ERR_DISCInvalid account discriminator (wrong PDA type)
6031ERR_MIGMigration error (pool ended, not started, invalid type)
6032ERR_CAPMigration cap exceeded (global or per-wallet)
6033ERR_CLOSEDMigration pool is closed