Skip to content

Commit

Permalink
Merge pull request #35 from osmosis-labs/fix-asset-group-decimal-error
Browse files Browse the repository at this point in the history
[FIX] Asset group decimal error
  • Loading branch information
iboss-ptk authored Oct 30, 2024
2 parents 2a3d4cc + f3ba51e commit 21d909a
Show file tree
Hide file tree
Showing 7 changed files with 449 additions and 203 deletions.
1 change: 1 addition & 0 deletions contracts/transmuter/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ impl Transmuter {
.map(|(denom, weight)| (Scope::denom(&denom).key(), weight));
let asset_group_weights_iter = pool
.asset_group_weights()?
.unwrap_or_default()
.into_iter()
.map(|(label, weight)| (Scope::asset_group(&label).key(), weight));

Expand Down
4 changes: 3 additions & 1 deletion contracts/transmuter/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_std::{
CheckedFromRatioError, CheckedMultiplyRatioError, Coin, ConversionOverflowError, Decimal,
DivideByZeroError, OverflowError, StdError, Timestamp, Uint128, Uint64,
DecimalRangeExceeded, DivideByZeroError, OverflowError, StdError, Timestamp, Uint128, Uint64,
};
use thiserror::Error;

Expand Down Expand Up @@ -209,6 +209,8 @@ pub enum ContractError {
#[error("{0}")]
ConversionOverflowError(#[from] ConversionOverflowError),

#[error("{0}")]
DecimalRangeExceeded(#[from] DecimalRangeExceeded),
#[error("{0}")]
MathError(#[from] MathError),

Expand Down
2 changes: 1 addition & 1 deletion contracts/transmuter/src/limiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ macro_rules! assert_reset_change_limiters_by_scope {
.into_iter()
.collect::<std::collections::HashMap<_, _>>();

let asset_group_weights = pool.asset_group_weights().unwrap();
let asset_group_weights = pool.asset_group_weights().unwrap().unwrap_or_default();

let limiters = $transmuter
.limiters
Expand Down
Loading

0 comments on commit 21d909a

Please sign in to comment.