@@ -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
107107pub 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 {
0 commit comments