Project Overview
Stervault is a decentralized finance (DeFi) lending platform built on the Solana blockchain that brings traditional financing experiences to Web3. The platform enables users to deposit assets to earn interest and borrow against collateral, all with the speed and low cost of Solana.
We designed and built a complete lending protocol that mirrors the familiar experience of traditional banking while leveraging the transparency and composability of blockchain technology.
The Challenge
Our client needed a DeFi lending platform that could:
- Replicate Traditional Finance UX: Users should feel at home with familiar deposit, withdrawal, and borrowing flows
- Real-Time Price Feeds: Accurate collateral valuation for safe lending operations
- Scalable Architecture: Handle multiple token markets with independent parameters
- Liquidation Protection: Automated under-collateralization detection and handling
Technical Implementation
Core Lending Program
The heart of Stervault is a Solana program deployed using the Anchor framework. The program implements a share-based lending and borrowing system with these key features:
Program Instructions:
initUser- Initializes global user state for new platform usersinitBank- Creates new token banks with configurable parametersdeposit- Allows users to deposit tokens and receive interest-bearing shareswithdraw- Enables withdrawal of deposited tokens plus accrued interestborrow- Facilitates borrowing against collateral with LTV checksrepay- Processes loan repayments and collateral releasesinitBorrowPosition- Creates new borrowing positions for users
Account Structure
The program maintains several key account types for state management:
- Bank: Stores token-specific lending parameters and aggregate statistics
- UserGlobalState: Tracks user's overall platform activity and positions
- UserTokenState: Manages user balances for specific tokens
- BorrowPosition: Represents individual borrowing positions with collateral
- PythNetworkFeedId: Maps token symbols to Pyth price feed identifiers
Price Oracle Integration
The platform integrates with Pyth Network for real-time price feeds, essential for accurate collateral valuation and risk management. The program validates price feed freshness and integrates price data into borrowing and liquidation calculations.
Pyth Network provides sub-second price updates, enabling Stervault to offer competitive rates while maintaining protocol safety.
Frontend Application
The frontend is built as a modern React application using Next.js, providing users with an intuitive interface for interacting with the lending protocol:
- Market Interface: Displays available lending markets and current rates
- Deposit/Withdrawal Forms: Transaction interfaces for depositing and withdrawing assets
- Borrowing Interface: Tools for managing collateralized borrowing positions
- Transaction History: Comprehensive activity tracking and reporting
- Wallet Integration: Seamless connection to Solana wallets via Wallet Adapter
Results & Impact
Stervault demonstrates how traditional finance concepts can be implemented on Solana with improved transparency and efficiency:
- Sub-second Transactions: Leveraging Solana's speed for instant deposits and withdrawals
- Real-Time Interest: Share-based accounting enables continuous interest accrual
- Transparent Operations: All lending parameters and positions are on-chain and verifiable
- Cost Effective: Minimal transaction fees compared to Ethereum-based alternatives
The platform supports multiple deployment environments including local development with token faucets, Solana devnet for testing, and production deployment on mainnet.









