Skip to content

Conversation

@tomrpl
Copy link
Collaborator

@tomrpl tomrpl commented Nov 19, 2025

@codex knowing the following, can you review the codebase

Architecture Understanding

VaultV2 Key Concepts (Validated as Correct)

  1. Adapter Architecture: VaultV2 uses adapters to allocate assets to various markets. Each adapter reports realAssets() back to the vault.

  2. ID-based Caps: Multiple adapters can share the same ID to cap aggregate exposure. Each ID has:

    • allocation: Current allocated amount
    • absoluteCap: Fixed maximum allocation
    • relativeCap: Percentage-based maximum (relative to total assets)
    • effectiveCap: min(absoluteCap, relativeCap * totalAssets)
  3. Fee Structure:

    • Performance fee: Taken on interest earned
    • Management fee: Taken on total assets over time
    • Both properly accounted for in preview functions

TODO

Medium Priority (Optional)

  • ⚠️ Add integration tests for Morpho Market adapter functions (when ready)
  • ⚠️ Add multi-adapter scenario tests
  • ⚠️ Add fee accrual over time tests (with significant time warp)
  • ⚠️ Add cap enforcement tests (allocation near/at caps)

Low Priority (Nice to Have)

  • 📝 Add fuzz tests for edge cases (max uint values, zero values)
  • 📝 Add documentation examples showing adapter setup
  • 📝 Add examples of cap management strategies
  • 📝 Add force deallocate scenario examples

Copy link

@MazyGio MazyGio left a comment

Choose a reason for hiding this comment

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

This is amazing work! Just requesting one change on the fee math

@tomrpl tomrpl requested review from MazyGio and fdemiramon November 21, 2025 10:35
Copy link

@fdemiramon fdemiramon left a comment

Choose a reason for hiding this comment

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

I love it

Copy link

@fdemiramon fdemiramon left a comment

Choose a reason for hiding this comment

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

I love it

@tomrpl tomrpl requested review from MazyGio and fdemiramon November 21, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants