Skip to main content

decimal_to_scaled_u256

Function decimal_to_scaled_u256 

Source
pub fn decimal_to_scaled_u256(value: Decimal) -> Result<U256, &'static str>
Expand description

Scales a [Decimal] amount to a 1e18 fixed-point [U256].

Used for unsigned fields like max_fee where negative amounts are not meaningful and the venue rejects negative encodings.

ยงErrors

Returns an error string if the value is negative or exceeds the unsigned 256-bit range after scaling.