Function validate_allocations

Source
pub fn validate_allocations(
    allocations: &[(&CapGroupId, &CapGroupRecord, u128)],
    total_assets: u128,
) -> Result<(), CapGroupError>
Expand description

Validate a list of allocations against their cap groups.

§Arguments

  • allocations - List of (cap_group_id, cap_group_record, allocation_amount) tuples
  • total_assets - Total vault assets for relative cap calculation

§Returns

Ok(()) if all allocations are valid, or the first error encountered.

Note: This function tracks cumulative allocations per cap group to detect cases where multiple allocations to the same group would exceed the cap, even if each individual allocation is valid against the original principal.