Protocol by protocol

Download Markdown

A leg is one investment position of the vault, and its adapter is the small program that connects the vault to that leg's protocol. The vault's own rules are the same for every leg. What differs is how each adapter reads its protocol, and therefore which failures it can see. This page collects, for each adapter, what automated tests on copies of the real protocols' mainnet programs and accounts found. The tests use a 3,000 USDC leg; measured figures are rounded.

Every token sale is a trade. A token the vault holds is sold only by the executor, on a market, inside one transaction the program values before and after (see Token legs). Adapters remain to value a protocol's share token and to run its queued exits: Solstice's eUSX and Hastra's PRIME and AUTO are held this way, and Maple's syrupUSDC and OnRe's ONyc are held as plain token legs with no adapter of their own. This design is deployed on the current mainnet commission core; historical vaults used earlier program versions. Networks and availability has the details.

At a glance

AdapterLeg holdsValued atLow value below bookValuation calls the protocol's programQueued exits
KaminokUSDC receiptsThe reserve's exchange rate0YesNo
Jupiter LendjlUSDC fTokensEarn's token exchange price0YesNo
HumaPSTThe pool mode's assets per PST0.5% by default, more with a higher fee capNoYes
Kamino EarnShares of a Kamino Earn vaultThe vault's cash plus its reserves' cTokens at their exchange rates, less fees due, per shareThe vault's withdrawal penalty (0.01% on Commodity Yield)YesYes
HastraPRIME or AUTO (staked wYLDS)Hastra's posted stake price1%NoYes
SolsticeeUSXSolstice's vault rate, USX at par1%NoYes
Token legsUSDG, Maple syrupUSDC or OnRe ONycPar, Maple's Chainlink rate, or OnRe's net asset valueThe market price under stress, or what a thin market can payOnly the ONyc legNo

Table: how each adapter values its leg and exits; "par" means 1 token = 1 USDC.

The book value is what the protocol's own accounting says the leg is worth. The low value is a cautious value, roughly what the leg would fetch if it had to be sold now. The column "Low value below book" is the gap between them, a haircut: a 2% haircut on a 3,000 USDC leg gives a low value of 3,000 × 0.98 = 2,940. Withdrawals are priced at the low value, and the gap is taken from Junior first (see Wrong or manipulated data). Queued exits are exits the protocol pays later; see Exits in flight.

Kamino

  • Exits go back through Kamino.
  • Outage: valuation needs Kamino's program, so the leg goes stale and the vault stops until the guardian suspends it (sets it aside with its last value). Kamino's emergency mode makes the adapter fail with an error rather than a flag.
  • Unnoticed theft of all the reserve's cash costs the leg about 292 of its 3,000 USDC, roughly 10%, because borrowers still owe the rest. Kamino refuses new deposits into a robbed reserve, and an exit fails with InsufficientLiquidity, which is the alarm.
  • Not applicable: oracles, exit routes and issuers. A lending reserve has none.

Jupiter Lend

  • Exits go back through Jupiter Earn.
  • Outage: like Kamino, the vault stops until the leg is suspended.
  • Unnoticed theft costs about 304 of 3,000 USDC, roughly 10%. Unlike Kamino, Jupiter accepts new money: 500 USDC put in is worth about 449. An exit fails with InsufficientBalance, which is the alarm.
  • Dependency: Huma keeps its idle cash in Jupiter Lend (see Several legs at once).

Kamino Earn

This adapter is deployed on mainnet (Networks and availability). A Kamino Earn vault is run by a curator who lends its USDC to one or more Kamino Lend reserves; the adapter binds a vault that lends to at most two, such as Kamino Institutional Commodity Yield, whose one reserve lends to a single off-chain borrower.

  • Exits are instant, from the Kamino Earn vault's cash and then from one of its reserves, or queued in Kamino Lend's withdraw queue, which pays in the order the requests came in as the borrower repays. Queued payments count against the reserve's daily withdrawal limit.
  • Curator changes: the leg is bound to the vault's reserves, fees and withdrawal penalty as they were. If Kamino's curator moves money to another reserve, raises a fee or the penalty, or requires permission to deposit, the adapter flags the leg and the vault stops until the guardian suspends it or the executor exits.
  • Outage: valuation refreshes the reserves through Kamino's program, so like Kamino the leg goes stale until it is suspended. Kamino's emergency mode raises PROTOCOL_PAUSED.
  • Unnoticed theft of all the reserve's cash costs the leg about 316 of its 3,000 USDC, because the borrower still owes the rest. An exit fails with InsufficientLiquidity, which is the alarm. Unlike Kamino Lend, new money is accepted: 500 USDC put in is worth about 447, because the Kamino Earn vault takes it first and lends it on later.
  • Exit in flight: the claim is the reserve's cTokens in Kamino Lend's queue, valued at the reserve's rate, so a loss in the reserve reduces it. Cancelling is possible only on a market where Kamino allows it (not on Commodity Yield's market today); a request Kamino Lend invalidated is always taken back.

