INNER CODE UNIT · Rust
repr_bigint
renegade-fi/renegade · crates/circuits/circuit-types/src/lib.rs:137
let repr_bigint = (BigUint::from(1u8) << PRICE_BITS) - 1u8;
let repr = biguint_to_scalar(&repr_bigint);
FixedPoint::from_repr(repr)
}
/// Get the maximum representable amount
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;