Contracts: include a string reference to the legal contract that the code is supposed to implement. Suggestion from Richard.

This commit is contained in:
Mike Hearn 2015-11-08 13:38:51 +01:00
parent 03aaf07f70
commit 8a2b8072e6
3 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,8 @@ class InsufficientBalanceException(val amountMissing: Amount) : Exception()
* vaults can ignore the issuer/depositRefs and just examine the amount fields.
*/
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 */
data class State(
/** Where the underlying currency backing this ledger entry can be found (propagated) */

View File

@ -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.
object ComedyPaper : Contract {
override val legalContractReference: String = "https://www.gotlines.com/jokes/1"
data class State(
val issuance: InstitutionReference,
val owner: PublicKey,

View File

@ -93,6 +93,9 @@ data class VerifiedSigned<out T : Command>(
interface Contract {
/** 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)
/** Unparsed reference to the natural language contract that this code is supposed to express (usually a URL). */
val legalContractReference: String
}
/**