
Morpho · Acts onchain
Withdraws collateral from a Morpho Blue market back to the socket. Morpho returns the collateral as long as the position stays under the market's liquidation LTV afterward. Set the amount to max to withdraw the full collateral balance. Reach for it to free collateral after a repay earlier in the transaction, or to move margin between markets, holding the position's health factor above a floor with a predicate.
Exit Morpho at Epoch End



1·Get expiry
Reads the expiry timestamp of the Pendle market PT-USDat-27AUG2026 at address 0x9afe7a057a09cf5da748d952078c9c99938b4329.
2·Check temporal state
Tests whether that expiry timestamp sits in the past relative to block time.
3·Predicate
Requires that the past check returns true, so the plug only proceeds once the market has expired.
4·Get total supplied and borrowed
Fetches the total supplied and borrowed assets and shares for the Morpho market identified by 0x69ef...617b at 91.5% LLTV.
5·Get account data
Pulls your own position data in that same market, denominated in USDC, giving your shares, collateral, debt, and health factor.
6·Compare two values
Compares a value drawn from your account data against 0 using a greater-than operator, producing a boolean.
7·Predicate
Requires that your supply position result equals the earlier true value, gating on you actually holding a position.
8·Get market parameters
Reads the immutable market parameters of that same Morpho market.
9·Use
Invokes the nested plug that converts Morpho borrow shares into borrow assets.
10·Set
Stores the borrow assets figure from the market parameters read into the variable user_borrow_assets_amount.
11·Set
Assigns the supplied assets amount from your account data into the variable user_supply_assets_amount.
12·Flash loan
Takes a flash loan of user_borrow_assets_amount of the market's loan token from the Morpho singleton, to be repaid within this transaction.
13·Repay
Repays user_borrow_assets_amount of that loan token as debt into the same market, clearing your borrow.
14·Withdraw Collateral
Withdraws user_supply_assets_amount of collateral from that market back to the socket now that debt is repaid.
15·Get price
Reads the oracle price of the collateral token in terms of the market's loan asset.
16·Calculate
Divides the supplied assets amount by the oracle price to size the collateral needed to cover the flash loan repayment.
17·Set
Saves that quotient into the variable collateral_needed_to_repay_flashloan.
18·Get address
Holds the Solver address as a named value for later use.
19·Get token balance
Reads the loan token balance held by 0x581BEf12967f06f2eBfcabb7504fA61f0326CD9A before routing.
20·Transfer tokens
Sends collateral_needed_to_repay_flashloan of the collateral token to the Solver address.
21·Get solution
Hands the transferred tokens to the solver for routing, then verifies the outcome.
22·Get token balance
Reads the loan token balance held by that same address again after routing.
23·Calculate
Subtracts the pre-routing balance from the post-routing balance to measure how much loan token the routing produced.
24·Compare two values
Checks whether that gained amount is greater than or equal to the supplied assets amount.
25·Predicate
Requires that comparison to be true, so the plug reverts unless routing returned at least the required loan token.
26·End block
Closes the innermost open block.
27·End block
Closes the remaining open block.
On other protocols · 2