INNER CODE UNIT · Rust

max_amount

renegade-fi/renegade · crates/circuits/circuit-types/src/lib.rs:143

pub fn max_amount() -> Amount {
    (1u128 << AMOUNT_BITS) - 1
}

/// The maximum fee rate allowed by the protocol
pub fn maximum_fee() -> FixedPoint {
    FixedPoint::from_f64_round_down(MAX_RELAYER_FEE_RATE)
}

/// Verify that an amount is within the correct bitlength
pub fn validate_amount_bitlength(amount: Amount) -> bool {
    let max_amount = (1u128 << AMOUNT_BITS) - 1;
    amount <= max_amount
}

/// Verify that a price is within the correct bitlength
pub fn validate_price_bitlength(price: FixedPoint) -> bool {
    let max_repr = (1u128 << PRICE_BITS) - 1;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…