Inspiration

Lending today prices each asset alone; Pluribus prices the whole basket

If you are active in Solana DeFi, your money is scattered. Your SOL sits in a wallet, your staked SOL in JitoSOL or JupSOL, your tokenized stocks in a Token-2022 account, and your best-earning capital is locked inside concentrated-liquidity positions on Orca, Raydium or Meteora. Each of those is worth something. Together they are worth a lot. But the moment you want to borrow against them, none of it adds up.

Lending markets today look at one asset at a time. Every deposit gets its own loan-to-value ratio, as if the others did not exist. And the asset that is doing the most work for you, your LP position, usually counts for nothing at all, because it is an NFT or a program-owned account instead of a plain token. So the most sophisticated users, the ones providing liquidity to the whole ecosystem, are the ones who can borrow the least against what they hold.

Traditional finance solved this decades ago. A prime broker does not ask what each stock is worth as collateral in isolation. It looks at the whole portfolio, asks what it would be worth in a bad market, and lends against that. A diversified book gets more credit than a concentrated one, because it genuinely is safer.

We wanted that on Solana: one credit line against everything you hold. The name comes from e pluribus unum, out of many, one.

What it does

Pluribus is a lending protocol where a single credit account holds your whole portfolio and backs one USDC loan.

For borrowers

  • One basket, one loan. A credit account holds up to 16 positions at once: SOL, staked SOL (JitoSOL, JupSOL), tokenized stocks (including Token-2022 ones), memecoins, USDC, and concentrated-liquidity positions from Orca, Raydium and Meteora DLMM.
  • Portfolio-level credit. Instead of a fixed ratio per asset, the program values the whole account under three crash scenarios (a crypto crash, an equity crash and a broad selloff) and takes the worst total as your credit limit. Because the totals are added before the worst one is picked, a mixed account borrows more than its parts: $5,000 of SOL with $5,000 of a tokenized stock supports $6,937.50, against $6,250 if the two were held in separate accounts.
  • LP positions as real collateral. A concentrated liquidity position is revalued from its own range and liquidity at each crash price. Only the oracle price is used and not the pool's own price, so nobody can move a pool to inflate what a position is worth.
  • Your LP fees pay the loan down. Anyone can collect the trading fees of a deposited position for a 2% bounty. The USDC repays your debt, and the rest stays in your account as collateral. If you would rather grow the position, you can set it to compound instead.
  • No maturity. There is no repayment schedule. Interest accrues every second at a rate that follows pool utilization, and an account that stays healthy moves to a cheaper rate tier after 7 days and again after 30.
  • Orderly liquidation. If your debt passes the liquidation limit, a liquidator repays up to half of it per transaction. The program, not the liquidator, chooses which position is sold first: the one that closes the most of the shortfall per dollar repaid. Only once the debt is more than 10% over the limit can any position go, so a deeply underwater account never waits for a liquidator who can afford the first one.

For lenders

  • Pick your risk. A senior tranche is paid first and loses last. A junior tranche takes losses first and earns a multiple of the senior rate for covering it, plus the risk premium that borrowers pay on risky collateral.
  • A clear loss order. A loss is taken from lenders' interest not yet paid out (the weekly yield buffer), then the insurance reserve, then protocol fees, then junior lenders, and only then senior lenders.
  • Real exits. Seniors withdraw at once from idle USDC, or join a queue paid strictly in order as borrowers repay. Juniors leave through a 6-day exit queue with a 2-day claim window, so first-loss capital cannot run when a crash starts.

The loss order, from the yield buffer to senior lenders

How we built it

The program

