@@ -59,7 +59,7 @@ pub mod TicketBoothComponent {
5959 pub struct GoldenPass {
6060 pub cooldown : u64 , // Duration after which the pass can be used again, must be greater than 0
6161 pub game_expiration : GameExpiration , // Duration after which games minted with this pass expires
62- pub pass_expiration : u64 , // timestamp when the pass expires (becoming unusable), 0 means no expiration
62+ pub pass_expiration : u64 // timestamp when the pass expires (becoming unusable), 0 means no expiration
6363 }
6464
6565 #[event]
@@ -149,7 +149,7 @@ pub mod TicketBoothComponent {
149149 },
150150 Result :: Err (_ ) => {
151151 // burn_from failed, fall back to zero address transfer
152- let zero_address : ContractAddress = 0. try_into () . unwrap ();
152+ let zero_address : ContractAddress = starknet :: contract_address_const :: < 0 > ();
153153 let _ = payment_token . transfer_from (caller , zero_address , cost . into ());
154154 },
155155 }
@@ -192,7 +192,8 @@ pub mod TicketBoothComponent {
192192 to : ContractAddress ,
193193 soulbound : bool ,
194194 ) -> u64 {
195- assert! (get_block_timestamp () >= self . opening_time. read (), " Game not open yet" );
195+ let current_time = get_block_timestamp ();
196+ assert! (current_time >= self . opening_time. read (), " Game not open yet" );
196197
197198 let caller = get_caller_address ();
198199
@@ -201,7 +202,6 @@ pub mod TicketBoothComponent {
201202 assert! (golden_pass_config . cooldown > 0_u64 , " Golden pass not configured" );
202203
203204 // Check if the pass is expired
204- let current_time = get_block_timestamp ();
205205 if golden_pass_config . pass_expiration > 0_u64 {
206206 assert! (current_time < golden_pass_config . pass_expiration, " Golden pass expired" );
207207 }
@@ -217,7 +217,6 @@ pub mod TicketBoothComponent {
217217 let last_used = self
218218 . golden_pass_last_used
219219 . read ((golden_pass_address , golden_pass_token_id ));
220- let current_time = get_block_timestamp ();
221220
222221 assert! (
223222 current_time >= last_used + golden_pass_config . cooldown, " Golden pass on cooldown" ,
@@ -280,7 +279,7 @@ pub mod TicketBoothComponent {
280279 ) -> u64 {
281280 self . golden_pass_last_used. read ((golden_pass_address , token_id ))
282281 }
283-
282+
284283 fn ticket_receiver_address (self : @ ComponentState <TContractState >) -> ContractAddress {
285284 self . ticket_receiver_address. read ()
286285 }
@@ -350,7 +349,7 @@ pub mod TicketBoothComponent {
350349 self . cost_to_play. write (cost_to_play );
351350 match game_address {
352351 Option :: Some (addr ) => self . game_address. write (addr ),
353- Option :: None => self . game_address. write (0. try_into () . unwrap ()),
352+ Option :: None => self . game_address. write (starknet :: contract_address_const :: < 0 > ()),
354353 };
355354 self . settings_id. write (settings_id );
356355 self . start_time. write (start_time );
@@ -369,7 +368,10 @@ pub mod TicketBoothComponent {
369368 break ;
370369 }
371370 let (address , config ) = passes . at (i );
372- assert! (* config . cooldown > 0_u64 , " Golden pass cooldown must be greater than zero" );
371+ assert! (
372+ * config . cooldown > 0_u64 ,
373+ " Golden pass cooldown must be greater than zero" ,
374+ );
373375 self . golden_passes. write (* address , config . clone ());
374376 i += 1 ;
375377 };
0 commit comments