Skip to content

Borrow

Borrow takes USDC out against your deposited collateral and sends it to your wallet. This is your loan - distinct from the working borrow Sonnar runs on top of it.

On-chain, borrow draws USDC from the position’s lender against your collateral:

  • The position’s stored lender (Jupiter Lend or Kamino Lend) decides which borrow flow runs.
  • If Sonnar has capital deployed in a vault, the method pulls what it needs back out of the vault first, then completes your borrow - all in the same operation. You never manually unwind the engine’s position to get liquidity out.
  • The borrowed USDC lands in your wallet’s USDC account.
  • Borrowing raises your LTV; the protocol caps your debt at 50% of collateral value, well below the lenders’ liquidation lines (75-90% depending on lender and asset).
import { executeAction, parseUsdc, SOL_MINT } from "@hobba-io/core";
const { signature } = await executeAction({
connection,
signer,
collateralMint: SOL_MINT, // identifies which position to borrow on
action: "borrow",
amount: parseUsdc("150"), // micro-USDC (1e6)
apiBaseUrl: "https://app.hobba.io",
onStep: (s) => setStatus(s),
});

For deposit + borrow together at onboarding, use executeDepositBorrow.

const limits = await getLimits({ connection, owner, collateralMint, apiBaseUrl });
// limits.maxBorrowUsdc - micro-USDC still available at the 50% cap
// limits.maxUserLtvPct - 50

maxBorrowUsdc is collateral value × 50% - current user debt - the exact figure the app’s Max button uses.

Preview the outcome for a confirm screen with getQuote: projected LTV, liquidation price, drop-to-liquidation buffer, a risk label, and the projected effective loan APY.

  • Your debt (getPosition().userDebtUsdc) and LTV update immediately.
  • Sonnar keeps steering the total debt toward the target LTV: after your borrow it recalculates and adjusts the working borrow on the next cycle.
  • The yield subsidy keeps working against your new balance - repayments are covered on the Repay page.

Borrowing moves you closer to the liquidation line. The 50% cap leaves a wide buffer, but on volatile collateral it’s still worth surfacing quote.projected.dropToLiquidationPct to your users before they confirm.