You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Midnight action flows under `client.morpho.midnight(chainId)` and expose pure Midnight transaction builders for fixed-rate taker, maker, redeem, repay/withdraw, and cancel flows.
6
+
7
+
The Midnight entity returns lazy action outputs with `getRequirements()` and synchronous `buildTx(...)` methods, matching the existing `morpho-sdk` action pattern while accepting fixed-rate API quote takes directly. UI labels, rate display logic, and offer-chain presentation stay on the integrator side.
Copy file name to clipboardExpand all lines: packages/morpho-sdk/AGENTS.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
# `packages/morpho-sdk/`
2
2
3
-
Transaction builders for VaultV1, VaultV2, and Blue. Subfolders carry the layer-scoped detail; this file is the package overview + glossary.
3
+
Transaction builders for VaultV1, VaultV2, Blue, and Midnight. Subfolders carry the layer-scoped detail; this file is the package overview + glossary.
4
4
5
5
> Architecture / type / test / doc / release rules apply per the [root `AGENTS.md`](../../AGENTS.md). Subfolder rules: see each `src/<layer>/AGENTS.md`.
6
6
7
7
## Routing summary
8
8
9
9
-**VaultV1 / VaultV2 deposits** route through bundler3 via GeneralAdapter1 (which enforces `maxSharePrice`, protecting against inflation attacks). VaultV1/V2 `withdraw` and `redeem` are direct vault calls. VaultV2 `forceWithdraw` / `forceRedeem` use `multicall` with `forceDeallocate` calls before the final withdraw/redeem.
10
10
-**Blue bundled paths** (`supply`, `supplyCollateral`, `borrow`, `supplyCollateralBorrow`, `repay`, `repayWithdrawCollateral`, `withdraw`) route through bundler3 via GeneralAdapter1. `repay` and `withdraw` each accept assets or shares (mutually exclusive); `repayWithdrawCollateral` repays first then withdraws. Loan-asset `supply` supports native wrapping when `loanToken === wNative`; loan-asset `withdraw` supports optional PublicAllocator reallocations to top up market liquidity (same mechanism as `borrow`).
11
+
-**Midnight paths** expose lazy action outputs under `client.morpho.midnight(chainId)`. Fixed-rate market taker flows route through Midnight Bundles, direct collateral supply/cancel/redeem route through Midnight, and maker flows return root-ratification requirements plus the mempool payload transaction. The SDK owns protocol transactions and requirements; integrators keep UI labels, rate math, and display decisions.
11
12
-**Bundle composition, native wrapping, and reallocation rules** are canonical in [`src/actions/AGENTS.md`](./src/actions/AGENTS.md).
12
13
13
14
## Tests
@@ -21,6 +22,7 @@ Protocol terms used across this package's docs and JSDoc:
21
22
### Contracts and adapters
22
23
23
24
-**Blue / Morpho Blue** — Morpho's immutable, **variable-rate** lending primitive (formerly called "MarketV1" in this SDK). Each market is an isolated pair whose borrow rate floats with utilization, driven by the market's IRM. A market is identified by `MarketParams { loanToken, collateralToken, oracle, irm, lltv }`. Exposed via `client.blue(marketParams, chainId) → MorphoBlue`. This is the canonical definition of "Blue" for the whole package; other docs link here rather than redefine it.
25
+
-**Midnight** — Morpho's fixed-rate lending primitive. Takers consume signed offers through Midnight Bundles; makers submit offer groups/trees to the Midnight mempool after Ecrecover signing or Setter ratification.
24
26
-**VaultV1 / MetaMorpho** — ERC-4626 vault layered on top of Blue.
25
27
-**VaultV2** — successor vault with adapter-based liquidity routing and `forceDeallocate`.
26
28
-**bundler3** — the bundler entry point; receives a sequence of adapter actions in one transaction.
0 commit comments