This plug leverages a Morpho Blue position toward a target loan-to-value using a fee-free flash loan, a floored swap, collateral supply, and a new borrow. It asks the caller for the account, the market, the triggerLTV and targetLTV levels, a maxSlippage bound, and a numChunks count. It fires only when the position's loan-to-value crosses triggerLTV and the computed debt-over-price quotient is nonzero. Running it on a stale oracle price misprices the flash-loan and borrow amounts, sizing the leverage against outdated collateral value.
Actions · 24
Getmarketparametersof
Reads a Morpho Blue market's immutable parameters.
Getdatainof
Reads an address's position in a Morpho Blue market: shares, collateral, supplied assets, debt, and health factor.
Getpriceofin
Reads a Morpho Blue market's oracle price of its collateral in its loan asset.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Is
Compares two values with a chosen operator and returns a boolean.
Steers control flow by comparing two values: branch, loop, or require the condition holds.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Is
Compares two values with a chosen operator and returns a boolean.
Is
Compares two values with a chosen operator and returns a boolean.
Steers control flow by comparing two values: branch, loop, or require the condition holds.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Flashloan
Borrows any token the Morpho Blue singleton holds, fee-free, repaid inside this transaction.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Usewhere
accountis
sellAmountis
sellTokenis
buyTokenis
minReceiveis
Composes another plug inside this one.
Supplyascollateralto
Supplies an asset as collateral to a Morpho Blue market.
Borrowfrom
Borrows the loan asset from a Morpho Blue market against your supplied collateral.
Endblock
Closes the innermost open block, whether a conditional branch or a loop.
Related plugs · 8
Not ready to run as it stands: it waits on values or a position of your own.