diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/Obligation.kt b/contracts/src/main/kotlin/com/r3corda/contracts/Obligation.kt index cb1504a428..e5c25dcb14 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/Obligation.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/Obligation.kt @@ -153,8 +153,8 @@ class Obligation
: Contract { override val owner: PublicKey get() = beneficiary - override fun move(amount: Amount
, beneficiary: PublicKey): Obligation.State
- = copy(quantity = amount.quantity, beneficiary = beneficiary) + override fun move(newAmount: Amount
, newOwner: PublicKey): Obligation.State
+ = copy(quantity = newAmount.quantity, beneficiary = newOwner) override fun toString() = when (lifecycle) { Lifecycle.NORMAL -> "${Emoji.bagOfCash}Debt($amount due $dueBefore to ${beneficiary.toStringShort()})" @@ -272,13 +272,12 @@ class Obligation
: Contract { for ((inputs, outputs, key) in groups) { // Either inputs or outputs could be empty. val obligor = key.obligor - val commands = commandGroups[key] ?: emptyList() requireThat { "there are no zero sized outputs" by outputs.none { it.amount.quantity == 0L } } - verifyCommandGroup(tx, commands, inputs, outputs, obligor, key) + verifyCommandGroup(tx, commandGroups[key] ?: emptyList(), inputs, outputs, obligor, key) } } } @@ -318,7 +317,7 @@ class Obligation
: Contract { "all outputs are in the normal state " by outputs.all { it.lifecycle == Lifecycle.NORMAL } } if (issueCommand != null) { - verifyIssueCommand(inputs, outputs, tx, issueCommand, issued, obligor) + verifyIssueCommand(inputs, outputs, issueCommand, issued, obligor) } else if (settleCommand != null) { // Perhaps through an abundance of caution, settlement is enforced as its own command. // This could perhaps be merged into verifyBalanceChange() later, however doing so introduces a lot @@ -414,7 +413,6 @@ class Obligation
: Contract {
@VisibleForTesting
protected fun verifyIssueCommand(inputs: List ,
obligor: Party) {
@@ -794,7 +792,7 @@ fun sumAmountsDue(balances: Map >): Map
// Strip zero balances
val iterator = sum.iterator()
while (iterator.hasNext()) {
- val (key, amount) = iterator.next()
+ val amount = iterator.next().value
if (amount == 0L) {
iterator.remove()
}
diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/cash/FungibleAssetState.kt b/contracts/src/main/kotlin/com/r3corda/contracts/cash/FungibleAssetState.kt
index b2641d5d99..28a85c173e 100644
--- a/contracts/src/main/kotlin/com/r3corda/contracts/cash/FungibleAssetState.kt
+++ b/contracts/src/main/kotlin/com/r3corda/contracts/cash/FungibleAssetState.kt
@@ -11,5 +11,5 @@ import java.security.PublicKey
interface FungibleAssetState