Skip to content

MorphoV2 plugins #1291

Open
julianmrodri wants to merge 11 commits into
masterfrom
plugins-morphov2
Open

MorphoV2 plugins #1291
julianmrodri wants to merge 11 commits into
masterfrom
plugins-morphov2

Conversation

@julianmrodri

@julianmrodri julianmrodri commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
  • Creates MorphoV2FiatCollaterla.sol extending the existing MetaMorphoFiatCollateral plugin for 8 mainnet Morpho Vault V2 vaults (steakUSDC Prime, Paypal PYUSD, Gauntlet USDC Frontier/Prime, Galaxy USDC/USDT Quality, Steakhouse USDT Prime,
    Sky USDT Savings)
  • Tests extending the meta-morpho fork suite with all 8 vaults
  • Deploy and verification scripts

Summary by CodeRabbit

  • New Features

    • Added support for Morpho Vault V2 collateral vaults for multiple USD‑pegged tokens on Ethereum mainnet.
  • Documentation

    • Updated Morpho reward claiming guidance and added Morpho Vault V2 compatibility notes with validated vaults and behavioral remarks.
  • Tests

    • Extended collateral test suites for V2 vaults, added V2 fork-block support and new test addresses.
  • Chores

    • Updated configuration with V2 token entries, added deploy/verification scripts for V2 collaterals, and bumped default fork block.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Morpho Vault V2 collateral support: extends token config/types and mainnet addresses, updates MetaMorpho docs, adds deployment and verification scripts (and wires them into pipelines), and expands test constants, helpers, and suites for V2 vaults.

Changes

Morpho Vault V2 Collateral Integration

Layer / File(s) Summary
Configuration and type definitions
common/configuration.ts
ITokens interface gains optional fields for V2 vault tokens (Prime, Frontier, Quality, Savings), and mainnet networkConfig receives corresponding token addresses.
Contract documentation
contracts/plugins/assets/meta-morpho/MetaMorphoFiatCollateral.sol, contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol, contracts/plugins/assets/meta-morpho/README.md
Developer comments and README document that existing MetaMorpho contracts work with Vault V2, list validated V2 quirks (gate behavior, max*=0, fee/loss handling), and list validated mainnet Vault V2 addresses.
Deployment script implementation
scripts/deployment/phase2-assets/collaterals/deploy_morpho_v2_vaults.ts
New script deploys MetaMorphoFiatCollateral contracts for each configured V2 vault with oracle feeds, timeout/error parameters, state refresh, and persistence to the deployment JSON.
Verification script implementation
scripts/verification/collateral-plugins/verify_morpho_v2_vaults.ts
New verification script iterates configured V2 vaults and calls verifyContract for MetaMorphoFiatCollateral with per-vault oracle and threshold args.
Deployment orchestration
scripts/deploy.ts
Wires phase2-assets/collaterals/deploy_morpho_v2_vaults.ts into the Ethereum Phase 2 deployment script list.
Verification orchestration
scripts/verify_etherscan.ts
Wires collateral-plugins/verify_morpho_v2_vaults.ts into the verification script list for the relevant network branch.
Test infrastructure: constants and helpers
test/plugins/individual-collateral/meta-morpho/constants.ts, test/plugins/individual-collateral/meta-morpho/mintCollateralTo.ts, test/integration/fork-block-numbers.ts
Adds V2 vault address constants, V2-specific fork blocks (FORK_BLOCK_V2), share whale addresses for impersonation, and updates the default fork block number.
Test suites and configuration
test/plugins/individual-collateral/meta-morpho/MetaMorphoFiatCollateral.test.ts
Extends test options with forkBlock, updates fork reset wiring and helpers to accept per-vault fork blocks, and adds test suite invocations for configured V2 vaults using FORK_BLOCK_V2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'MorphoV2 plugins' is concise but vague—it indicates the general area (MorphoV2 plugins) without clarifying the specific change. The PR actually adds eight new Morpho Vault V2 collateral deployments with scripts, but the title doesn't convey this primary action. Consider a more specific title like 'Add MorphoV2 vault collateral plugins and deployment scripts' to better convey that new deployments and infrastructure are being added.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch plugins-morphov2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
scripts/deployment/phase2-assets/collaterals/deploy_morpho_v2_vaults.ts (1)

33-49: ⚡ Quick win

Extract shared Morpho V2 vault config to prevent deploy/verify drift.

