ArithmeticError
Variant 29 v393sp_arithmetic::ArithmeticError
About This Type
Error from arithmetic operations: Overflow, Underflow, or DivisionByZero.
Returned when on-chain math produces an invalid result. Part of DispatchError.
Variants (3)
| Index | Name | Fields | Docs |
|---|---|---|---|
| 0 | Underflow | none | |
| 1 | Overflow | none | |
| 2 | DivisionByZero | none |
SCALE Encoding
- Rule
- 1-byte variant index followed by variant-specific field data. 3 possible variants.
- Size
- variable (1+ bytes)
Examples
Underflow
0x0000 Variant index 0 = UnderflowOverflow
0x0101 Variant index 1 = OverflowDivisionByZero
0x0202 Variant index 2 = DivisionByZeroCode Examples
import { TypeRegistry } from "@polkadot/types";
const registry = new TypeRegistry();
// Encode ArithmeticError — variant "Underflow"
const value = registry.createType("ArithmeticError", "Underflow");
console.log("Hex:", value.toHex());Referenced By (1)
Type Information
- Type ID
- 29
- Kind
- Variant
- Path
- sp_arithmetic::ArithmeticError
- Runtime
- v393