mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Misc changes from Monday meeting.
This commit is contained in:
parent
8a2b8072e6
commit
b8c7f949f4
@ -63,7 +63,6 @@ object Cash : Contract {
|
||||
val cashInputs = inStates.filterIsInstance<Cash.State>()
|
||||
|
||||
requireThat {
|
||||
"there is at least one cash input" by cashInputs.isNotEmpty()
|
||||
"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)
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ object ComedyPaper : Contract {
|
||||
|
||||
is Commands.Redeem -> requireThat {
|
||||
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 received amount equals the face value" by (received == input.faceValue)
|
||||
"the paper must be destroyed" by outStates.filterIsInstance<ComedyPaper.State>().none()
|
||||
|
@ -24,8 +24,6 @@ class CashTests {
|
||||
@Test
|
||||
fun trivial() {
|
||||
transaction {
|
||||
contract `fails requirement` "there is at least one cash input"
|
||||
|
||||
input { inState }
|
||||
contract `fails requirement` "the amounts balance"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user