Misc changes from Monday meeting.

This commit is contained in:
Mike Hearn 2015-11-09 17:23:05 +00:00
parent 8a2b8072e6
commit b8c7f949f4
3 changed files with 2 additions and 3 deletions

View File

@ -63,7 +63,6 @@ object Cash : Contract {
val cashInputs = inStates.filterIsInstance<Cash.State>() val cashInputs = inStates.filterIsInstance<Cash.State>()
requireThat { requireThat {
"there is at least one cash input" by cashInputs.isNotEmpty()
"there are no zero sized inputs" by cashInputs.none { it.amount.pennies == 0 } "there are no zero sized inputs" by cashInputs.none { it.amount.pennies == 0 }
"all inputs use the same currency" by (cashInputs.groupBy { it.amount.currency }.size == 1) "all inputs use the same currency" by (cashInputs.groupBy { it.amount.currency }.size == 1)
} }

View File

@ -58,6 +58,8 @@ object ComedyPaper : Contract {
is Commands.Redeem -> requireThat { is Commands.Redeem -> requireThat {
val received = outStates.sumCash() val received = outStates.sumCash()
// Do we need to check the signature of the issuer here too?
"the transaction is signed by the owner of the CP" by (command.signer == input.owner)
"the paper must have matured" by (input.maturityDate < time) "the paper must have matured" by (input.maturityDate < time)
"the received amount equals the face value" by (received == input.faceValue) "the received amount equals the face value" by (received == input.faceValue)
"the paper must be destroyed" by outStates.filterIsInstance<ComedyPaper.State>().none() "the paper must be destroyed" by outStates.filterIsInstance<ComedyPaper.State>().none()

View File

@ -24,8 +24,6 @@ class CashTests {
@Test @Test
fun trivial() { fun trivial() {
transaction { transaction {
contract `fails requirement` "there is at least one cash input"
input { inState } input { inState }
contract `fails requirement` "the amounts balance" contract `fails requirement` "the amounts balance"