From fa626fc5d73a41a816ab6c47216308c6a83cdc28 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 6 Nov 2015 19:00:44 +0100 Subject: [PATCH] Mark ChildrensPaper as really incomplete more visibly. --- src/contracts/ChildrensPaper.kt | 3 +++ src/core/ContractsDSL.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/contracts/ChildrensPaper.kt b/src/contracts/ChildrensPaper.kt index 470772a8e0..150c7db26f 100644 --- a/src/contracts/ChildrensPaper.kt +++ b/src/contracts/ChildrensPaper.kt @@ -17,6 +17,8 @@ import java.time.Instant * issue: need to find a cleaner way to allow this. Does the single-execution-per-transaction model make sense? */ +// TODO: This is very incomplete! Do not attempt to find mistakes in it just yet. + val CP_PROGRAM_ID = SecureHash.sha256("childrens-paper") data class ChildrensPaperState( @@ -53,6 +55,7 @@ object ChildrensPaper : Contract { } is CPCommands.RedeemCommand -> { + // TODO: Lots more needed here: the CP state must be destroyed by this transaction, command.signer is not really right etc val received = outStates.sumCashBy(command.signer) requireThat { "the paper must have matured" by (input.maturityDate < time) diff --git a/src/core/ContractsDSL.kt b/src/core/ContractsDSL.kt index 10933de786..4d91a21162 100644 --- a/src/core/ContractsDSL.kt +++ b/src/core/ContractsDSL.kt @@ -51,7 +51,7 @@ object Requirements { if (!expr) throw IllegalArgumentException("Failed requirement: $this") } } -fun requireThat(body: Requirements.() -> Unit) { +inline fun requireThat(body: Requirements.() -> Unit) { Requirements.body() }