prepare_recovery

Documentation for eth_defi.erc_4626.vault_protocol.morpho.recovery.prepare_recovery function.

prepare_recovery(manager, request)

Plan one public alternate-market recovery for a proven exit-route shortfall.

Called only after exact redemption panics with arithmetic code 0x11. The configured adapter must belong to this vault and expose the reviewed Blue market interface. Aggregate entitlement must exceed idle assets plus this adapter’s position in the configured exit market. This excludes unrelated arithmetic errors. Unknown interfaces fail closed through normal RPC errors.

We conservatively free the gross requested assets from one other funded market, rather than optimise a moving tiny shortfall. Thus the fee is at most the authorised rate of that gross amount (plus integer rounding). The final exit can still use its ordinary configured market for any small accrual difference. The exact force call must preflight successfully; no recovery is attempted when the selected alternate market cannot fund it. Select the largest non-exit supply position covering the gross claim, then check its actual cash through the exact call. Do not try other markets after a refusal or build a multi-market recovery plan.

create_redemption_request() calls this only after the exact direct request proves the qualifying panic.

Parameters
Returns

Unsigned recovery request, or None when the authorisation, route proof or alternate supply position does not qualify. No transaction is broadcast.

Raises
  • VaultFlowUnavailable – The configured live penalty exceeds the authorised rate.

  • ValueError – The selected market’s asset or simulated share burn is unsafe.

Return type

Optional[eth_defi.erc_4626.vault_protocol.morpho.recovery.MorphoRecoveryRequest]