Struct Currency
Represents a currency type. Every single value of Currency defines a distinct currency type. To draw a parallel with real world monetary, each Currency value represents such currencies as USD (US Dollar) or EUR (Euro), not values like $100 or €100.
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public struct Currency : ISerializable, IEquatable<Currency>
Constructors
| Improve this Doc View SourceCurrency(String, Nullable<IImmutableSet<Address>>)
Defines a Currency type.
Declaration
public Currency(string ticker, IImmutableSet<Address>? minters)
Parameters
Type | Name | Description |
---|---|---|
String | ticker | The ticker symbol, e.g., |
Nullable<IImmutableSet<Address>> | minters | The Addresses who can mint the currency. See also Minters field which corresponds to this. |
Currency(String, Nullable<Address>)
Defines a Currency type.
Declaration
public Currency(string ticker, Address? minter)
Parameters
Type | Name | Description |
---|---|---|
String | ticker | The ticker symbol, e.g., |
Nullable<Address> | minter | The address who can mint the currency. To specify multiple
minters, use the |
Fields
| Improve this Doc View SourceHash
The deterministic hash derived from other fields.
Declaration
public readonly HashDigest<SHA1> Hash
Field Value
Type | Description |
---|---|
HashDigest<SHA1> |
Minters
The Addresses who can mint the currency.
If this is null
anyone can mint the currency.
Declaration
public readonly IImmutableSet<Address>? Minters
Field Value
Type | Description |
---|---|
Nullable<IImmutableSet<Address>> |
Remarks
Unlike null
, an empty set means no one can mint the currency.
See Also
| Improve this Doc View SourceTicker
The ticker symbol, e.g., "USD"
.
Declaration
public readonly string Ticker
Field Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceAllowsToMint(Address)
Returns true
if and only if the given address
is allowed
to mint or burn assets of this currency.
Declaration
public bool AllowsToMint(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The account address to test. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(Currency)
Declaration
public bool Equals(Currency other)
Parameters
Type | Name | Description |
---|---|---|
Currency | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Nullable<Object>)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Object> | obj |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
GetObjectData(SerializationInfo, StreamingContext)
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | |
StreamingContext | context |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |