Skip to main content

LendMidnightRenewalCallback

Git Source - Generated with forge doc

Inherits: ILendMidnightRenewalCallback

Title: LendMidnightRenewalCallback

Callback that renews a lender position from a source to the target Midnight market when that market's BUY offer is taken.

Withdraws buyerAssets + fee from the source market, transfers the fee to the recipient, and approves Morpho Midnight to pull buyerAssets.

The lender must authorize this contract on Morpho Midnight.

No health check is run on the target market during the renewal (only loan-token equality is validated), so the migration can result in loss if that market has pending bad debt or depegged collateral. Lenders should only allow renewals into markets they trust.

Constants​

MORPHO_MIDNIGHT​

IMidnight public immutable MORPHO_MIDNIGHT;

Functions​

constructor​

constructor(address morphoMidnight);

Parameters

NameTypeDescription
morphoMidnightaddress

onBuy​

function onBuy(
bytes32 marketId,
Market memory market,
uint256 buyerAssets,
uint256 units,
uint256, /* pendingFeeIncrease */
address buyer,
bytes memory data
) external override returns (bytes32);

Parameters

NameTypeDescription
marketIdbytes32
marketMarket
buyerAssetsuint256
unitsuint256
_uint256
buyeraddress
databytes

Returns

NameTypeDescription
<none>bytes32