Const
Returns a new amount that is the union of both leftAmount and rightAmount.
For fungible amount this means adding the values. For other kinds of amount, it usually means including all of the elements from both left and right.
Make sure this amount is valid enough, and return a corresponding valid amount if so.
Extract and return the value.
Return true if the Amount is empty. Otherwise false.
Returns true if the leftAmount equals the rightAmount. We assume that if isGTE is true in both directions, isEqual is also true
Returns true if the leftAmount is greater than or equal to the rightAmount. The notion of "greater than or equal to" depends on the kind of amount, as defined by the MathHelpers. For example, whether rectangle A is greater than rectangle B depends on whether rectangle A includes rectangle B as defined by the logic in MathHelpers.
Make an amount from a value by adding the brand.
Does not verify that the Brand's AssetKind matches the value's.
Return the amount representing an empty amount. This is the identity element for MathHelpers.add and MatHelpers.subtract.
Return the amount representing an empty amount, using another amount as the template for the brand and assetKind.
Returns the max value between x and y using isGTE
Returns the min value between x and y using isGTE
Returns a new amount that is the leftAmount minus the rightAmount (i.e. everything in the leftAmount that is not in the rightAmount). If leftAmount doesn't include rightAmount (subtraction results in a negative), throw an error. Because the left amount must include the right amount, this is NOT equivalent to set subtraction.
Logic for manipulating amounts.
Amounts are the canonical description of tradable goods. They are manipulated by issuers and mints, and represent the goods and currency carried by purses and payments. They can be used to represent things like currency, stock, and the abstract right to participate in a particular exchange.