net.corda.contracts

## Class CommercialPaper

- net.corda.contracts.CommercialPaper

- All Implemented Interfaces:
    Contract

      public class CommercialPaper
      implements Contract

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CommercialPaper.State`
    `static class` | `CommercialPaper.Terms`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommercialPaper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TransactionBuilder` | `generateIssue(PartyAndReference issuance, Amount<net.corda.core.contracts.Issued> faceValue, java.time.Instant maturityDate, Party notary)` Returns a transaction that issues commercial paper, owned by the issuing parties key. Does not update an existing transaction because you aren't able to issue multiple pieces of CP in a single transaction at the moment: this restriction is not fundamental and may be lifted later.
    `void` | `generateMove(TransactionBuilder tx, StateAndRef<net.corda.contracts.CommercialPaper.State> paper, CompositeKey newOwner)` Updates the given partial transaction with an input/output/command to reassign ownership of the paper.
    `void` | `generateRedeem(TransactionBuilder tx, StateAndRef<net.corda.contracts.CommercialPaper.State> paper, VaultService vault)` Intended to be called by the issuer of some commercial paper, when an owner has notified us that they wish to redeem the paper. We must therefore send enough money to the key that owns the paper to satisfy the face value, and then ensure the paper is removed from the ledger.
    `SecureHash` | `getLegalContractReference()` Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contract's contents).
    `void` | `verify(TransactionForContract tx)` Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if there's a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code.

    - ### Methods inherited from interface net.corda.core.contracts.Contract

      `getLegalContractReference, verify`

- - ### Constructor Detail

    - #### CommercialPaper

          public CommercialPaper()

  - ### Method Detail

    - #### getLegalContractReference

          public SecureHash getLegalContractReference()

      Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contract's contents).

    - #### verify

          public void verify(TransactionForContract tx)

      Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if there's a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code.

    - #### generateIssue

          public TransactionBuilder generateIssue(PartyAndReference issuance,
                                                  Amount<net.corda.core.contracts.Issued> faceValue,
                                                  java.time.Instant maturityDate,
                                                  Party notary)

      Returns a transaction that issues commercial paper, owned by the issuing parties key. Does not update an existing transaction because you aren't able to issue multiple pieces of CP in a single transaction at the moment: this restriction is not fundamental and may be lifted later.

    - #### generateMove

          public void generateMove(TransactionBuilder tx,
                                   StateAndRef<net.corda.contracts.CommercialPaper.State> paper,
                                   CompositeKey newOwner)

      Updates the given partial transaction with an input/output/command to reassign ownership of the paper.

    - #### generateRedeem

          public void generateRedeem(TransactionBuilder tx,
                                     StateAndRef<net.corda.contracts.CommercialPaper.State> paper,
                                     VaultService vault)

      Intended to be called by the issuer of some commercial paper, when an owner has notified us that they wish to redeem the paper. We must therefore send enough money to the key that owns the paper to satisfy the face value, and then ensure the paper is removed from the ledger.

      Throws:
        - if the vault doesn't contain enough money to pay the redeemer.