com.r3corda.contracts.asset

## Package com.r3corda.contracts.asset

### Types

Cash | `class Cash : OnLedgerAsset<Currency, Commands, State>` 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.
CommodityContract | `class CommodityContract : OnLedgerAsset<Commodity, Commands, State>` A commodity contract represents an amount of some commodity, tracked on a distributed ledger. The design of this contract is intentionally similar to the Cash contract, and the same commands (issue, move, exit) apply, the differences are in representation of the underlying commodity. Issuer in this context means the party who has the commodity, or is otherwise responsible for delivering the commodity on demand, and the deposit reference is use for internal accounting by the issuer (it might be, for example, a warehouse and/or location within a warehouse).
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.
OnLedgerAsset | `abstract class OnLedgerAsset<T : Any, C : CommandData, S : FungibleAsset<T>> : Contract` An asset transaction may split and merge assets 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.

### 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`
COMMODITY_PROGRAM_ID | `val COMMODITY_PROGRAM_ID: CommodityContract`
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.
DUMMY_OBLIGATION_ISSUER | `val DUMMY_OBLIGATION_ISSUER: <ERROR CLASS>` A dummy, randomly generated issuer party by the name of "Snake Oil Issuer"
DUMMY_OBLIGATION_ISSUER_KEY | `val DUMMY_OBLIGATION_ISSUER_KEY: <ERROR CLASS>` A randomly generated key.
OBLIGATION | `val Amount<Issued<Currency>>.OBLIGATION: State<Currency>`
OBLIGATION_DEF | `val Issued<Currency>.OBLIGATION_DEF: Terms<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

### Functions

at | `infix fun <T> State<T>.at(dueBefore: Instant): State<T>`
between | `infix fun <T> State<T>.between(parties: <ERROR CLASS><Party, PublicKey>): State<T>`
extractAmountsDue | `fun <P> extractAmountsDue(product: Terms<P>, states: Iterable<State<P>>): Map<<ERROR CLASS><PublicKey, PublicKey>, Amount<Terms<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`