Struct Amount

Defines a monetary type used in the blockchain

struct Amount ;

Constructors

NameDescription
this (units) Construct an instance of an Amount
this (other) Copy constructor

Fields

NameTypeDescription
MaxCoinSupply immutable(ulong)Maximum number of BOA coins that can ever be in circulation
MaxUnitSupply immutable(Amount)Maximum amount of money that can ever be in circulation
MinFreezeAmount immutable(Amount)Exact amount that needs to be staked to make a freezing transaction
UnitPerCoin immutable(Amount)Number of units ('cents') per coins

Methods

NameDescription
add (other) Add another value to this Amount
count (other) Count how many other can be paid by this
decimal ()
div (denominator) Divide this Amount into denominator equal parts and returns the remainder
fromString (str) Support for Vibe.d deserialization
gcd (ams)
integral ()
isInRange (value)
isValid () isInRange but as member function
mul (multiplier) Multiply this Amount by multiplier
mustPercentage (pct) Take a percentage of the value and assert if the result is invalid
opBinary (other) Operator overloads that will throw in case of over or underflow.
opCmp (other) Support for comparison
opOpAssign (other) Convenience version of add which throws in case of overflow Prefer using this only in unittests
opOpAssign (other) Convenience version of sub which asserts in case of underflow Prefer using this only in unittests
percentage (pct) Take a percentage of the value
proportionalFee (proportional_fee) Calculate how much proportional fee should be paid for this with the given proportional_fee
sub (other) Substract another value from this Amount
toString (dg) Pretty-print this value
toString () Also support for Vibe.d serialization to JSON