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. |
InsufficientBalanceException |
class InsufficientBalanceException : Exception |
kotlin.collections.Iterable |
CASH_PROGRAM_ID |
val CASH_PROGRAM_ID: Cash |
OBLIGATION_PROGRAM_ID |
val OBLIGATION_PROGRAM_ID: Obligation<Currency> |
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. |
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. |
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. |
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. |