Skip to main content

Morpho V2 To Morpho V1 Roller

The Morpho V2 To Morpho V1 Roller enables rolling of fixed-rate, fixed-term fixed-rate borrow positions from Morpho V2 to Morpho V1 variable-rate markets. Borrowers enabling this contract maximize the likelihood that their position will be renewed at a variable rate for an open term before maturity, instead of being liquidated post maturity.

When enabled, the smart contract allows any third party to renew a borrower’s position into a corresponding Morpho variable-rate open-term market, removing the need for manual repayment. Note that the renewal is only possible if there is sufficient liquidity in the variable rate market.

A user can use this policy in combination with Tenor's Morpho V2 To Morpho V2 Roller contract to try to renew the borrow position at a fixed rate first, and if not possible, renew it at a variable rate. The v2 to v1 roller can thus act as a fallback if the v2 to v2 roll is not possible due to a lack of liquidity or longer term fixed rates being above the user set maximum rate.

How It Works

1. Set Roll Parameters

The borrower (or authorized party) calls setUserParams to configure rolling preferences for a specific term market. Parameters are set per termMarketId, which is derived from the loan token and collateral tokens of the Morpho V2 position:

  • rollPeriod: Time window before maturity when rolling is allowed (max 3 days)
  • morphov1MarketIds: List of whitelisted Morpho V1 market IDs eligible for rolling
  • policy: Optional policy contract for custom logic and fees

This allows borrowers to have different rolling strategies for different loan/collateral combinations.

Authorization requirements:

  • The borrower must grant authorization to the roller contract on both Morpho V2 (to withdraw collateral) and Morpho V1 (to borrow on behalf)

2. Roll Execution

When the roll period begins, any third party can call rollPosition to execute the roll:

Validation checks:

  • Current time is within the roll period window
  • Target market is in the whitelisted market IDs
  • Loan tokens match between source and target markets
  • Borrower has only one collateral type (no mixed collaterals) on Morpho v2
  • Repaid debt does not exceed total debt

Policy execution:

  • Calls policy.beforeRoll() to calculate fees and determine borrowed amount
  • Borrowed amount is capped at 101% of repaid debt

Atomic transfer:

  • Borrows from target Morpho V1 market
  • Executes optional callback to repay source position and handle fees
  • Withdraws collateral from source Morpho V2 position
  • Supplies collateral to target Morpho V1 position
  • Calls policy.afterRoll() to validate fee payment

3. Clear Parameters

The borrower can call clearUserParams to disable rolling for a specific market