corda / net.corda.core.contracts / FungibleAsset

FungibleAsset

interface FungibleAsset<T : Any> : OwnableState

Interface for contract states representing assets which are fungible, countable and issued by a specific party. States contain assets which are equivalent (such as cash of the same currency), so records of their existence can be merged or split as needed where the issuer is the same. For instance, dollars issued by the Fed are fungible and countable (in cents), barrels of West Texas crude are fungible and countable (oil from two small containers can be poured into one large container), shares of the same class in a specific company are fungible and countable, and so on.

An example usage would be a cash transaction contract that implements currency using state objects that implement this interface.

Parameters

T - a type that represents the asset in question. This should describe the basic type of the asset (GBP, USD, oil, shares in company , etc.) and any additional metadata (issuer, grade, class, etc.).

Properties

amount

abstract val amount: Amount<Issued<T>>

Amount represents a positive quantity of some issued product which can be cash, tokens, assets, or generally anything else that's quantifiable with integer quantities. See Issued and Amount for more details.

exitKeys

abstract val exitKeys: Collection<PublicKey>

There must be an ExitCommand signed by these keys to destroy the amount. While all states require their owner to sign, some (i.e. cash) also require the issuer.

Inherited Properties

owner

abstract val owner: AbstractParty

There must be a MoveCommand signed by this key to claim the amount.

Functions

withNewOwnerAndAmount

abstract fun withNewOwnerAndAmount(newAmount: Amount<Issued<T>>, newOwner: AbstractParty): FungibleAsset<T>

Copies the underlying data structure, replacing the amount and owner fields with the new values and leaving the rest (exitKeys) alone.

Inherited Functions

withNewOwner

abstract fun withNewOwner(newOwner: AbstractParty): CommandAndState

Copies the underlying data structure, replacing the owner field with this new value and leaving the rest alone.

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.

hash

fun ContractState.hash(): SecureHash

Returns the SHA-256 hash of the serialised contents of this state (not cached!)

Inheritors

State

data class State : FungibleAsset<Currency>, QueryableState

A state representing a cash claim against some party.

State

data class State<P : Any> : FungibleAsset<Terms<P>>, NettableState<State<P>, MultilateralNetState<P>>

A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.