let cp: Uint256 = offer_asset_in_pool * ask_asset_in_pool;
let offer_amount: Uint256 = Uint256::one()
    .multiply_ratio(
        cp,
        ask_asset_in_pool.checked_sub(
            Decimal256::from_ratio(ask_amount, Uint256::one())
                .checked_mul(inv_one_minus_commission)?
                .to_uint_floor(),
        )?,
    )
    .checked_sub(offer_asset_in_pool)?;
  pub fn compute_offer_amount(
    offer_asset_in_pool: Uint128,
    ask_asset_in_pool: Uint128,
    ask_amount: Uint128,
    pool_fees: PoolFee,
  ) -> StdResult<OfferAmountComputation> {
    // ...

    let offer_amount: Uint256 = Uint256::one()
        .multiply_ratio(
            cp,
            ask_asset_in_pool.checked_sub(
                Decimal256::from_ratio(ask_amount, Uint256::one())
                    .checked_mul(inv_one_minus_commission)?
                    .to_uint_floor(),
-           )?,
+           )?.checked_sub(Uint256::one())?,
        )
        .checked_sub(offer_asset_in_pool)?;

    // ...
  }
