pub fn compute_settlement(
escrow_shares: u128,
expected_assets: u128,
actual_assets: u128,
) -> EscrowSettlementExpand description
Compute escrow settlement when completing a withdrawal.
Determines how many shares to burn vs refund based on actual redemption versus the original expected amount.
§Arguments
escrow_shares- Total shares held in escrow.expected_assets- Assets expected at time of request.actual_assets- Assets actually being redeemed.
§Returns
EscrowSettlement with shares to burn and shares to refund.
§Logic
- If actual >= expected: burn all shares (full redemption).
- If actual < expected: burn proportional shares, refund the rest.
- If actual == 0: refund all shares (cancellation).