Issue Description:
Implement several functions in the OracleUtils library to enhance its functionality and provide associated unit tests.
Function 1: validate_block_number_within_range
/// Validates whether a block number is within the specified range.
/// # Arguments
/// * `min_oracle_block_numbers` - The minimum oracle block numbers allowed.
/// * `max_oracle_block_numbers` - The maximum oracle block numbers allowed.
/// * `block_number` - The block number to compare.
fn validate_block_number_within_range(
min_oracle_block_numbers: Array<u128>,
max_oracle_block_numbers: Array<u128>,
block_number: u128,
) {
// Implement the logic to validate the block number here
}
/// Unit Test
#[test]
fn test_validate_block_number_within_range() {
let min_oracle_block_numbers = [1, 2, 3];
let max_oracle_block_numbers = [10, 20, 30];
let block_number = 15;
assert!(validate_block_number_within_range(min_oracle_block_numbers, max_oracle_block_numbers, block_number));
}
Function 2: is_block_number_within_range
/// Validates whether a block number is within the specified range.
/// # Arguments
/// * `min_oracle_block_numbers` - The minimum oracle block numbers allowed.
/// * `max_oracle_block_numbers` - The maximum oracle block numbers allowed.
/// * `block_number` - The block number to compare.
/// # Returns
/// True if block_number is in range, false otherwise.
fn is_block_number_within_range(
min_oracle_block_numbers: Array<u128>,
max_oracle_block_numbers: Array<u128>,
block_number: u128,
) -> bool {
// Implement the logic to check if the block number is within the range
// Return true if it is, false otherwise
}
Function 3: get_uncompacted_price
/// Get the uncompacted price at the specified index.
/// # Arguments
/// * `compacted_prices` - The compacted prices.
/// * `index` - The index to get the decimal at.
/// # Returns
/// The price at the specified index.
fn get_uncompacted_price(compacted_prices: Array<u128>, index: u128) -> u128 {
// Implement the logic to retrieve the uncompacted price
}
Function 4: get_uncompacted_decimal
/// Get the uncompacted decimal at the specified index.
/// # Arguments
/// * `compacted_decimals` - The compacted decimals.
/// * `index` - The index to get the decimal at.
/// # Returns
/// The decimal at the specified index.
fn get_uncompacted_decimal(compacted_decimals: Array<u128>, index: u128) -> u128 {
// Implement the logic to retrieve the uncompacted decimal
}
Issue Description: Implement several functions in the OracleUtils library to enhance its functionality and provide associated unit tests.
Function 1: validate_block_number_within_range
Function 2: is_block_number_within_range
Function 3: get_uncompacted_price
Function 4: get_uncompacted_decimal