com.r3corda.contracts.asset / CommodityContract

CommodityContract

class CommodityContract : OnLedgerAsset<Commodity, State>

A commodity contract represents an amount of some commodity, tracked on a distributed ledger. The design of this contract is intentionally similar to the Cash contract, and the same commands (issue, move, exit) apply, the differences are in representation of the underlying commodity. Issuer in this context means the party who has the commodity, or is otherwise responsible for delivering the commodity on demand, and the deposit reference is use for internal accounting by the issuer (it might be, for example, a warehouse and/or location within a warehouse).



Types

Clauses interface Clauses

The clauses for this contract are essentially:

Commands interface Commands : Commands
State data class State : FungibleAsset<Commodity>

A state representing a commodity claim against some party

Constructors

<init> CommodityContract()

A commodity contract represents an amount of some commodity, tracked on a distributed ledger. The design of this contract is intentionally similar to the Cash contract, and the same commands (issue, move, exit) apply, the differences are in representation of the underlying commodity. Issuer in this context means the party who has the commodity, or is otherwise responsible for delivering the commodity on demand, and the deposit reference is use for internal accounting by the issuer (it might be, for example, a warehouse and/or location within a warehouse).

Properties

clauses val clauses: <ERROR CLASS>
conserveClause val conserveClause: AbstractConserveAmount<State, Commodity>
legalContractReference val legalContractReference: SecureHash

TODO:

Functions

deriveState fun deriveState(txState: TransactionState<State>, amount: Amount<Issued<Commodity>>, owner: PublicKey): TransactionState<State>

Derive a new transaction state based on the given example, with amount and owner modified. This allows concrete implementations to have fields in their state which we dont know about here, and we simply leave them untouched when sending out "change" from spending/exiting.

extractCommands fun extractCommands(tx: TransactionForContract): List<AuthenticatedObject<Commands>>
generateExitCommand fun generateExitCommand(amount: Amount<Issued<Commodity>>): Exit
generateIssue fun generateIssue(tx: TransactionBuilder, tokenDef: Issued<Commodity>, pennies: Long, owner: PublicKey, notary: Party): Unit

Puts together an issuance transaction from the given template, that starts out being owned by the given pubkey.

fun generateIssue(tx: TransactionBuilder, amount: Amount<Issued<Commodity>>, owner: PublicKey, notary: Party): Unit

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

generateIssueCommand fun generateIssueCommand(): Issue
generateMoveCommand fun generateMoveCommand(): Move