diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt b/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt index 65b4ff6fea..773b095acd 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/IRS.kt @@ -461,7 +461,7 @@ class InterestRateSwap() : ClauseVerifier() { override val ifNotMatched = MatchBehaviour.CONTINUE // These functions may make more sense to use for basket types, but for now let's leave them here - fun checkLegDates(legs: Array) { + fun checkLegDates(legs: List) { requireThat { "Effective date is before termination date" by legs.all { it.effectiveDate < it.terminationDate } "Effective dates are in alignment" by legs.all { it.effectiveDate == legs[0].effectiveDate } @@ -469,7 +469,7 @@ class InterestRateSwap() : ClauseVerifier() { } } - fun checkLegAmounts(legs: Array) { + fun checkLegAmounts(legs: List) { requireThat { "The notional is non zero" by legs.any { it.notional.quantity > (0).toLong() } "The notional for all legs must be the same" by legs.all { it.notional == legs[0].notional } @@ -485,9 +485,9 @@ class InterestRateSwap() : ClauseVerifier() { } // TODO: After business rules discussion, add further checks to the schedules and rates - fun checkSchedules(@Suppress("UNUSED_PARAMETER") legs: Array): Boolean = true + fun checkSchedules(@Suppress("UNUSED_PARAMETER") legs: List): Boolean = true - fun checkRates(@Suppress("UNUSED_PARAMETER") legs: Array): Boolean = true + fun checkRates(@Suppress("UNUSED_PARAMETER") legs: List): Boolean = true /** * Compares two schedules of Floating Leg Payments, returns the difference (i.e. omissions in either leg or changes to the values). @@ -550,14 +550,14 @@ class InterestRateSwap() : ClauseVerifier() { "The effective date is before the termination date for the floating leg" by (irs.floatingLeg.effectiveDate < irs.floatingLeg.terminationDate) "The effective dates are aligned" by (irs.floatingLeg.effectiveDate == irs.fixedLeg.effectiveDate) "The termination dates are aligned" by (irs.floatingLeg.terminationDate == irs.fixedLeg.terminationDate) - "The rates are valid" by checkRates(arrayOf(irs.fixedLeg, irs.floatingLeg)) - "The schedules are valid" by checkSchedules(arrayOf(irs.fixedLeg, irs.floatingLeg)) + "The rates are valid" by checkRates(listOf(irs.fixedLeg, irs.floatingLeg)) + "The schedules are valid" by checkSchedules(listOf(irs.fixedLeg, irs.floatingLeg)) "The fixing period date offset cannot be negative" by (irs.floatingLeg.fixingPeriodOffset >= 0) // TODO: further tests } - checkLegAmounts(arrayOf(irs.fixedLeg, irs.floatingLeg)) - checkLegDates(arrayOf(irs.fixedLeg, irs.floatingLeg)) + checkLegAmounts(listOf(irs.fixedLeg, irs.floatingLeg)) + checkLegDates(listOf(irs.fixedLeg, irs.floatingLeg)) return setOf(command.value) } @@ -672,8 +672,8 @@ class InterestRateSwap() : ClauseVerifier() { return (fixedLeg.fixedRatePayer.owningKey in ourKeys) || (floatingLeg.floatingRatePayer.owningKey in ourKeys) } - override val parties: Array - get() = arrayOf(fixedLeg.fixedRatePayer, floatingLeg.floatingRatePayer) + override val parties: List + get() = listOf(fixedLeg.fixedRatePayer, floatingLeg.floatingRatePayer) override fun nextScheduledActivity(thisStateRef: StateRef, protocolLogicRefFactory: ProtocolLogicRefFactory): ScheduledActivity? { val nextFixingOf = nextFixingOf() ?: return null diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt b/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt index bfa70fdaa0..9815225118 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/Structures.kt @@ -230,7 +230,7 @@ interface DealState : LinearState { val ref: String /** Exposes the Parties involved in a generic way */ - val parties: Array + val parties: List // TODO: This works by editing the keys used by a Party which is invalid. fun withPublicKey(before: Party, after: PublicKey): DealState diff --git a/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt b/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt index 047e9a10da..11ff47d0ea 100644 --- a/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt +++ b/src/main/kotlin/com/r3corda/demos/protocols/AutoOfferProtocol.kt @@ -102,7 +102,7 @@ object AutoOfferProtocol { val notary = serviceHub.networkMapCache.notaryNodes.first().identity // need to pick which ever party is not us - val otherParty = notUs(*dealToBeOffered.parties).single() + val otherParty = notUs(dealToBeOffered.parties).single() progressTracker.currentStep = ANNOUNCING send(otherParty, 0, AutoOfferMessage(serviceHub.storageService.myLegalIdentity, notary, ourSessionID, dealToBeOffered)) progressTracker.currentStep = DEALING @@ -110,7 +110,7 @@ object AutoOfferProtocol { return stx } - private fun notUs(vararg parties: Party): List { + private fun notUs(parties: List): List { val notUsParties: MutableList = arrayListOf() for (party in parties) { if (serviceHub.storageService.myLegalIdentity != party) {