fix: mirror MorphoAllocator unlocked-amount deposit in SyncAllocatorDeposit - #203
fix: mirror MorphoAllocator unlocked-amount deposit in SyncAllocatorDeposit#203maxencerb wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Superseded: the fix is contained entirely in the allocator (3FLabs/facilitators#3), which keeps the existing run() ABI, so no grunt changes are needed. |
Problem
The SyncAllocatorDeposit flow passes a fixed
depositAmountthrough toMorphoAllocator.run, unlike the older SyncDeposit script which measured the shares actually received fromunlockand 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.AllocatorParamskeeps itsdepositAmountfield so existing callers do not have to change their encoding, but the script ignores it and no longer forwards it to the allocator.minSharesUnlockedremains the slippage guard on unlock.IMorphoAllocator.runmirror updated to the allocator's new primary signature (nodepositAmount).MockMorphoAllocatornow mirrors the real allocator: it measures the shares credited to the facility byunlockand deposits that full amount viadepositManager.Tests
test_execute_syncAllocatorDeposit_depositsFullUnlockedAmount: when the fund unlocks more shares than thedepositAmountprediction carried in the params, the full unlocked amount is deposited into the position manager and the facility is left with zero collateral dust.