pub fn calculate_buffer_amounts(
direction: WrappingDirection,
kind: SwapKind,
amount_raw: &U256,
rate: &U256,
max_deposit: Option<&U256>,
max_mint: Option<&U256>,
) -> Result<U256, String>Expand description
Calculate buffer amounts for wrap/unwrap operations
§Arguments
direction- Wrapping direction (Wrap or Unwrap)kind- Swap kind (GivenIn or GivenOut)amount_raw- Raw amount to convertrate- Exchange rate (scaled 18)max_deposit- Maximum deposit limit (optional)max_mint- Maximum mint limit (optional)
§Returns
Converted amount