Skip to content

Commit

Permalink
chore: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
maneva3 committed Aug 8, 2024
1 parent 451aa92 commit e91e7a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
16 changes: 1 addition & 15 deletions platform/packages/finance/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{any::type_name, fmt::Debug};

use thiserror::Error;

use currency::{error::Error as CurrencyError, Currency};
use currency::error::Error as CurrencyError;
use sdk::cosmwasm_std::StdError;

use crate::percent::Units as PercentUnits;
Expand Down Expand Up @@ -54,20 +54,6 @@ impl Error {
operand2: operand2.to_string(),
}
}

pub fn no_funds<C>() -> Self
where
C: Currency,
{
Self::NoFunds(C::TICKER.into())
}

pub fn unexpected_funds<C>() -> Self
where
C: Currency,
{
Self::UnexpectedFunds(C::TICKER.into())
}
}

pub type Result<T> = core::result::Result<T, Error>;
Expand Down
18 changes: 7 additions & 11 deletions protocol/contracts/oracle/src/contract/alarms/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,13 @@ where
where
C: Currency + MemberOf<Self::PriceG>,
{
Price::<C, BaseC>::try_from(self.price)
.map_err(ContractError::Finance)
.and_then(|price: Price<C, BaseC>| {
self.alarms
.alarms(price)
.map_err(ContractError::AlarmError)
.map(|alarms_iter| {
alarms_iter.map::<ContractResult<Addr>, AlarmIterMapFn>(
|result: Result<Addr, AlarmError>| result.map_err(ContractError::from),
)
})
self.alarms
.alarms(price)
.map_err(ContractError::AlarmError)
.map(|alarms_iter| {
alarms_iter.map::<ContractResult<Addr>, AlarmIterMapFn>(
|result: Result<Addr, AlarmError>| result.map_err(Into::into),
)
})
}
}
4 changes: 2 additions & 2 deletions protocol/packages/marketprice/src/alarms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ where
{
NormalizedPrice::new(&price).map(|norm_price| {
AlarmsIterator(
self.iter_below::<C>(&norm_price)
.chain(self.iter_above_or_equal::<C>(&norm_price)),
self.iter_below(&norm_price)
.chain(self.iter_above_or_equal(&norm_price)),
)
})
}
Expand Down

0 comments on commit e91e7a1

Please sign in to comment.