com.r3corda.contracts.asset / FungibleAsset

FungibleAsset

interface FungibleAsset<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.

See Cash for an example 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.).


Types

Commands interface Commands : CommandData

Properties

amount abstract val amount: Amount<Issued<T>>
deposit abstract val deposit: PartyAndReference

Where the underlying asset backing this ledger entry can be found. The reference is only intended for use by the issuer, and is not intended to be meaningful to others.

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.

issuanceDef abstract val issuanceDef: Issued<T>
owner abstract val owner: PublicKey

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

Functions

move abstract fun move(newAmount: Amount<Issued<T>>, newOwner: PublicKey): FungibleAsset<T>

Inherited Functions

withNewOwner abstract fun withNewOwner(newOwner: PublicKey): <ERROR CLASS><CommandData, OwnableState>

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

Extension Functions

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>

A state representing a cash claim against some party

State data class State : FungibleAsset<Commodity>

A state representing a commodity claim against some party

State data class State<P> : 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.