corda / net.corda.contracts.asset

## Package net.corda.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 couldn't 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 couldn't 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: PartyAndReference` A dummy, randomly generated issuer party by the name of "Snake Oil Issuer"
DUMMY_CASH_ISSUER_KEY | `val DUMMY_CASH_ISSUER_KEY: KeyPair` A randomly generated key.
DUMMY_OBLIGATION_ISSUER | `val DUMMY_OBLIGATION_ISSUER: Party` A dummy, randomly generated issuer party by the name of "Snake Oil Issuer"
DUMMY_OBLIGATION_ISSUER_KEY | `val DUMMY_OBLIGATION_ISSUER_KEY: KeyPair` 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: Pair<AbstractParty, CompositeKey>): State<T>`
extractAmountsDue | `fun <P> extractAmountsDue(product: Terms<P>, states: Iterable<State<P>>): Map<Pair<CompositeKey, CompositeKey>, 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: AbstractParty): State` `infix fun State.issued by(deposit: PartyAndReference): State` `infix fun <T> State<T>.issued by(party: AbstractParty): State<T>`
issuedBy | `fun State.issuedBy(party: AbstractParty): State` `fun State.issuedBy(deposit: PartyAndReference): State` `fun <T> State<T>.issuedBy(party: AnonymousParty): State<T>`
netAmountsDue | `fun <P> netAmountsDue(balances: Map<Pair<CompositeKey, CompositeKey>, Amount<P>>): Map<Pair<CompositeKey, CompositeKey>, Amount<P>>` Net off the amounts due between parties.
owned by | `infix fun State.owned by(owner: CompositeKey): State` `infix fun <T> State<T>.owned by(owner: CompositeKey): State<T>`
ownedBy | `fun State.ownedBy(owner: CompositeKey): State` `fun <T> State<T>.ownedBy(owner: CompositeKey): State<T>`
sumAmountsDue | `fun <P> sumAmountsDue(balances: Map<Pair<CompositeKey, CompositeKey>, Amount<P>>): Map<CompositeKey, 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`