pub fn calculate_d<const N: u8>(
    xp: &[Balance],
    amplification: Balance
) -> Option<Balance>