com.r3corda.contracts.clause / AbstractConserveAmount

AbstractConserveAmount

abstract class AbstractConserveAmount<S : FungibleAsset<T>, T : Any> : GroupClause<S, Issued<T>>

Standardised clause for checking input/output balances of fungible assets. Requires that a Move command is provided, and errors if absent. Must be the last clause under a grouping clause; errors on no-match, ends on match.



Constructors

<init> AbstractConserveAmount()

Standardised clause for checking input/output balances of fungible assets. Requires that a Move command is provided, and errors if absent. Must be the last clause under a grouping clause; errors on no-match, ends on match.

Properties

ifMatched open val ifMatched: MatchBehaviour

Behaviour if this clause is not matches

ifNotMatched open val ifNotMatched: MatchBehaviour

Behaviour if this clause is matched

requiredCommands open val requiredCommands: Set<Class<out CommandData>>

Classes for commands which must ALL be present in transaction for this clause to be triggered

Functions

generateExit fun generateExit(tx: TransactionBuilder, amountIssued: Amount<Issued<T>>, changeKey: PublicKey, assetStates: List<StateAndRef<S>>, deriveState: (TransactionState<S>, Amount<Issued<T>>, PublicKey) -> TransactionState<S>, generateExitCommand: (Amount<Issued<T>>) -> CommandData): PublicKey

Generate an transaction exiting fungible assets from the ledger.

generateSpend fun generateSpend(tx: TransactionBuilder, amount: Amount<T>, to: PublicKey, assetsStates: List<StateAndRef<S>>, onlyFromParties: Set<Party>? = null, deriveState: (TransactionState<S>, Amount<Issued<T>>, PublicKey) -> TransactionState<S>, generateMoveCommand: () -> CommandData): List<PublicKey>

Generate a transaction that consumes one or more of the given input states to move assets to the given pubkey. Note that the wallet list is not updated: its up to you to do that.

verify open fun verify(tx: TransactionForContract, inputs: List<S>, outputs: List<S>, commands: Collection<AuthenticatedObject<CommandData>>, token: Issued<T>): Set<CommandData>

Inheritors

ConserveAmount class ConserveAmount : AbstractConserveAmount<State, Currency>
ConserveAmount class ConserveAmount : AbstractConserveAmount<State, Commodity>

Standard clause for conserving the amount from input to output.

ConserveAmount class ConserveAmount<P> : AbstractConserveAmount<State<P>, Terms<P>>

Generic move/exit clause for fungible assets