Skip to content

Commit c290f83

Browse files
committed
Fix cosmwasm/optimizer build errors
1 parent 626f708 commit c290f83

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

contracts/asset/src/default_plugins.rs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,18 @@ pub fn not_after_plugin(ctx: &mut PluginCtx<DefaultXionAssetContext, Empty>) ->
105105
// can be made that exceeds 1 week from now
106106
// this is to prevent an indefinite reservation that exceeds the time lock
107107
pub fn time_lock_plugin(ctx: &mut PluginCtx<DefaultXionAssetContext, Empty>) -> StdResult<bool> {
108-
if let Some(time_lock) = &ctx.data.time_lock
109-
&& let Some(reservation) = &ctx.data.reservation
110-
&& Expiration::AtTime(reservation.reserved_until).gt(&Expiration::AtTime(
111-
ctx.env.block.time.plus_seconds(time_lock.as_secs()),
112-
))
113-
{
114-
return Err(cosmwasm_std::StdError::generic_err(format!(
115-
"Reservation end time {} exceeds the collection time lock {}",
116-
reservation.reserved_until,
117-
Expiration::AtTime(ctx.env.block.time.plus_seconds(time_lock.as_secs()))
118-
)));
108+
if let Some(time_lock) = &ctx.data.time_lock {
109+
if let Some(reservation) = &ctx.data.reservation {
110+
if Expiration::AtTime(reservation.reserved_until).gt(&Expiration::AtTime(
111+
ctx.env.block.time.plus_seconds(time_lock.as_secs()),
112+
)) {
113+
return Err(cosmwasm_std::StdError::generic_err(format!(
114+
"Reservation end time {} exceeds the collection time lock {}",
115+
reservation.reserved_until,
116+
Expiration::AtTime(ctx.env.block.time.plus_seconds(time_lock.as_secs()))
117+
)));
118+
}
119+
}
119120
}
120121
Ok(true)
121122
}
@@ -221,20 +222,20 @@ pub fn allowed_currencies_plugin(
221222

222223
let allowed_set: HashSet<&str> = allowed.iter().map(|d| d.denom.as_str()).collect();
223224

224-
if let Some(price) = &ctx.data.ask_price
225-
&& !allowed_set.contains(price.denom.as_str())
226-
{
227-
return Err(cosmwasm_std::StdError::generic_err(
228-
"ask price currency is not allowed",
229-
));
225+
if let Some(price) = &ctx.data.ask_price {
226+
if !allowed_set.contains(price.denom.as_str()) {
227+
return Err(cosmwasm_std::StdError::generic_err(
228+
"ask price currency is not allowed",
229+
));
230+
}
230231
}
231232

232-
if let Some(min_price) = &ctx.data.min_price
233-
&& !allowed_set.contains(min_price.denom.as_str())
234-
{
235-
return Err(cosmwasm_std::StdError::generic_err(
236-
"minimum price currency is not allowed",
237-
));
233+
if let Some(min_price) = &ctx.data.min_price {
234+
if !allowed_set.contains(min_price.denom.as_str()) {
235+
return Err(cosmwasm_std::StdError::generic_err(
236+
"minimum price currency is not allowed",
237+
));
238+
}
238239
}
239240

240241
for coin in &ctx.info.funds {

contracts/asset/src/execute/reservation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ where
4040
});
4141
}
4242

43-
if let Some(reserved) = &listing.reserved
44-
&& !Expiration::AtTime(reserved.reserved_until).is_expired(&env.block)
45-
{
46-
return Err(ContractError::ReservedAsset { id: id.clone() });
43+
if let Some(reserved) = &listing.reserved {
44+
if !Expiration::AtTime(reserved.reserved_until).is_expired(&env.block) {
45+
return Err(ContractError::ReservedAsset { id: id.clone() });
46+
}
4747
}
4848

4949
let reserver = if let Some(reserver) = reservation.reserver {

0 commit comments

Comments
 (0)