com.r3corda.contracts.asset

Package com.r3corda.contracts.asset

Types

Cash class Cash : FungibleAsset<Currency>

A cash transaction may split and merge money represented by a set of (issuer, depositRef) pairs, across multiple input and output states. Imagine a Bitcoin transaction but in which all UTXOs had a colour (a blend of issuer+depositRef) and you couldnt merge outputs of two colours together, but you COULD put them in the same transaction.

FungibleAsset abstract class FungibleAsset<T> : Contract

Superclass for contracts 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.

FungibleAssetState interface FungibleAssetState<T, I> : OwnableState

Common elements of cash contract states.

Obligation class Obligation<P> : Contract

An obligation contract commits the obligor to delivering a specified amount of a fungible asset (for example the Cash contract) at a specified future point in time. Settlement transactions may split and merge contracts across multiple input and output states. The goal of this design is to handle amounts owed, and these contracts are expected to be netted/merged, with settlement only for any remainder amount.

Exceptions

InsufficientBalanceException class InsufficientBalanceException : Exception

Extensions for External Classes

kotlin.collections.Iterable

Properties

CASH val Amount<Currency>.CASH: State

An extension property that lets you write 100.DOLLARS.CASH

CASH_PROGRAM_ID val CASH_PROGRAM_ID: Cash
DUMMY_CASH_ISSUER val DUMMY_CASH_ISSUER: <ERROR CLASS>

A dummy, randomly generated issuer party by the name of "Snake Oil Issuer"

DUMMY_CASH_ISSUER_KEY val DUMMY_CASH_ISSUER_KEY: <ERROR CLASS>

A randomly generated key.

OBLIGATION val Amount<Issued<Currency>>.OBLIGATION: State<Currency>
OBLIGATION_DEF val Issued<Currency>.OBLIGATION_DEF: StateTemplate<Currency>
OBLIGATION_PROGRAM_ID val OBLIGATION_PROGRAM_ID: Obligation<Currency>
STATE val Amount<Issued<Currency>>.STATE: State

An extension property that lets you get a cash state from an issued token, under the NullPublicKey

cashBalances val Wallet.cashBalances: Map<Currency, Amount<Currency>>

Returns a map of how much cash we have in each currency, ignoring details like issuer. Note: currencies for which we have no cash evaluate to null (not present in map), not 0.

Functions

at infix fun <T> State<T>.at(dueBefore: Instant): State<T>
infix fun <T> IssuanceDefinition<T>.at(dueBefore: Instant): IssuanceDefinition<T>
between infix fun <T> State<T>.between(parties: <ERROR CLASS><Party, PublicKey>): State<T>
extractAmountsDue fun <P> extractAmountsDue(product: P, states: Iterable<State<P>>): Map<<ERROR CLASS><PublicKey, PublicKey>, Amount<P>>

Convert a list of settlement states into total from each obligor to a beneficiary.

issued by infix fun State.issued by(party: Party): State
infix fun State.issued by(deposit: PartyAndReference): State
infix fun <T> State<T>.issued by(party: Party): State<T>
issuedBy fun State.issuedBy(party: Party): State
fun State.issuedBy(deposit: PartyAndReference): State
fun <T> State<T>.issuedBy(party: Party): State<T>
netAmountsDue fun <P> netAmountsDue(balances: Map<<ERROR CLASS><PublicKey, PublicKey>, Amount<P>>): Map<<ERROR CLASS><PublicKey, PublicKey>, Amount<P>>

Net off the amounts due between parties.

owned by infix fun State.owned by(owner: PublicKey): State
infix fun <T> State<T>.owned by(owner: PublicKey): State<T>
ownedBy fun State.ownedBy(owner: PublicKey): State
fun <T> State<T>.ownedBy(owner: PublicKey): State<T>
sumAmountsDue fun <P> sumAmountsDue(balances: Map<<ERROR CLASS><PublicKey, PublicKey>, Amount<P>>): Map<PublicKey, Long>

Calculate the total balance movement for each party in the transaction, based off a summary of balances between each obligor and beneficiary.

with deposit infix fun State.with deposit(deposit: PartyAndReference): State
withDeposit fun State.withDeposit(deposit: PartyAndReference): State