← Protocols
Morpho
01Description

Morpho Blue: an immutable, permissionless, isolated-market lending primitive, plus MetaMorpho vaults that allocate across markets for curated risk-adjusted yield.

02Best for
  • 01isolated lending markets
  • 02permissionless market creation
  • 03curated MetaMorpho vaults
  • 04high-LLTV efficient borrowing
  • 05RWA / long-tail collateral
03Install
  • pnpm add @morpho-org/blue-sdk @morpho-org/blue-sdk-viem @morpho-org/blue-api-sdk viem
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_MORPHO_BLUEClientMorpho Blue singleton address (Ethereum mainnet: 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb).
NEXT_PUBLIC_MORPHO_API_URLClientMorpho GraphQL endpoint for off-chain data (default: https://blue-api.morpho.org/graphql).
05Prompt snippet
Integrate Morpho Blue + MetaMorpho. A Morpho market is uniquely identified by `MarketParams = { loanToken, collateralToken, oracle, irm, lltv }` — hash with `MarketParamsLib.id` to get the `marketId` (bytes32). Direct calls on the singleton: `Morpho.supply`, `Morpho.withdraw`, `Morpho.supplyCollateral`, `Morpho.withdrawCollateral`, `Morpho.borrow`, `Morpho.repay`, `Morpho.flashLoan(token, assets, data)`. Use `@morpho-org/blue-sdk-viem` to build `Market.fetch(marketId, client)` and `AccrualPosition.fetch(user, marketId, client)` for live state. For curated risk, deposit into a MetaMorpho ERC-4626 vault via `vault.deposit(assets, receiver)` — the vault allocator routes liquidity across underlying Blue markets. Pull historical and APY data through `@morpho-org/blue-api-sdk` (GraphQL).
06Gotchas
  • Each market is fully isolated and IMMUTABLE — wrong `oracle` or `irm` choice cannot be patched, only avoided by using a new market.
  • `lltv` (liquidation LTV) is fixed at market creation; if collateral price drops past it, liquidators seize collateral with an incentive (`LIQUIDATION_INCENTIVE_FACTOR`).
  • Anyone can spin up a market with any oracle — including malicious or thinly-traded ones. Always whitelist `MarketParams` against curated lists or use MetaMorpho vaults.
  • MetaMorpho vault risk = curator risk: the curator chooses which Blue markets to allocate into, and a bad market addition can socialize losses.
  • There are no rewards baked into the protocol; MORPHO/URDs are distributed off-chain via Merkle claims through the `UniversalRewardsDistributor`.
  • Interest is accrued lazily — call `Morpho.accrueInterest(marketParams)` before reading on-chain `totalBorrowAssets` for accurate values, or use the SDK which simulates accrual.
  • Approvals go to the Morpho singleton, not the market; one approval per token per user covers all markets.
07Alternatives