Architecture
How VAEA Flash works under the hood โ the sandwich pattern, program accounts, multi-protocol routing, and security guarantees.
Sandwich Pattern
Every VAEA Flash loan is a single atomic Solana transaction. Your instructions are sandwiched between a begin_flash (borrow) and end_flash (repay) instruction.
โน๏ธ Note
The atomicity guarantee means you can never end up in a state where you borrowed tokens but failed to repay. Either everything succeeds, or nothing happens. You only lose the base TX fee (~0.000005 SOL) on failure.Program Accounts (PDAs)
The on-chain program uses Program Derived Addresses (PDAs) to manage state:
| Account | PDA Seeds | Purpose |
|---|---|---|
| Flash Vault | ["flash", token_mint] | Holds borrowed tokens during the transaction |
| User State | ["flash", payer, token_mint] | Tracks the active loan for a specific user/token pair |
| Config | ["config"] | Global protocol configuration (fee rates, authority) |
๐ก Tip
The SDK derives all PDAs automatically. You never need to compute them manually โ executeLocal() handles everything.Multi-Protocol Routing
VAEA Flash doesn't hold any liquidity. It routes borrows through existing lending protocols with automatic fallback:
| Protocol | Role | Tokens Served |
|---|---|---|
| Marginfi | Primary lender | SOL, USDC, USDT, JupSOL, JitoSOL, JUP |
| Kamino | Fallback | SOL, USDC, cbBTC, JLP |
| Jupiter Lend | Third source | SOL, USDC, USDT + 35 others |
Address Lookup Tables
VAEA uses a pre-deployed Address Lookup Table (ALT) to compress transactions โ saving ~124 bytes per TX. Since Solana transactions are limited to 1232 bytes, this leaves maximum room for your instructions.
Security Model
| Security Feature | Detail |
|---|---|
| Instruction introspection | begin_flash โ end_flash pairing verified within the same TX via sysvar |
| Atomicity | If repay fails, entire TX reverts โ no partial execution possible |
| Non-custodial | Tokens flow: lending protocol โ you โ lending protocol. VAEA never holds funds |
| Permissionless | Anyone can use โ no KYC, no registration, no approval needed |
| Fee floor | Minimum 1 lamport fee prevents micro-loan evasion |
| Cross-token isolation | PDA seeds include token_mint โ prevents collisions in multi-token flash |
| Zero data retention | No database. On-chain state reads only. Zero user data stored |