Skip to content

Commit

Permalink
fix(pcl): return price scale if circular buffer is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
epanchee committed Mar 13, 2024
1 parent 9deae4c commit ce7dad6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/pair_concentrated/src/queries.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use astroport::asset::{native_asset_info, Asset, AssetInfo, AssetInfoExt};
use astroport::cosmwasm_ext::{DecimalToInteger, IntegerToDecimal};
use astroport::observation::query_observation;
use astroport::observation::{query_observation, try_dec256_into_dec};
use astroport::pair::{
ConfigResponse, PoolResponse, ReverseSimulationResponse, SimulationResponse,
};
Expand Down Expand Up @@ -148,7 +148,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
observation.price.inv().unwrap_or_default()
}
})
.unwrap_or(Decimal::zero());
.or_else(|_| try_dec256_into_dec(config.pool_state.price_state.price_scale))?;

to_json_binary(&SpotPriceResponse { spot_price })
}
Expand Down

0 comments on commit ce7dad6

Please sign in to comment.