net.corda.contracts.clause

## Class AbstractConserveAmount<S extends FungibleAsset<T>,C extends CommandData,T>

- Clause
- - net.corda.contracts.clause.AbstractConserveAmount<S,C,T>

- Direct Known Subclasses:
    Clauses.ConserveAmount, Clauses.ConserveAmount, Clauses.ConserveAmount

      public class AbstractConserveAmount<S extends FungibleAsset<T>,C extends CommandData,T>
      extends Clause

  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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.corda.core.contracts.clauses.Clause

      `Clause.Companion`

  - ### Field Summary

    - ### Fields inherited from class net.corda.core.contracts.clauses.Clause

      `Companion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CompositeKey` | `generateExit(TransactionBuilder tx, Amount<net.corda.core.contracts.Issued> amountIssued, java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends S>> assetStates, kotlin.jvm.functions.Function3<? super net.corda.core.contracts.TransactionState<? extends S>,? super net.corda.core.contracts.Amount<net.corda.core.contracts.Issued<T>>,? super net.corda.core.crypto.CompositeKey,? extends net.corda.core.contracts.TransactionState<? extends S>> deriveState, kotlin.jvm.functions.Function0<? extends net.corda.core.contracts.CommandData> generateMoveCommand, kotlin.jvm.functions.Function1<? super net.corda.core.contracts.Amount<net.corda.core.contracts.Issued<T>>,? extends net.corda.core.contracts.CommandData> generateExitCommand)` Generate an transaction exiting fungible assets from the ledger.
    `java.lang.String` | `toString()`
    `java.util.Set<C>` | `verify(TransactionForContract tx, java.util.List<? extends S> inputs, java.util.List<? extends S> outputs, java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends C>> commands, Issued<? extends T> groupingKey)` 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.

    - ### Methods inherited from class net.corda.core.contracts.clauses.Clause

      `getExecutionPath, getRequiredCommands, verify`

- - ### Constructor Detail

    - #### AbstractConserveAmount

          public 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.

  - ### Method Detail

    - #### generateExit

          public CompositeKey generateExit(TransactionBuilder tx,
                                           Amount<net.corda.core.contracts.Issued> amountIssued,
                                           java.util.List<? extends net.corda.core.contracts.StateAndRef<? extends S>> assetStates,
                                           kotlin.jvm.functions.Function3<? super net.corda.core.contracts.TransactionState<? extends S>,? super net.corda.core.contracts.Amount<net.corda.core.contracts.Issued<T>>,? super net.corda.core.crypto.CompositeKey,? extends net.corda.core.contracts.TransactionState<? extends S>> deriveState,
                                           kotlin.jvm.functions.Function0<? extends net.corda.core.contracts.CommandData> generateMoveCommand,
                                           kotlin.jvm.functions.Function1<? super net.corda.core.contracts.Amount<net.corda.core.contracts.Issued<T>>,? extends net.corda.core.contracts.CommandData> generateExitCommand)

      Generate an transaction exiting fungible assets from the ledger.

      Parameters:
        `tx` - transaction builder to add states and commands to.
        `amountIssued` - the amount to be exited, represented as a quantity of issued currency.
        `assetStates` - the asset states to take funds from. No checks are done about ownership of these states, it is the responsibility of the caller to check that they do not attempt to exit funds held by others.
      Returns:
        the public key of the assets issuer, who must sign the transaction for it to be valid.

    - #### verify

          public java.util.Set<C> verify(TransactionForContract tx,
                                         java.util.List<? extends S> inputs,
                                         java.util.List<? extends S> outputs,
                                         java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends C>> commands,
                                         Issued<? extends T> groupingKey)

      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.

      Parameters:
        `tx` - the full transaction being verified. This is provided for cases where clauses need to access states or commands outside of their normal scope.
        `inputs` - input states which are relevant to this clause. By default this is the set passed into verifyClause, but may be further reduced by clauses such as GroupClauseVerifier.
        `outputs` - output states which are relevant to this clause. By default this is the set passed into verifyClause, but may be further reduced by clauses such as GroupClauseVerifier.
        `commands` - commands which are relevant to this clause. By default this is the set passed into verifyClause, but may be further reduced by clauses such as GroupClauseVerifier.
        `groupingKey` - a grouping key applied to states and commands, where applicable. Taken from `class TransactionForContract.InOutGroup`.
      Returns:
        the set of commands that are consumed IF this clause is matched, and cannot be used to match a later clause. This would normally be all commands matching "requiredCommands" for this clause, but some verify() functions may do further filtering on possible matches, and return a subset. This may also include commands that were not required (for example the Exit command for fungible assets is optional).

    - #### toString

          public java.lang.String toString()