Pluribus is one Anchor program in Rust, about 7,600 lines and 69 instructions. Everything lives in PDAs: one pool holds the USDC and both tranche share mints, each listed asset and LP market has its own config and vault, and each borrower has one credit account with 16 position slots.

  • Risk engine. One pass over the credit account prices every position and adds up its value in each crash scenario, from a scenario-by-group shock table. Each asset's shock is the larger of its table value and z·σ·√T, where σ comes from two moving averages of the asset's variance that the program updates from oracle samples. The worst scenario is the credit limit. The liquidation limit is the same pass with smaller shocks.
  • Integer maths. Values are 6-decimal fixed point in u128, and every division rounds against the borrower: collateral down, debt up.
  • LP valuation. For Orca and Raydium we read the position's liquidity and tick range straight from the account bytes and recompute its token amounts at each shocked oracle price. For Meteora we read the position's per-bin liquidity shares and count each bin as whichever of its two tokens is worth less at the oracle price. The pool's own price, active bin and reserves are never read to value a position.
  • Oracles. Prices come from Pyth push feeds. We use price minus confidence, reject bands that are too wide, and accept older prices for liquidations than for new debt. Staked SOL is capped at its stake pool backing times SOL's price.
  • Token-2022. Tokenized stocks pass an extension allow-list at listing, and the program applies the token's corporate-action multiplier, treating a price around a split as unclear rather than as a crash.
  • Three DEXs by CPI. The pool PDA holds Orca and Raydium position NFTs and owns Meteora positions outright. It calls each DEX to collect fees and compound. In a liquidation, an Orca or Raydium position goes to the liquidator whole, as its NFT, while a Meteora position, which cannot change owner, is unwound by CPI.
  • Lending pool. One USDC pool with senior and junior share mints, virtual shares against first-depositor attacks, one borrow index per loyalty tier, a weekly yield buffer, and the whole loss waterfall in a single write-off.
  • Guardrails. Any change that loosens risk waits out an activation delay at least as long as the junior exit wait plus its claim window, so juniors who disagree can leave first. A guardian key can only tighten.

How the crash test works

Every position \(i\) is repriced in every scenario \(s\) (crypto crash, equity crash, broad selloff).

Price. The Pyth price minus its confidence, \(p_i = \hat p_i - c_i\). Staked SOL is also capped at its backing, \(p_i \le r_i p_{\text{SOL}}\).

Shock. The asset falls with its risk group \(g\) by

$$\delta_{i,s} = \min\left(\max\left(\delta_{s,g}, d_i \frac{\delta_{s,g}}{\max_{s'} \delta_{s',g}}\right), \delta_{\max}\right), \qquad d_i = z\sqrt{\sigma_i^2 T_i}$$

where \(\delta_{s,g}\) is the table value, \(T_i\) is the time to liquidate (1 day for SOL, 3 for stocks) and \(\sigma_i^2\) is a per-second variance the program updates from each oracle sample:

$$\sigma^2 \leftarrow \sigma^2 \left(1 - \frac{\Delta t}{\tau}\right)^+ + \frac{r^2}{\tau}, \qquad r = \frac{\max\left(\lvert p_1 - p_0 \rvert - c, 0\right)}{\bar p}$$

The confidence band is taken off each move, so noise never counts as volatility. Draws use \(z = 3\) and the higher of a 1-hour and a 7-day average. The liquidation line uses \(z = 2.33\) and the 7-day one.

Value and limits. With \(k_i\) the cost of liquidating the asset and \(v_i(p) = q_i p\) for a token:

$$V_{i,s} = (1 - k_i) v_i\big(p_i(1 - \delta_{i,s})\big), \qquad L = \min_s \sum_i V_{i,s}$$

\(L\) is the credit limit. The liquidation limit \(L_m\) is the same sum with smaller shocks, and an account can be liquidated once its debt \(D \gt L_m\). Summing before taking the minimum is where diversification pays, since \(\min_s \sum_i V_{i,s} \ge \sum_i \min_s V_{i,s}\). That is the gap between $6,937.50 and $6,250 in the example above. SOL falls 30%, 15% and 25% in the three scenarios and the stock 15%, 35% and 25%, with liquidation costs of 5% and 10%. Held together, the worst scenario is the broad selloff, at $6,937.50. Held apart, each asset takes its own worst case: $3,325 for SOL and $2,925 for the stock, $6,250 in all.

The crash test worked through: $6,937.50 together against $6,250 apart

Valuing a concentrated liquidity position

A position with liquidity \(\ell\) over ticks \(t_a\) to \(t_b\) has \(\sqrt{p_a} = 1.0001^{t_a/2}\) and \(\sqrt{p_b} = 1.0001^{t_b/2}\). With \(\sqrt{\tilde p}\) the current \(\sqrt{p}\) clamped to that range, it holds

$$x(p) = \ell\left(\frac{1}{\sqrt{\tilde p}} - \frac{1}{\sqrt{p_b}}\right) \text{ SOL}, \qquad y(p) = \ell\left(\sqrt{\tilde p} - \sqrt{p_a}\right) \text{ USDC}$$

so its value has three regimes:

  • below the range, all SOL: \(v(p) = \ell\left(\frac{1}{\sqrt{p_a}} - \frac{1}{\sqrt{p_b}}\right)p\)
  • in range: \(v(p) = \ell\left(2\sqrt{p} - \sqrt{p_a} - \frac{p}{\sqrt{p_b}}\right)\)
  • above the range, all USDC: \(v(p) = \ell\left(\sqrt{p_b} - \sqrt{p_a}\right)\)

The value of a 120 to 180 position as SOL's price moves

In scenario \(s\) the program values it at the crashed oracle price, with the USDC side taking the USDC shock:

$$v_s(p) = x(p) p + (1 - \delta_{s,\text{USDC}}) y(p)$$

The concave payoff, impermanent loss included, is priced exactly rather than approximated. Alone in an account, a position's crash-tested LTV is

$$\text{LTV} = \frac{(1 - k) v\big(p(1 - \delta)\big)}{v(p)}$$

With SOL at 150, a 30% crash and a 5% liquidation cost (before the USDC shock), plain SOL gets \(0.7 \times 0.95\) = 66.5%. A position over 145.5 to 154.5 gets 67.0%, one over 120 to 180 gets 70.8%, a full-range one gets \(\sqrt{0.7} \times 0.95\) = 79.5%, and one over 100 to 140, all USDC at 150, gets 84.0%. Part of a position is USDC, so it is less exposed to SOL than SOL itself and earns a higher LTV, not zero.

Crash-tested loan-to-value by range

A Meteora bin \(b\) has a fixed price \(P_b = (1 + \beta)^b\), where \(\beta\) is the bin step in basis points divided by 10,000. Our share \(\ell_b\) of the bin, in USDC terms, could be any mix of SOL and USDC, so we count it as whichever is worth less:

$$v_s(p) = \sum_b \ell_b \min\left(\frac{p}{P_b}, 1 - \delta_{s,\text{USDC}}\right)$$

That is the worst mix arbitrage could leave, so valuing a position never reads the pair's active bin or reserves.

The liquidation order uses the same numbers. The next position to go is the one with the lowest

$$\frac{V^m_{i,\hat s}}{v_i(p_i)}(1 + b_i)$$

where \(\hat s\) is the scenario that sets \(L_m\), \(V^m\) is a value under the liquidation shocks and \(b_i\) is the liquidator's bonus.

Testing

  • 261 tests: 249 run the program in-process with LiteSVM, and 12 are unit tests of the maths, the Meteora valuation and the liquidation order.
  • The Orca, Raydium and Meteora tests run against the real mainnet program binaries and snapshots of real pools, positions and a Jito stake pool, so our CPIs and byte offsets are checked against the code that runs on mainnet.
  • A compute suite fills all 16 slots and checks that every health-checked path fits in 1.4M compute units. The most expensive, a Meteora liquidation, uses about 1.06M.
  • End-to-end and smoke scripts drive the SDK against a local validator and a live cluster.

261 tests against real DEX programs, and the compute budget

The rest of the stack

  • SDK. TypeScript on Anchor's generated IDL. It builds every instruction, mirrors the program's maths so the app can show a credit limit or health figure before anything is sent, and sends v0 transactions through an address lookup table so liquidating a crowded account stays under 1,232 bytes.
  • Keeper. One loop that liquidates, refreshes rate tiers and risk premiums, samples each asset's volatility for the dynamic shocks, posts fresh Pyth prices and pays the head of the senior withdrawal queue. It does not collect LP fees: anyone can, for the bounty.
  • Indexer. A QuickNode Streams filter on the Solana block dataset keeps only transactions that touch Pluribus and pushes them to a small server that checks Streams' HMAC signature, decodes the program's events and stores them. A replay script feeds the same server from plain RPC, for chains Streams cannot reach. Statements and lending history are built from these events.

From a Solana block to a statement, through QuickNode Streams

  • Price feed. Our demo validator has no Pyth, so a service mirrors mainnet prices, read from Pyth accounts and Orca pools over plain RPC, into the demo price accounts. It also trades the local Orca and Meteora pools back to the oracle price.
  • Web app. Next.js 16, React 19 and Tailwind 4, with the Solana wallet adapter and a built-in demo wallet so anyone can try it without an extension. Four pages: Overview, Borrow, Earn and Statements, with monthly statements you can export as CSV.
  • Deployment. The program is on devnet. The hosted app on Vercel runs against our own validator on a Mac mini, loaded with the real Orca and Meteora programs and exposed through Tailscale Funnel, with the keeper, indexer and price feed running beside it.

