Tenor Midnight Callbacks
Callbacks are stateless, immutable contracts invoked by Morpho Midnight during take(). Each callback encodes a specific state transition, runs atomically within the take, and leaves no stored state between calls.
Throughout these pages, Midnight refers to Morpho Midnight (fixed-rate, fixed-term) and Blue refers to Morpho Blue (variable-rate). sellerAssets and buyerAssets always refer to the filled amounts on the offer being taken.
Callback Catalog
The callbacks divide into two groups: renewal/migration callbacks, which are referenced by the Migration Intent Ratifier and run as part of the migration intent flow, and standalone callbacks, which are used directly through MORPHO_MIDNIGHT.take() without involving the ratifier.
Renewal & Migration
| Callback | Direction | Side | Page |
|---|---|---|---|
BorrowMidnightRenewalCallback | Midnight → Midnight | Borrower | Borrow Midnight Renewal |
LendMidnightRenewalCallback | Midnight → Midnight | Lender | Lend Midnight Renewal |
BorrowBlueToMidnightCallback | Blue → Midnight | Borrower | Blue to Midnight |
LendVaultToMidnightCallback | Blue → Midnight | Lender | Vault to Midnight |
BorrowMidnightToBlueCallback | Midnight → Blue | Borrower | Midnight to Blue |
LendMidnightToVaultCallback | Midnight → Blue | Lender | Midnight to Vault |
Standalone
| Callback | Purpose | Page |
|---|---|---|
MidnightSupplyCollateralCallback | Pull and supply collateral atomically on a take | Supply Collateral |
MidnightSupplyVaultSharesCallback | Wrap loan tokens into ERC-4626 vault shares and supply as collateral on a take | Supply Vault Shares as Collateral |
MidnightWithdrawVaultSharesCallback | Withdraw vault shares from collateral and redeem to loan tokens on an early exit | Withdraw Vault Shares as collateral |
Common Guarantees
msg.sendercheck: Every callback rejects any caller other than Morpho Midnight (OnlyMidnight).- Immutability: All callbacks pin their integration addresses (Morpho Midnight, Morpho Blue) as constructor immutables. Behavior never changes after deployment.
- No stored state: Callbacks hold no balances and no per-user state. Anything left on a callback is recoverable only by a subsequent take that consumes it as input.
- Health enforcement: Morpho Midnight checks the resulting position's health after the callback returns. A callback that leaves the borrower undercollateralized causes the entire take to revert.
Tokens transferred directly to a callback contract outside an active take can be lost; the next compatible take can consume them as inputs. Always route token movement through MORPHO_MIDNIGHT.take() (or the Tenor Adapter). Never transfer directly to a callback address.
Fees
Renewal and migration callbacks accept an optional fee. The fee can be set by the user when creating an offer with the callback, or be forced by a ratifier. Two fee models are used:
- Percentage of interest fee (Midnight → Midnight and Blue → Midnight). Derived from the offer's tick and applied to the interest portion of the offer.
- Flat percentage fee (Midnight → Blue and Midnight → Vault). Percentage of the value moved to the variable-rate market or vault.
Standalone callbacks (MidnightSupplyCollateralCallback, vault-shares callbacks) have no ability to set fees.