VAULTS here is duplicated in the verification script and must stay constructor-arg aligned. A future one-sided edit can break verification while deployments still succeed. Please centralize this map/interface in a shared module and import it from both scripts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/deployment/phase2-assets/collaterals/deploy_morpho_v2_vaults.ts`
around lines 33 - 49, Extract the V2VaultDeployment interface and the VAULTS
array into a new shared module and import them into both
deploy_morpho_v2_vaults.ts and the verification script so the data stays
single-sourced; specifically move the definitions for V2VaultDeployment and
VAULTS (the array entries like 'steakUSDCPrime', feeds and
oracleTimeout/oracleError constants) into a shared export, update
deploy_morpho_v2_vaults.ts to import { V2VaultDeployment, VAULTS } from that
module, and update the verification script to import the same symbols so
constructor-arg alignment cannot drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contracts/plugins/assets/meta-morpho/README.md`:
- Around line 55-64: Update the README table to use the same token identifiers
as in common/configuration.ts so operators aren't confused: replace symbols like
steakUSDC with steakUSDCPrime, senPYUSD with sentoraPYUSD (and any other
mismatched entries such as gtusdcf/gtusdcp, gUSDTq/gUSDTq etc.) to exactly match
the keys defined in common/configuration.ts; verify each Symbol column value
against the configuration file and make the README entries identical to those
identifiers.

In `@scripts/verification/collateral-plugins/verify_morpho_v2_vaults.ts`:
- Around line 65-72: Before calling verifyContract, add explicit checks that the
deployment address (deployments.collateral[v.tokenKey]) and the token address
(networkConfig[chainId].tokens[v.tokenKey]) are defined; if either is undefined
throw or log a clear error mentioning the specific v.tokenKey so failures are
actionable. Locate the loop handling each v (use symbols deployments.collateral,
v.tokenKey, networkConfig, chainId and the verifyContract call) and guard the
verify invocation by verifying those two addresses exist and include v.tokenKey
in the error message when they do not.

In `@test/plugins/individual-collateral/meta-morpho/mintCollateralTo.ts`:
- Around line 14-22: The mapping block in mintCollateralTo.ts (the computed keys
like networkConfig['31337'].tokens.gauntletUSDCFrontier, steakUSDCPrime,
sentoraPYUSD, etc.) has a lint/formatting violation; fix it by reformatting that
object literal so each computed property uses consistent spacing and trailing
commas, matching project Prettier/ESLint rules (e.g., ensure no stray whitespace
inside brackets, each entry ends with a comma, and alignment matches surrounding
mappings) — easiest fix: run the repo's formatter (prettier or eslint --fix) on
this file or manually adjust the entries to match the other mapping blocks.

---

Nitpick comments:
In `@scripts/deployment/phase2-assets/collaterals/deploy_morpho_v2_vaults.ts`:
- Around line 33-49: Extract the V2VaultDeployment interface and the VAULTS
array into a new shared module and import them into both
deploy_morpho_v2_vaults.ts and the verification script so the data stays
single-sourced; specifically move the definitions for V2VaultDeployment and
VAULTS (the array entries like 'steakUSDCPrime', feeds and
oracleTimeout/oracleError constants) into a shared export, update
deploy_morpho_v2_vaults.ts to import { V2VaultDeployment, VAULTS } from that
module, and update the verification script to import the same symbols so
constructor-arg alignment cannot drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6af2ec08-9cc7-43a1-a8e1-266d2cd2aee4

📥 Commits

Reviewing files that changed from the base of the PR and between 9cda9d8 and 4576ac7.

📒 Files selected for processing (10)
  • common/configuration.ts
  • contracts/plugins/assets/meta-morpho/MetaMorphoFiatCollateral.sol
  • contracts/plugins/assets/meta-morpho/README.md
  • scripts/deploy.ts
  • scripts/deployment/phase2-assets/collaterals/deploy_morpho_v2_vaults.ts
  • scripts/verification/collateral-plugins/verify_morpho_v2_vaults.ts
  • scripts/verify_etherscan.ts
  • test/plugins/individual-collateral/meta-morpho/MetaMorphoFiatCollateral.test.ts
  • test/plugins/individual-collateral/meta-morpho/constants.ts
  • test/plugins/individual-collateral/meta-morpho/mintCollateralTo.ts

Comment thread contracts/plugins/assets/meta-morpho/README.md Outdated
Comment thread scripts/verification/collateral-plugins/verify_morpho_v2_vaults.ts Outdated
Comment thread test/plugins/individual-collateral/meta-morpho/mintCollateralTo.ts
tbrent
tbrent previously approved these changes Jun 9, 2026

@tbrent tbrent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only thing to mention, maybe intended

README symbols for Sentora and Sky do not exactly match on-chain metadata. Sentora returns senPYUSDPRIMEv2, not senPYUSD; Sky returns skyMoneyUsdtSavings, not skyMoneyUsdt.

@julianmrodri

julianmrodri commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Looks good. Only thing to mention, maybe intended

README symbols for Sentora and Sky do not exactly match on-chain metadata. Sentora returns senPYUSDPRIMEv2, not senPYUSD; Sky returns skyMoneyUsdtSavings, not skyMoneyUsdt.

No.. will put the real ones int he README I thought I had that covered

tbrent
tbrent previously approved these changes Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants