Skip to main content
Let users borrow a Morpho Blue market’s loan asset against supported collateral through the Base Earn API. One endpoint builds an atomic batch that borrows against existing collateral, or adds collateral and borrows together. The user’s wallet owns the position and receives the loan.
Morpho Borrow is a launch preview and is not yet available. Aave v4 borrowing is coming soon; supported markets and API details will be announced at release.

Demo

The demo above is mock only. If you want to see onchain demos on Vibenet, head to Base chain demos.

Before You Integrate

  • Market identifiers. Use the productId, debtMarketAssetId and, when adding collateral, collateralMarketAssetId supplied for your supported market. These are API identifiers, not token addresses or onchain market IDs. A lend vaultId cannot be used here.
  • Position data. The Borrow endpoint does not list markets or read positions. Connect a separate source for current collateral, debt, and liquidation risk.
  • Repayment. This release does not add Base Earn endpoints for repayment, standalone collateral deposits, or collateral withdrawals. Connect those through a separate Morpho integration (see the Morpho documentation) before offering borrowing; a complete experience needs position monitoring and a working repayment path.
  • Origination fee. Each borrow has a fixed 25 bps (0.25%) fee on the net proceeds, financed into the debt. See Origination Fee.
  • Atomic wallet. The batch must execute atomically. A wallet that cannot do so cannot use this flow; there is no sequential fallback.

Add Collateral and Borrow

This example uses earn() and attribution from Call the API and the batch-capable execute() from Execute Calls in a Wallet. The Python and Go versions return the batch to the client, which submits it with execute(); the Go earn.Call helper adds builderCode for you. Omit both collateral fields to borrow against existing collateral.
After execution succeeds, refresh the position and loan-token balance from your position-data source. Read collateral decimals independently from loan-token decimals.
Debt includes the financed origination fee and grows as interest accrues, and changes in collateral value can make a position liquidatable. Show current loan-to-value and leave a buffer below the market’s liquidation threshold. Base Earn does not monitor or defend positions after execution. Treat missing risk data as unavailable, not as zero risk, and never use the original netAmount as the repayment amount.

See Also

Morpho Borrow

Market selection, origination fees, and repayment.

Borrow API Reference

Request fields and fee fields in the response.

Execute Calls in a Wallet

Verify and send the returned batch with viem.

Integrate Lending

Let users deposit into Morpho and Upshift vaults.