Skip to content

fix: mirror MorphoAllocator unlocked-amount deposit in SyncAllocatorDeposit - #203

Closed
maxencerb wants to merge 2 commits into
mainfrom
fix/sync-allocator-deposit-unlocked
Closed

fix: mirror MorphoAllocator unlocked-amount deposit in SyncAllocatorDeposit#203
maxencerb wants to merge 2 commits into
mainfrom
fix/sync-allocator-deposit-unlocked

Conversation

@maxencerb

@maxencerb maxencerb commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

The SyncAllocatorDeposit flow passes a fixed depositAmount through to MorphoAllocator.run, unlike the older SyncDeposit script which measured the shares actually received from unlock and deposited exactly that. Because the executor has to predict the unlocked amount off-chain, any unlock slippage or fund NAV movement between order creation and unlock leaves collateral dust on the intent, which would otherwise need a dedicated sweep-deposit step in orchestration.

Fix

The allocator now deposits the measured unlocked amount itself (3FLabs/facilitators#3), so the fixed deposit amount disappears from the on-chain flow while the script's calldata shape stays the same:

  • SyncAllocatorDeposit.AllocatorParams keeps its depositAmount field so existing callers do not have to change their encoding, but the script ignores it and no longer forwards it to the allocator. minSharesUnlocked remains the slippage guard on unlock.
  • IMorphoAllocator.run mirror updated to the allocator's new primary signature (no depositAmount).
  • MockMorphoAllocator now mirrors the real allocator: it measures the shares credited to the facility by unlock and deposits that full amount via depositManager.

Tests

  • New test_execute_syncAllocatorDeposit_depositsFullUnlockedAmount: when the fund unlocks more shares than the depositAmount prediction carried in the params, the full unlocked amount is deposited into the position manager and the facility is left with zero collateral dust.
  • All 1724 tests pass.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 86068bd9-27ec-4e61-8601-cbc28c673c60

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sync-allocator-deposit-unlocked

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.

@maxencerb

Copy link
Copy Markdown
Collaborator Author

Superseded: the fix is contained entirely in the allocator (3FLabs/facilitators#3), which keeps the existing run() ABI, so no grunt changes are needed.

@maxencerb maxencerb closed this Jul 9, 2026
@maxencerb
maxencerb deleted the fix/sync-allocator-deposit-unlocked branch July 9, 2026 10:21
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.

1 participant