Pluribus architecture: users, the app and off-chain services, the program, external protocols and custody

Challenges we ran into

  • Valuing an LP position safely. A concentrated-liquidity position changes composition as price moves, and the pool's own price can be pushed around within a single transaction. We had to derive the position's value from first principles (liquidity, range and an oracle price) for both tick-based pools and Meteora's bins, and never read the pool's spot price for anything that sets credit.
  • Meteora positions cannot change owner. Unlike an Orca position, which is an NFT you can hand over, a DLMM position is bound to its owner for life. You cannot deposit one you already hold. We had to redesign that flow so the pool owns the position from the start: the user opens it through Pluribus, and the open, the funding and the account creation happen in one transaction.
  • Fitting inside a transaction. An account with several Token-2022, staking and LP positions pulls in a lot of accounts. Liquidating one did not fit in a legacy transaction, which pushed us to lookup tables and v0 transactions, and to careful accounting of compute units.
  • Making first-loss capital actually first-loss. If juniors can leave the moment a crash begins, they are not absorbing anything. Designing the exit queue, the claim window, and the rule that new risk cannot be listed faster than juniors can exit took several iterations.
  • Getting the slot out of a block. A block in the Streams dataset does not carry its own slot. Our filter reads it from the stream's batch metadata, which only works with a batch size of one, and the indexer has to accept payloads both bare and wrapped.
  • RPC rate limits. The app reads a lot of accounts to render a portfolio. On a public devnet endpoint we hit HTTP 429s constantly, which is part of what pushed us toward a dedicated endpoint and toward pushing data instead of polling for it.
  • Testing against the real thing. Devnet has no real stake pools and no deep liquidity, and a local validator cannot skip days. We ended up snapshotting real DEX programs and accounts for tests, and running the local chain's time-based rules on seconds instead of days.

Accomplishments that we're proud of

  • Three liquidity venues as collateral. Orca Whirlpools, Raydium CLMM and Meteora DLMM positions can all back a loan, each valued from its own structure.
  • A real risk engine, on chain. Scenario-based, portfolio-level credit limits with volatility-driven shocks, computed inside the program on every action.
  • A loan that pays itself down. Autopay and compounding work across all three venues, through a permissionless bounty that anyone can earn.
  • A full two-tranche lending market. Senior and junior tranches, a loss waterfall, an insurance reserve, exit queues and a risk premium that flows to the lenders taking the risk.
  • It is a whole product. One program with 69 instructions and 261 tests, an SDK, a keeper, an indexer and a four-page app with monthly statements you can export.

What we learned

  • Diversification is measurable. We expected basket-level pricing to help a little. Seeing a mixed account borrow about 11% more than the same assets held apart, purely because the scenarios are added before the worst is chosen, made the core idea concrete.
  • Oracle design is most of the security. Using the low end of the confidence band, refusing stale prices for new debt, and never trusting a pool's own price closed off whole classes of attack before we had to think about them individually.
  • State is not history. A program that tracks balances perfectly still cannot tell a user what happened last month. Anything a person would call a statement has to be built from events, and that needs a feed you can depend on.
  • Solana's limits shape the design. Transaction size, account counts and compute units were not obstacles to route around at the end. They decided how instructions were split and what could be combined from the first week.
  • Incentives beat infrastructure. We first assumed a keeper would collect fees. Making it a bounty anyone can claim removed a single point of failure and a running cost at the same time.

What's next for Pluribus

  • An audit, then mainnet. The program is unaudited and runs with mock tokens and demo-set prices. Nothing goes near real money until that changes.
  • Live prices everywhere. Move every asset onto live Pyth feeds.
  • Raydium in the app. Raydium positions work in the program and the SDK today. The deposit flow in the app is next.
  • More collateral. More liquid staking tokens, more tokenized stocks, more pairs on each venue, and positions beyond SOL/USDC.
  • Governance. Replace the single admin key with a multisig and timelocked parameter changes, building on the activation delays the program already enforces.
  • Alerts on top of Streams. The same event feed that builds statements can warn a borrower when their health is falling, or a lender when a queued exit is paid.

Built With

Share this project:

Updates

Submission history