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].

Mirrors derive_action_signing/utils.py::decimal_to_big_int. 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 HexConstError is not actually used here; we return a plain &'static str describing overflow when the scaled value exceeds the signed-256-bit range.