Coin

scalus.cardano.ledger.Coin
See theCoin companion object
final case class Coin(value: Long)

Represents an amount of Cardano's native currency (ADA)

On the wire a coin is unsigned (Conway CDDL coin = uint), and the CBOR decoder rejects negative values. The constructor deliberately allows negative amounts: balancing and Value arithmetic produce transient negative differences.

Arithmetic throws ArithmeticException when the result does not fit in a Long, rather than wrapping around: a wrapped sum would be a wrong amount.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

infix def +(other: Coin): Coin

Add another coin amount

Add another coin amount

Attributes

infix def -(other: Coin): Coin

Subtract another coin amount

Subtract another coin amount

Attributes

infix def <(other: Coin): Boolean
infix def <=(other: Coin): Boolean
infix def >(other: Coin): Boolean
infix def >=(other: Coin): Boolean
def isZero: Boolean
def nonZero: Boolean
def unary_-: Coin

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product