corda / net.corda.testing.contracts / DummyContract

DummyContract

data class DummyContract : Contract

Dummy contract for testing purposes. Doesn't do anything useful.

Types

Commands

interface Commands : CommandData

MultiOwnerState

data class MultiOwnerState : State

Alternative state with multiple owners. This exists primarily to provide a dummy state with multiple participants, and could in theory be merged with SingleOwnerState by putting the additional participants in a different field, however this is a good example of a contract with multiple states.

SingleOwnerState

data class SingleOwnerState : OwnableState, State

State

interface State : ContractState

Constructors

<init>

DummyContract(blank: Any? = null)

Dummy contract for testing purposes. Doesn't do anything useful.

Properties

PROGRAM_ID

val PROGRAM_ID: String

blank

val blank: Any?

Functions

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

Companion Object Functions

generateInitial

fun generateInitial(magicNumber: Int, notary: Party, owner: PartyAndReference, vararg otherOwners: PartyAndReference): TransactionBuilder

Returns a TransactionBuilder with the given notary, a list of owners and an output state of type SingleOwnerState or MultipleOwnerState (depending on the number of owner parameters passed) containing the given magicNumber.

move

fun move(prior: StateAndRef<SingleOwnerState>, newOwner: AbstractParty): TransactionBuilder

An overload of move for just one input state.

fun move(priors: List<StateAndRef<SingleOwnerState>>, newOwner: AbstractParty): TransactionBuilder

Returns a TransactionBuilder that takes the given input states and transfers them to the newOwner.

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

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