Skip to content

Commit

Permalink
added MAX_TICKETS_ALLOWANCE check
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Nov 22, 2024
1 parent 1225e73 commit d587001
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
multiversx_sc::imports!();
multiversx_sc::derive_imports!();

pub const MAX_TICKETS_ALLOWANCE: usize = 128;
pub const MAX_GUARANTEED_TICKETS_ENTRIES: usize = 10;

#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem)]
Expand Down Expand Up @@ -55,6 +56,10 @@ pub trait GuaranteedTicketsInitModule:

for multi_arg in address_number_pairs.into_iter() {
let (buyer, total_tickets_allowance, guaranteed_ticket_raw) = multi_arg.into_tuple();
require!(
total_tickets_allowance <= MAX_TICKETS_ALLOWANCE,
"Total number of tickets exceeds maximum allowed"
);
require!(
guaranteed_ticket_raw.len() <= MAX_GUARANTEED_TICKETS_ENTRIES,
"Number of guaranteed tickets entries exceeds maximum allowed"
Expand Down

0 comments on commit d587001

Please sign in to comment.