Function build_withdraw_route

Source
pub fn build_withdraw_route(
    principals: &[(TargetId, u128)],
    target_amount: u128,
) -> Result<WithdrawRoute, WithdrawRouteError>
Expand description

Build a withdraw route from market principals.

Creates a route that attempts to withdraw proportionally from each market based on its principal, up to the target amount.

§Arguments

  • principals - List of (target_id, principal_amount) pairs
  • target_amount - Total amount to withdraw

§Returns

A withdraw route, or an error if the route cannot satisfy the target.