mirror of
https://github.com/corda/corda.git
synced 2025-06-01 15:10:54 +00:00
Contracts: include a string reference to the legal contract that the code is supposed to implement. Suggestion from Richard.
This commit is contained in:
parent
03aaf07f70
commit
8a2b8072e6
@ -27,6 +27,8 @@ class InsufficientBalanceException(val amountMissing: Amount) : Exception()
|
|||||||
* vaults can ignore the issuer/depositRefs and just examine the amount fields.
|
* vaults can ignore the issuer/depositRefs and just examine the amount fields.
|
||||||
*/
|
*/
|
||||||
object Cash : Contract {
|
object Cash : Contract {
|
||||||
|
override val legalContractReference: String = "https://www.big-book-of-banking-law.gov/cash-claims.html"
|
||||||
|
|
||||||
/** A state representing a cash claim against some institution */
|
/** A state representing a cash claim against some institution */
|
||||||
data class State(
|
data class State(
|
||||||
/** Where the underlying currency backing this ledger entry can be found (propagated) */
|
/** Where the underlying currency backing this ledger entry can be found (propagated) */
|
||||||
|
@ -23,6 +23,8 @@ val CP_PROGRAM_ID = SecureHash.sha256("comedy-paper")
|
|||||||
|
|
||||||
// TODO: Generalise the notion of an owned instrument into a superclass/supercontract. Consider composition vs inheritance.
|
// TODO: Generalise the notion of an owned instrument into a superclass/supercontract. Consider composition vs inheritance.
|
||||||
object ComedyPaper : Contract {
|
object ComedyPaper : Contract {
|
||||||
|
override val legalContractReference: String = "https://www.gotlines.com/jokes/1"
|
||||||
|
|
||||||
data class State(
|
data class State(
|
||||||
val issuance: InstitutionReference,
|
val issuance: InstitutionReference,
|
||||||
val owner: PublicKey,
|
val owner: PublicKey,
|
||||||
|
@ -93,6 +93,9 @@ data class VerifiedSigned<out T : Command>(
|
|||||||
interface Contract {
|
interface Contract {
|
||||||
/** Must throw an exception if there's a problem that should prevent state transition. */
|
/** Must throw an exception if there's a problem that should prevent state transition. */
|
||||||
fun verify(inStates: List<ContractState>, outStates: List<ContractState>, args: List<VerifiedSigned<Command>>, time: Instant)
|
fun verify(inStates: List<ContractState>, outStates: List<ContractState>, args: List<VerifiedSigned<Command>>, time: Instant)
|
||||||
|
|
||||||
|
/** Unparsed reference to the natural language contract that this code is supposed to express (usually a URL). */
|
||||||
|
val legalContractReference: String
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user