corda / net.corda.core.contracts / FungibleAsset

FungibleAsset

interface FungibleAsset<T : Any> : FungibleState<Issued<T>>, 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

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.

abstract val amount: Amount<Issued<T>>

exitKeys

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.

abstract val exitKeys: Collection<PublicKey>

Functions

withNewOwnerAndAmount

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

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

Extension Functions

hash

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

fun ContractState.hash(): SecureHash

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

fun ContractState.hash(algorithm: String): SecureHash