FixedU128

Composite 56 v411

substrate_fixed::FixedU128

About This Type

Unsigned binary fixed-point integer with `.bits` codec (substrate-fixed).

Substrate-fixed FixedU128<Frac>, commonly U64F64. Inner storage is `bits: u128`; real value = bits / 2^Frac where Frac is the use-site fractional bit count.

Encoding: Unsigned substrate-fixed `.bits` codec. Real value = bits / 2^Frac, where Frac is the binary fractional bit count from the use-site type parameter (e.g. U64F64 → Frac=64). NOT decimal accuracy.

For U64F64 (Frac=64): real = bits / 2^64.

Common Uses

  • • Share-pool ratios in stake-swap accounting
  • • Unsigned smoothing factors

Fields (1)

#NameType
0bitsu128

SCALE Encoding

Rule
1 field encoded consecutively in declaration order. No field names or delimiters.
Size
sum of field sizes

Examples

Struct with 1 field = bits: u128
0x<field0>
field 0 bits: u128

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode FixedU128
const value = registry.createType("FixedU128", {
  bits: 1_000_000_000n
});
console.log("Hex:", value.toHex());

Type Parameters

Frac = UInt

Referenced By (5)

Type Information

Type ID
56
Kind
Composite
Path
substrate_fixed::FixedU128
Runtime
v411