Morpho: Check Refinancing Constraints

Ethereum
Ethereum
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug reads a Morpho Blue position in a current market and tests whether refinancing it into a target market passes rate, health, and liquidity checks. It asks the caller for the current_market, the target_market, a minimum_apr_delta, a minimum_health_factor, and a liquidity_multiplier. It fires whenever called, converting borrow shares to a debt amount and returning a flag true only when all three checks pass. Reading these constraints by hand or against a stale oracle price risks approving a refinance that fails the health or liquidity floor.

Actions · 18

  • Get market parameters
    Get market parameters of
    Reads a Morpho Blue market's immutable parameters.
  • Get account data
    Get data in of
    Reads an address's position in a Morpho Blue market: shares, collateral, supplied assets, debt, and health factor.
  • Get total supplied and borrowed
    Get total supplied and borrowed in
    Reads a Morpho Blue market's totals: assets and shares supplied and borrowed.
  • Get market parameters
    Get market parameters of
    Reads a Morpho Blue market's immutable parameters.
  • Get price
    Get price of in
    Reads a Morpho Blue market's oracle price of its collateral in its loan asset.
  • Use
    Use where
    borrow_sharesis
    total_borrow_assetsis
    total_borrow_sharesis
    Composes another plug inside this one.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Use
    Use where
    current_marketis
    target_marketis
    minimum_apr_deltais
    Composes another plug inside this one.
  • Use
    Use where
    collateralis
    priceis
    lltvis
    debtis
    minimum_health_factoris
    Composes another plug inside this one.
  • Use
    Use where
    marketis
    debtis
    multiplier_definitionis
    Composes another plug inside this one.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.

Related plugs · 8

Not ready to run as it stands: it waits on values or a position of your own.