Skip to main content

decimal_to_scaled_i256

Function decimal_to_scaled_i256 

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

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

Rejects inputs beyond 12 fractional digits. Negative amounts are supported because the venue uses signed integers for fields like limit_price and amount (sells are encoded as positive amounts but other action variants use signed magnitudes).

ยงErrors

Returns an error if the input exceeds the accepted precision or the scaled value exceeds the signed 256-bit range.