Skip to content

Commit 280d6fc

Browse files
Merge pull request #4 from igneous-labs/revert-3-use-err-type
Revert "use LidoError for quote_withdraw_stake"
2 parents 2c0eef6 + 3fa5e48 commit 280d6fc

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

core/src/typedefs/exchange_rate.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use borsh::{BorshDeserialize, BorshSerialize};
22
use sanctum_u64_ratio::{Floor, Ratio};
33

4-
use crate::LidoError;
5-
64
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, BorshDeserialize, BorshSerialize)]
75
pub struct ExchangeRate {
86
pub computed_in_epoch: u64,
@@ -16,15 +14,12 @@ impl ExchangeRate {
1614
///
1715
/// Returns None on arithmetic failure
1816
#[inline]
19-
pub const fn quote_withdraw_stake(&self, stsol_amount: u64) -> Result<u64, LidoError> {
17+
pub const fn quote_withdraw_stake(&self, stsol_amount: u64) -> Option<u64> {
2018
let ratio = self.sol_balance_over_st_sol_supply();
2119
if ratio.0.is_zero() {
22-
return Err(LidoError::CalculationFailure);
23-
}
24-
match ratio.apply(stsol_amount) {
25-
Some(v) => Ok(v),
26-
None => Err(LidoError::CalculationFailure),
20+
return None;
2721
}
22+
ratio.apply(stsol_amount)
2823
}
2924

3025
#[inline]

0 commit comments

Comments
 (0)