com.r3corda.contracts.clause / AbstractConserveAmount

# AbstractConserveAmount

`abstract class AbstractConserveAmount<S : FungibleAsset<T>, C : CommandData, T : Any> : Clause<S, C, 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.

### Inherited Properties

requiredCommands | `open val requiredCommands: Set<Class<out CommandData>>` Determine whether this clause runs or not

### Functions

generateExit | `fun generateExit(tx: TransactionBuilder, amountIssued: Amount<Issued<T>>, assetStates: List<StateAndRef<S>>, deriveState: (TransactionState<S>, Amount<Issued<T>>, PublicKey) -> TransactionState<S>, generateMoveCommand: () -> CommandData, generateExitCommand: (Amount<Issued<T>>) -> CommandData): PublicKey` Generate an transaction exiting fungible assets from the ledger.
toString | `open fun toString(): String`
verify | `open fun verify(tx: TransactionForContract, inputs: List<S>, outputs: List<S>, commands: List<AuthenticatedObject<C>>, groupingKey: Issued<T>?): Set<C>` Verify the transaction matches the conditions from this clause. For example, a "no zero amount output" clause would check each of the output states that it applies to, looking for a zero amount, and throw IllegalStateException if any matched.

### Extension Functions

matches | `fun <C : CommandData> Clause<*, C, *>.matches(commands: List<AuthenticatedObject<C>>): Boolean` Determine if the given list of commands matches the required commands for a clause to trigger.

### Inheritors

ConserveAmount | `class ConserveAmount : AbstractConserveAmount<State, Commands, Currency>`
ConserveAmount | `class ConserveAmount : AbstractConserveAmount<State, Commands, Commodity>` Standard clause for conserving the amount from input to output.
ConserveAmount | `class ConserveAmount<P> : AbstractConserveAmount<State<P>, Commands, Terms<P>>` Generic move/exit clause for fungible assets