Withdraw
Withdraw

Morpho · Acts onchain

Withdraws lent loan asset and accrued interest from a Morpho Blue market. Morpho returns the exact asset amount to the socket, reporting assets and shares withdrawn, as long as the market has the liquidity. Pick Withdraw all to withdraw by shares, clearing the full supply exactly. Reach for it to exit a lending position or to pull the loan asset a following swap or deposit needs, coiling the amount forward.

Morpho: Refinance to Cheaper Borrow Market

morpho
plug
boolean
14actions
  1. 1·Get market parameters

    Immutable parameters of Morpho Blue market 0x3a85...ee49 at 86% LLTV are read, pulling in its loan token, collateral token, oracle, and fixed fields as the source of this refinance.

  2. 2·Get market parameters

    Parameters of the second market 0x09dc...631c at 86% LLTV are read the same way, standing in as the destination the position moves into.

  3. 3·Take

    A witness hole opens for minimum_apr_delta, the rate gap the refinance must clear, supplied by the caller at execution time.

  4. 4·Take

    Next minimum_health_factor is taken, the floor the moved position's health must hold after the move.

  5. 5·Take

    Rounding out the inputs, liquidity_multiplier is taken to scale the destination market's required liquidity.

  6. 6·Use

    Composing the Morpho Check Refinancing Constraints plug runs the rate, health, and liquidity tests over the two named markets and returns its pass flag and figures.

  7. 7·Predicate

    Requiring the constraints plug's output in slot 5.0 equal 1 gates everything ahead, so the flow proceeds only when all refinancing checks pass.

  8. 8·Flash loan

    A fee-free Morpho flash loan is taken in the debt amount from slot 5.1 and the loan token from slot 0.0.0, repaid within this transaction.

  9. 9·Repay

    That borrowed amount is repaid as loan-token debt to the source market from the socket's balance.

  10. 10·Withdraw

    Your collateral, the supply figure in slot 5.3, is withdrawn from the source market back to the socket in its collateral token.

  11. 11·Supply

    The withdrawn amount is supplied to the destination market as collateral in the destination's collateral token.

  12. 12·Borrow

    Loan asset equal to the debt figure is borrowed from the destination market against the newly supplied collateral, funding flash-loan repayment.

  13. 13·End block

    The conditional branch opened at the constraints check is closed.

  14. 14·End block

    The remaining open block is closed, ending the transaction.

Get market parameters of
Get market parameters of
Take
Take
Take
Use where
current_marketis
target_marketis
minimum_apr_deltais
minimum_health_factoris
liquidity_multiplieris
Flash loan
Repay to
Withdraw from
Supply to
Borrow from
End block
End block
  • Morpho: Refinance to Cheaper Borrow Market

    morpho
    plug
    boolean

On other protocols · 5