Skip to content

Commit

Permalink
simplify boolean condition
Browse files Browse the repository at this point in the history
  • Loading branch information
zarboq committed Nov 2, 2023
1 parent 29af1ca commit 533f8d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
10 changes: 1 addition & 9 deletions src/oracle/oracle_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,7 @@ fn revert_oracle_block_number_not_within_range(
/// # Returns
/// Wether it's the right error.
fn is_oracle_error(error_selector: felt252) -> bool {
if (is_oracle_block_number_error(error_selector)) {
return true;
}

if (is_empty_price_error(error_selector)) {
return true;
}

return false;
is_oracle_block_number_error(error_selector) || is_empty_price_error(error_selector)
}

/// Check wether `error` is an EmptyPriceError.
Expand Down
12 changes: 4 additions & 8 deletions src/utils/arrays.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,10 @@ fn are_lte(mut arr: Span<u128>, value: u128) -> bool {
fn are_lte_u64(mut arr: Span<u64>, value: u64) -> bool {
loop {
match arr.pop_front() {
Option::Some(item) => {
if *item > value {
break false;
}
},
Option::None => {
break true;
},
Option::Some(item) => { if *item > value {
break false;
} },
Option::None => { break true; },
};
}
}
Expand Down

0 comments on commit 533f8d2

Please sign in to comment.