Balance
public struct Balance
extension Balance: Equatable
extension Balance: Hashable
extension Balance: CustomStringConvertible
-
Declaration
Swift
public let amountPicoMobLow: UInt64
-
Declaration
Swift
public let amountPicoMobHigh: UInt8
-
Declaration
Swift
public func amountPicoMob() -> UInt64?
Return Value
nil
when the amount is too large to fit in aUInt64
. -
Convenience accessor for balance value.
mobInt
is the integer part of the value when represented in MOB.picoFrac
is the fractional part of the value when represented in MOB. However, rather than reprenting the fractional part as a decimal fraction, it is represented in picoMOB, thus allowing both parts to be integer values.The purpose of this representation is to facilitate presenting the balance to the user in MOB form.
To illustrate, given an amount in the form of XXXXXXXXX.YYYYYYYYYYYY MOB,
mobInt
: XXXXXXXXX (denominated in MOB)picoFrac
: YYYYYYYYYYYY (denominated in picoMOB)
It is necessary to break apart the values into 2 parts because the total max possible balance is too large to fit in a single
UInt64
, when denominated in picoMOB, assuming 250 million MOB in circulation and assuming a base unit of 1 picoMOB as the smallest indivisible unit of MOB.Declaration
Swift
public var amountMobParts: (mobInt: UInt32, picoFrac: UInt64) { get }
-
Declaration
Swift
public var description: String { get }