corda / net.corda.finance.contracts.asset / Obligation

Obligation

class Obligation<P : Any> : 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.

Parameters

P - the product the obligation is for payment of.

Types

Commands

interface Commands : CommandData

Lifecycle

enum class Lifecycle

Represents where in its lifecycle a contract state is, which in turn controls the commands that can be applied to the state. Most states will not leave the NORMAL lifecycle. Note that settled (as an end lifecycle) is represented by absence of the state on transaction output.

State

data class State<P : Any> : FungibleAsset<Terms<P>>, NettableState<State<P>, MultilateralNetState<P>>

A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.

Terms

data class Terms<P : Any>

Subset of state, containing the elements specified when issuing a new settlement contract.

Constructors

<init>

Obligation()

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.

Functions

generateCashIssue

fun generateCashIssue(tx: TransactionBuilder, obligor: AbstractParty, acceptableContract: SecureHash, amount: Amount<Issued<Currency>>, dueBefore: Instant, beneficiary: AbstractParty, notary: Party): Unit

Puts together an issuance transaction for the specified currency obligation amount that starts out being owned by the given pubkey.

generateCloseOutNetting

fun generateCloseOutNetting(tx: TransactionBuilder, signer: AbstractParty, vararg inputs: StateAndRef<State<P>>): Unit

Generate a transaction performing close-out netting of two or more states.

generateExit

fun generateExit(tx: TransactionBuilder, amountIssued: Amount<Issued<Terms<P>>>, assetStates: List<StateAndRef<State<P>>>): Set<PublicKey>

Generate an transaction exiting an obligation from the ledger.

generateIssue

fun generateIssue(tx: TransactionBuilder, obligor: AbstractParty, issuanceDef: Terms<P>, pennies: Long, beneficiary: AbstractParty, notary: Party): Set<PublicKey>

Puts together an issuance transaction for the specified amount that starts out being owned by the given pubkey.

generatePaymentNetting

fun generatePaymentNetting(tx: TransactionBuilder, issued: Issued<Terms<P>>, notary: Party, vararg inputs: StateAndRef<State<P>>): Unit

generateSetLifecycle

fun generateSetLifecycle(tx: TransactionBuilder, statesAndRefs: List<StateAndRef<State<P>>>, lifecycle: Lifecycle, notary: Party): Unit

Generate a transaction changing the lifecycle of one or more state objects.

generateSettle

fun generateSettle(tx: TransactionBuilder, statesAndRefs: Iterable<StateAndRef<State<P>>>, assetStatesAndRefs: Iterable<StateAndRef<FungibleAsset<P>>>, moveCommand: MoveCommand, notary: Party): Unit

verify

fun verify(tx: LedgerTransaction): Unit

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.

Companion Object Properties

PROGRAM_ID

const val PROGRAM_ID: ContractClassName

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.