Table of Contents

Struct CcdAmount

Namespace
Concordium.Sdk.Types
Assembly
Concordium.Sdk.dll

Represents a CCD amount.

Note that 1_000_000 µCCD is equal to 1 CCD.

public readonly record struct CcdAmount : IEquatable<CcdAmount>
Implements
Inherited Members

Fields

BytesLength

Byte length of CcdAmount integral numeric type.

public const uint BytesLength = 8

Field Value

uint

MicroCcdPerCcd

Conversion factor, 1_000_000 µCCD = 1 CCD.

public const ulong MicroCcdPerCcd = 1000000

Field Value

ulong

Properties

Value

The amount in µCCD.

public ulong Value { get; init; }

Property Value

ulong

Zero

Zero amount.

public static CcdAmount Zero { get; }

Property Value

CcdAmount

Methods

FromCcd(ulong)

Creates an instance from a CCD amount represented by an integer.

public static CcdAmount FromCcd(ulong ccd)

Parameters

ccd ulong

CCD amount represented by an integer.

Returns

CcdAmount

Exceptions

ArgumentException

The CCD amount in µCCD does not fit in ulong

FromMicroCcd(ulong)

Creates an instance from a µCCD amount represented as an integer.

public static CcdAmount FromMicroCcd(ulong microCcd)

Parameters

microCcd ulong

µCCD amount represented as an integer.

Returns

CcdAmount

GetFormattedCcd()

Get a formatted string representing the amount in CCD.

public string GetFormattedCcd()

Returns

string

GetFormattedMicroCcd()

Get a formatted string representing the amount in µCCD.

public string GetFormattedMicroCcd()

Returns

string

Max(CcdAmount, CcdAmount)

Return the largest of two amounts.

public static CcdAmount Max(CcdAmount first, CcdAmount second)

Parameters

first CcdAmount
second CcdAmount

Returns

CcdAmount

ToBytes()

Copies the CCD amount represented in big-endian format to byte array.

public byte[] ToBytes()

Returns

byte[]

TryDeserial(ReadOnlySpan<byte>, out (CcdAmount? Amount, string? Error))

Create a CCD amount from a byte array.

public static bool TryDeserial(ReadOnlySpan<byte> bytes, out (CcdAmount? Amount, string? Error) output)

Parameters

bytes ReadOnlySpan<byte>

The serialized CCD amount.

output (CcdAmount? Amount, string Error)

Where to write the result of the operation.

Returns

bool

Operators

operator +(CcdAmount, CcdAmount)

Add CCD amounts.

public static CcdAmount operator +(CcdAmount a, CcdAmount b)

Parameters

a CcdAmount
b CcdAmount

Returns

CcdAmount

Exceptions

ArgumentException

The result odoes not fit in ulong

operator >(CcdAmount, CcdAmount)

Determines whether one CcdAmount is greater than a second CcdAmount.

public static bool operator >(CcdAmount left, CcdAmount right)

Parameters

left CcdAmount
right CcdAmount

Returns

bool

operator >=(CcdAmount, CcdAmount)

Determines whether one CcdAmount is greater or equal than a second CcdAmount.

public static bool operator >=(CcdAmount left, CcdAmount right)

Parameters

left CcdAmount
right CcdAmount

Returns

bool

operator <(CcdAmount, CcdAmount)

Determines whether one CcdAmount is less than a second CcdAmount.

public static bool operator <(CcdAmount left, CcdAmount right)

Parameters

left CcdAmount
right CcdAmount

Returns

bool

operator <=(CcdAmount, CcdAmount)

Determines whether one CcdAmount is less or equal than a second CcdAmount.

public static bool operator <=(CcdAmount left, CcdAmount right)

Parameters

left CcdAmount
right CcdAmount

Returns

bool

operator -(CcdAmount, CcdAmount)

Subtract CCD amounts.

public static CcdAmount operator -(CcdAmount a, CcdAmount b)

Parameters

a CcdAmount
b CcdAmount

Returns

CcdAmount

Exceptions

ArgumentException

The result does not fit in ulong