A two layer modular architecture that enhances capital efficiency, scalability, and risk management.
- Architecture
- Repository Structure
- Dependencies
- Quickstart
- Program Overview
- Mainnet Deployments
- Authority Structure
- Security
Jupiter Lend implements a two-layer modular architecture that separates liquidity management from user-facing operations, enabling unified liquidity across multiple protocols.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Wallets β β dApps β β Liquidators β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬βββββββ β
βββββββββββΌββββββββββββββββββΌββββββββββββββββββΌββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Protocol Layer β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Lending Protocolβ β Vaults Protocol β β
β β β β β β
β β β’ Deposit β β β’ Operate β β
β β β’ Withdraw β β β’ Liquidate β β
β β β’ Rebalance β β β’ Rebalance β β
β ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ β
β β ββββββββββββββββββββ β
β β β CPI Calls (Cross-Program Invocations) β
βββββββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Liquidity Layer β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Unified Liquidity Pool (Single Orderbook) β β
β β β β
β β β’ Operate (Supply, Withdraw, Borrow, Payback) β β
β β β’ Unified liquidity management, token limits and rates management.β β
β β β’ Atomic transaction execution β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β² β²
β β
ββββββββ΄βββββββ ββββββββββ΄βββββββββ
β Oracle β β Flash Loan β
β Program β β Program β
βββββββββββββββ βββββββββββββββββββ
- Unified Liquidity: All protocols share the same liquidity pool, maximizing capital efficiency and reducing fragmentation
- Discrete Risk Framework: Each protocol (Lending, Vaults) maintains a distinct set of risk parameters (CF, LT, etc) while leveraging shared liquidity within set limits
- Modular Design: New protocols can be added without modifying the core liquidity layer
fluid-contracts-solana/
βββ programs/ # Solana programs
β βββ liquidity/ # Core liquidity layer
β βββ lending/ # Lending protocol
β βββ vaults/ # Collateralized borrow protocol
β βββ oracle/ # Oracle that utilizes multiple oracles
β βββ flashloan/ # Flash loan functionality
β βββ lending_reward_rate_model/ # Reward distribution
βββ __tests__/ # Test suite
βββ temp/ # Build artifacts
βββ Anchor.toml # Anchor configuration
-
Rust - v1.81.0
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup default 1.81.0
-
Solana CLI - v2.1.0
sh -c "$(curl -sSfL https://release.anza.xyz/v2.1.0/install)" # Generate keypair solana-keygen new
-
Anchor Framework - v0.31.1
# Install Anchor Version Manager (AVM) cargo install --git https://github.com/coral-xyz/anchor avm --locked --force # Install Anchor avm install 0.31.1 avm use 0.31.1
-
Node.js - For build scripts and testing
# Verify installation node --version npm --version # Install dependencies npm install
git clone https://github.com/fluid-fi/fluid-contracts-solana.git
cd fluid-contracts-solana# Install Node.js dependencies
npm install
# Verify toolchain versions
rustc --version # Should be 1.81.0
solana --version # Should be 2.1.0
anchor --version # Should be 0.31.1# Build all programs
anchor build
# Or build specific program
npm run build:liquidity
npm run build:lending
npm run build:vaults# Run all tests
anchor test
# Or test specific program
npm run test:liquidity
npm run test:lending
npm run test:vaultsThe Liquidity program serves as the foundational single-pool architecture that manages all liquidity within the system. It tracks the deposit and borrow positions of integrated programs and enforces program-specific borrowing and withdrawal controls, including rate-limited mechanisms such as debt ceilings and withdrawal limits. Access to this program is permission-based, and end users never interact with it directly. Only whitelisted programs, such as Vaults and Lending, can interact with it through CPIs. All other programs in the ecosystem are built on top of this liquidity infrastructure.
Key Method
- Operate: The core interaction method that handles all liquidity operations (supply, withdraw, borrow, payback) in a single atomic transaction.
The Lending program provides a straightforward lending protocol that offers users direct exposure to yield generation. Users can supply assets to earn interest, making it the core yield-bearing mechanism within the protocol suite.
Key Methods:
- Deposit: Allows users to supply assets into the protocol
- Withdraw: Enables users to withdraw their supplied assets
- Rebalance: Synchronizes the protocol's accounting with its actual position on the Liquidity layer, ensuring accurate asset tracking and exchange rates. When rewards are active, rebalance syncs the orderbook to incorporate accrued rewards
The Vaults program implements a collateralized debt position (CDP) system. Users deposit collateral assets to borrow debt tokens against them, enabling leverage and capital efficiency. This program handles collateral management, debt issuance, and liquidation mechanisms through a tick-based architecture for efficient risk management.
Key Methods:
- Operate: Manages collateral and debt positions by interacting with the Liquidity layer, handling deposits, withdrawals, borrows, and paybacks
- Liquidate: Allows liquidators to repay debt on behalf of risky positions in exchange for collateral at a discount (liquidation penalty). Positions become liquidatable when they exceed the liquidation threshold (e.g., 90% LT). The liquidation mechanism operates on a tick-based system, where positions are liquidated based on their risk level. Positions with ratio above the liquidation max limit (e.g., 95% LML) is automatically absorbed by the protocol
- Rebalance: Reconciles vault positions with the underlying Liquidity layer to maintain accurate collateral and debt accounting. When rewards are active on the protocol, rebalance syncs the orderbook to account for accrued rewards
The Oracle program provides reliable price feeds for the protocol. It supports data sources from multiple providers including Pyth, Chainlink, and Solana-native pools to ensure accurate asset pricing.
The Flash Loan program provides atomic loans that must be borrowed and repaid within a same transaction. This enables arbitrage, liquidations, and other advanced DeFi operations without requiring upfront capital.
The Lending Reward Rate Model program manages the calculation and distribution of rewards for the Lending protocol, determining reward rates based on protocol parameters and market conditions.
The following programs are currently deployed on Solana mainnet:
| Program | Program ID |
|---|---|
| Liquidity | jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC |
| Lending | jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9 |
| Lending Reward Rate Model | jup7TthsMgcR9Y3L277b8Eo9uboVSmu1utkuXHNUKar |
| Vaults | jupr81YtYssSyPt8jbnGuiWon5f6x9TcDEFxYe3Bdzi |
| Oracle | jupnw4B6Eqs7ft6rxpzYLJZYSnrpRgPcr589n5Kv4oc |
| Flashloan | jupgfSgfuAXv4B6R2Uxu85Z1qdzgju79s6MfZekN6XS |
The protocol implements a multi-tiered authority system with distinct permissions for enhanced security.
-
Purpose: Controls program upgrades on the Solana network.
-
Governance: Managed through a 12-hour timelock multisig wallet jointly controlled by Jupiter and Fluid team signers.
-
Address:
4MsgBB5VPoTrUSp5XnfbViV386C1UnsTdifLBw33ZMSJ
-
Purpose: Manages protocol configuration including rate curves, loan-to-value (LTV) ratios, operational limits, and authority delegation.
-
Governance: Jointly controlled by Jupiter and Fluid team signers.
-
Address:
HqPrpa4ESBDnRHRWaiYtjv4xe93wvCS9NNZtDwR89cVa
-
Purpose: Handles initialization operations across all protocol programs, including:
- Liquidity: Initialize new token reserves and protocol positions
- Lending: Initialize new lending markets and fToken mints
- Vaults: Initialize vault configurations and vault states
- Lending Reward Rate Model: Initialize reward rate models
This authority is limited to initialization only, without configuration modification privileges e.g., setting limits or change configs.
-
Governance: Controlled by the Fluid team.
-
Address:
3H8C6yYTXUcN9RRRDmcLDt3e4aZLYRRX4x2HbEjTqQAA
- Audit Reports: Jupiter Documentation
- Bug Bounty: Contact [email protected] for responsible disclosure
- Security Best Practices: All programs undergo rigorous testing and multiple security audits before deployment