Huma

  • Exits are instant through Huma, or queued through Huma's exit queue.
  • Instant exit fee: Huma charges a fee for instant withdrawals that rises as its pool's cash share falls. On the copy of Huma's accounts used in the tests, the cash share was about 9.7%, and at that level Huma's fee was 1%. The adapter refuses any instant exit whose fee is above the leg's cap, which is 0.25% unless the curator raises it. A curator can raise the cap for a leg up to 1% by creating a fee-limit account with the adapter's init_instant_fee_policy instruction and binding it to the leg. When the fee is above the cap, exits use the queue instead.
  • Low value: the adapter puts the low value below book by the fee cap plus a 0.25% margin, and at least 0.5%. With the default cap that is 0.25% + 0.25% = 0.5%; with a 1% cap it is 1% + 0.25% = 1.25%.
  • Outage: the leg is still valued from Huma's accounts, so the vault keeps running. Only money going into or out of Huma fails, and Akashi's off-chain monitor warns the guardian.
  • Unnoticed theft of the pool's cash costs the leg about 11 of its 3,000 USDC, because the pool's cash is a small part of its assets.
  • Exit in flight: Huma's claim is PST in escrow, so a loss in Huma reduces it. A short payment is booked as a loss (see Exits in flight).

Hastra

  • Entry is a deposit through Hastra at its own price, with no market in between. Exits sell the shares on a market inside a checked trade, or go through Hastra's operator queue, which pays one USDC per wYLDS.
  • Outage: the leg is still valued, and sales on the market keep working.
  • Unnoticed theft of Hastra's vault cash costs the leg almost nothing (about 0.04 of 3,000 USDC). A sale on the market succeeds, so the theft stays hidden from the vault; Akashi's off-chain monitor watches the vault Hastra pays redemptions from (see Hacks no one noticed).
  • Depeg of the sale route's stablecoin: the leg is valued at Hastra's price, so a depeg does not move its value. A sale that would lose more than the leg's slippage limit (0.5% in the tests) is refused, while Hastra's queue still pays at par (see Depegs).
  • Stale price: Hastra's administrators post the stake price every few hours. When it goes stale, the adapter raises PRICE_UNCERTAIN.
  • Issuer: PRIME has a freeze authority. A frozen account raises PROTOCOL_PAUSED.
  • Exit in flight: the claim is a wYLDS redemption paid at one USDC per wYLDS or not at all, so it cannot be paid short. The shares not in the queue can still be sold while it waits.

Solstice

  • Entry and exits buy and sell eUSX on a market inside a checked trade, or go through Solstice's cooldown.
  • Outage: the leg is still valued and still trades; only the cooldown exit needs Solstice's program. A freeze by Solstice's controller raises PROTOCOL_PAUSED.
  • Unnoticed theft of USX from Solstice's asset vault costs everything (3,000 of 3,000 USDC). New money is lost too: 500 USDC put in afterwards is worth about 0.36. A sale on the market succeeds, so the theft stays hidden. This is the worst case found in the tests, and the main reason for Akashi's off-chain balance monitor.
  • Depeg: a USX price outside 0.98 to 1.02 dollars, the range in which USX is treated as on its peg, raises PRICE_UNCERTAIN, because the cooldown exit pays in USX.
  • Exit in flight: the claim is USX in escrow. If USX trades at 0.70 USDC when the exit settles, the sale of that USX is refused and the claim stays open. The eUSX not in the cooldown can still be sold while it waits.

Maple and OnRe

Maple's syrupUSDC and OnRe's ONyc are held as token legs: syrupUSDC at Maple's Chainlink exchange rate, checked against its market within 1%, and ONyc at OnRe's net asset value (NAV), checked against its market within 2%.

  • Outage: an ONyc leg needs OnRe's program to read the NAV, so the vault stops until the leg is suspended. A syrupUSDC leg reads the feed and keeps being valued.
  • Stale or absurd feed: the syrupUSDC leg raises PRICE_UNCERTAIN, and the leg goes stale.
  • Theft at OnRe: OnRe sets its NAV itself, so a theft shows only as a lower NAV, which the vault books as an honest loss. Akashi's off-chain monitor also watches OnRe's redemption vaults.
  • Earlier vaults: a vault that already holds syrupUSDC through Maple's own adapter keeps it; that adapter values syrupUSDC the same way and exits through its own sale.

Token legs

  • What: the leg holds a token directly, valued by the token adapter through a pricing account published once per token. Money moves in and out only through a trade bracket: begin_trade, a sale or purchase on a market signed by the bracket's delegate, then end_trade. The program checks the leg's slippage limit, its largest trade and the vault's weekly trading-cost budget.
  • Guards: each token leg checks a market price against a reference, within a band in basis points (bps; one basis point is 0.01%). USDG checks Pyth's USDG/USD price and its market against 1 dollar, with a 50 bps (0.5%) band. syrupUSDC checks its market against Maple's rate, with a 100 bps (1%) band. ONyc compares OnRe's NAV with its market price, with a 200 bps (2%) band.
  • A guard reading outside its band is MARKET_STRESS: the leg is neither bought nor sold. A stale or unverified reading is PRICE_UNCERTAIN.
  • Thin market: a pricing account can also check that the market's USDC can pay the whole leg. When it cannot, the leg is THIN_MARKET: leavers are paid at what the market can pay, the leg is not bought, and it is still sold, each sale within that amount.
  • Issuer: USDG has a freeze authority, a permanent delegate and a transfer fee extension (see The token issuer acts).

Advanced details

  • For every kind of failure, the tests record whether it is simulated on the protocol's real accounts, run for real, or not applicable to that adapter. A check fails if a failure an adapter can suffer has no test.

On this page