mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Minor: fix some compiler warnings and update some universal contract DSL code to use may as an infix function
This commit is contained in:
parent
81d1459599
commit
eec16a41cf
@ -103,7 +103,6 @@ class TransactionDataModel {
|
||||
added.set(StateMachineStatus.Removed(added.value.stateMachineName))
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
private val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress ->
|
||||
StateMachineData(id, progress.map { it?.let { FlowStatus(it.message) } }, status)
|
||||
|
@ -42,6 +42,7 @@ class ActionsBuilder {
|
||||
infix fun Set<Party>.or(party: Party) = this.plus(party)
|
||||
}
|
||||
|
||||
@Suppress("UNUSED")
|
||||
open class ContractBuilder {
|
||||
private val contracts = mutableListOf<Arrangement>()
|
||||
|
||||
|
@ -59,16 +59,16 @@ class IRS {
|
||||
highStreetBank.owes(acmeCorp, floating - fixed, currency)
|
||||
rollOut("2016-12-01".ld, "2018-09-01".ld, Frequency.Quarterly) {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
val floating = interest(notional, "act/365", fix("LIBOR", start, Tenor("3M")), start, end)
|
||||
val fixed = interest(notional, "act/365", 0.5.bd, start, end)
|
||||
(acmeCorp or highStreetBank) may {
|
||||
val nextFloating = interest(notional, "act/365", fix("LIBOR", start, Tenor("3M")), start, end)
|
||||
val nextFixed = interest(notional, "act/365", 0.5.bd, start, end)
|
||||
|
||||
"pay floating".anytime {
|
||||
highStreetBank.owes(acmeCorp, floating - fixed, currency)
|
||||
highStreetBank.owes(acmeCorp, nextFloating - nextFixed, currency)
|
||||
next()
|
||||
}
|
||||
"pay fixed".anytime {
|
||||
highStreetBank.owes(acmeCorp, fixed - floating, currency)
|
||||
highStreetBank.owes(acmeCorp, nextFixed - nextFloating, currency)
|
||||
next()
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ class IRS {
|
||||
highStreetBank.owes(acmeCorp, fixed - floating, currency)
|
||||
rollOut("2016-12-01".ld, "2018-09-01".ld, Frequency.Quarterly) {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
(acmeCorp or highStreetBank) may {
|
||||
val floating = interest(notional, "act/365", fix("LIBOR", start, Tenor("3M")), start, end)
|
||||
val fixed = interest(notional, "act/365", 0.5.bd, start, end)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.corda.contracts.universal
|
||||
|
||||
import net.corda.core.contracts.BusinessCalendar
|
||||
import net.corda.core.contracts.Frequency
|
||||
import net.corda.core.utilities.DUMMY_NOTARY
|
||||
import net.corda.testing.transaction
|
||||
@ -9,13 +8,12 @@ import java.time.Instant
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class RollOutTests {
|
||||
|
||||
val TEST_TX_TIME_1: Instant get() = Instant.parse("2017-09-02T12:00:00.00Z")
|
||||
|
||||
val contract = arrange {
|
||||
rollOut("2016-09-01".ld, "2017-09-01".ld, Frequency.Monthly) {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
(acmeCorp or highStreetBank) may {
|
||||
"transfer".givenThat(after(end)) {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
next()
|
||||
@ -29,7 +27,7 @@ class RollOutTests {
|
||||
val contract2 = arrange {
|
||||
rollOut("2016-09-01".ld, "2017-09-01".ld, Frequency.Monthly) {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
(acmeCorp or highStreetBank) may {
|
||||
"transfer".givenThat(after(end)) {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
next()
|
||||
@ -43,7 +41,7 @@ class RollOutTests {
|
||||
val contractStep1a = arrange {
|
||||
rollOut("2016-10-03".ld, "2017-09-01".ld, Frequency.Monthly) {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
(acmeCorp or highStreetBank) may {
|
||||
"transfer".givenThat(after(end)) {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
next()
|
||||
@ -68,7 +66,7 @@ class RollOutTests {
|
||||
}
|
||||
val contract_action1 = arrange {
|
||||
actions {
|
||||
highStreetBank.may {
|
||||
highStreetBank may {
|
||||
"do it".anytime {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
}
|
||||
@ -77,7 +75,7 @@ class RollOutTests {
|
||||
}
|
||||
val contract_action2 = arrange {
|
||||
actions {
|
||||
highStreetBank.may {
|
||||
highStreetBank may {
|
||||
"do it".anytime {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
}
|
||||
@ -86,14 +84,14 @@ class RollOutTests {
|
||||
}
|
||||
val contract_and1 = arrange {
|
||||
actions {
|
||||
highStreetBank.may {
|
||||
highStreetBank may {
|
||||
"do it".anytime {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
}
|
||||
}
|
||||
}
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
acmeCorp may {
|
||||
"do it".anytime {
|
||||
acmeCorp.owes(momAndPop, 10.K, USD)
|
||||
}
|
||||
@ -104,14 +102,14 @@ class RollOutTests {
|
||||
}
|
||||
val contract_and2 = arrange {
|
||||
actions {
|
||||
highStreetBank.may {
|
||||
highStreetBank may {
|
||||
"do it".anytime {
|
||||
highStreetBank.owes(acmeCorp, 10.K, USD)
|
||||
}
|
||||
}
|
||||
}
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
acmeCorp may {
|
||||
"do it".anytime {
|
||||
acmeCorp.owes(momAndPop, 10.K, USD)
|
||||
}
|
||||
@ -141,11 +139,6 @@ class RollOutTests {
|
||||
assertEquals(contract, contract2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun dateTests() {
|
||||
val d1 = BusinessCalendar.parseDateFromString("2016-09-10")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun issue() {
|
||||
transaction {
|
||||
|
Loading…
Reference in New Issue
Block a user