Solana On-Chain Programs
A set of Rust programs on Solana covering a tokenized vault (ERC-4626 style), a two-party token escrow, and delegated spending allowances.
Overview
To understand how Solana handles state and account permissions on-chain, I implemented several core financial primitives in Rust. The repository includes a vault program modeled after Ethereum's ERC-4626 standard, an escrow program for atomic token swaps, and an allowance program for delegated token transfers.
How it works
Tap or hover stages to inspectImplementation details
PDA vault custody
Each vault and escrow state account uses deterministic Program Derived Addresses (PDAs) as token authority, so only the program itself can sign outgoing SPL token transfers.
Checked integer math for vault shares
Calculating deposit shares and withdrawal amounts uses checked arithmetic in Rust to prevent integer overflow or rounding bugs.
Explicit account constraints
Every instruction verifies token mint ownership, signer privileges, and account relationships before modifying balances.