readFlashState()
Read the on-chain FlashState PDA to check loan status, compose with other protocols, and build advanced strategies.
What is readFlashState?
The FlashState PDA is the 98-byte account that tracks active flash loans. readFlashState() lets you deserialize and inspect this account โ useful for composability, monitoring, and building protocols on top of VAEA.
| Field | Type | Size | Description |
|---|---|---|---|
payer | Pubkey | 32 B | Wallet that initiated the flash loan |
token_mint | Pubkey | 32 B | SPL token being borrowed |
amount | u64 | 8 B | Borrowed amount in native units |
fee | u64 | 8 B | Fee in native units (amount ร fee_bps / 10,000) |
source_tier | u8 | 1 B | Fee tier: 0=SDK, 1=UI, 2=Protocol |
slot | u64 | 8 B | Slot when begin_flash was called |
bump | u8 | 1 B | PDA bump seed |
| Total | 98 B | Lightest flash loan state on Solana |
Code Examples
Composability
Any on-chain program can read the FlashState PDA to verify a flash loan is active โ this is the foundation of Zero-CPI integration:
Use Cases
Protocol Composability
Let your protocol verify and react to active flash loans without CPI overhead
Monitoring Dashboard
Track active flash loans in real-time by polling FlashState PDAs
Conditional Logic
Execute different strategies based on whether a flash loan is active
Audit & Analytics
Read historical FlashState data for fee analysis and volume tracking
โน๏ธ Note
FlashState PDAs are ephemeral โ they exist only during the transaction. After the TX completes (success or revert), the account is closed and rent is returned. readFlashState() is primarily useful for on-chain composability and real-time monitoring.