mirror of
https://github.com/corda/corda.git
synced 2025-06-21 16:49:45 +00:00
Minor: auto-format of module: samples
This commit is contained in:
@ -52,14 +52,14 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
||||||
ext.rpcUsers = [ ['username' : "demo", 'password' : "demo", 'permissions' : ["StartFlow.net.corda.flows.FinalityFlow"]] ]
|
ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["StartFlow.net.corda.flows.FinalityFlow"]]]
|
||||||
|
|
||||||
directory "./build/nodes"
|
directory "./build/nodes"
|
||||||
networkMap "Controller"
|
networkMap "Controller"
|
||||||
node {
|
node {
|
||||||
name "Controller"
|
name "Controller"
|
||||||
nearestCity "London"
|
nearestCity "London"
|
||||||
advertisedServices ["corda.notary.validating"]
|
advertisedServices["corda.notary.validating"]
|
||||||
p2pPort 10002
|
p2pPort 10002
|
||||||
rpcPort 10003
|
rpcPort 10003
|
||||||
cordapps = []
|
cordapps = []
|
||||||
|
@ -36,7 +36,7 @@ class AttachmentDemoTest {
|
|||||||
}
|
}
|
||||||
}.exceptionally { it.printStackTrace() }
|
}.exceptionally { it.printStackTrace() }
|
||||||
|
|
||||||
val recipientThread = CompletableFuture.supplyAsync{
|
val recipientThread = CompletableFuture.supplyAsync {
|
||||||
nodeB.rpcClientToNode().use(demoUser[0].username, demoUser[0].password) {
|
nodeB.rpcClientToNode().use(demoUser[0].username, demoUser[0].password) {
|
||||||
recipient(this)
|
recipient(this)
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,16 @@ import net.corda.core.div
|
|||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
import net.corda.core.sizedInputStreamAndHash
|
||||||
import net.corda.core.utilities.Emoji
|
import net.corda.core.utilities.Emoji
|
||||||
import net.corda.flows.FinalityFlow
|
import net.corda.flows.FinalityFlow
|
||||||
import net.corda.nodeapi.config.SSLConfiguration
|
import net.corda.nodeapi.config.SSLConfiguration
|
||||||
import net.corda.testing.ALICE_KEY
|
import net.corda.testing.ALICE_KEY
|
||||||
|
import java.io.InputStream
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import java.io.*
|
|
||||||
import net.corda.core.sizedInputStreamAndHash
|
|
||||||
|
|
||||||
internal enum class Role {
|
internal enum class Role {
|
||||||
SENDER,
|
SENDER,
|
||||||
|
@ -72,7 +72,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
|||||||
rpcUsers = [
|
rpcUsers = [
|
||||||
['username' : "bankUser",
|
['username' : "bankUser",
|
||||||
'password' : "test",
|
'password' : "test",
|
||||||
'permissions' : ["StartFlow.net.corda.flows.CashPaymentFlow",
|
'permissions': ["StartFlow.net.corda.flows.CashPaymentFlow",
|
||||||
"StartFlow.net.corda.flows.IssuerFlow\$IssuanceRequester"]]
|
"StartFlow.net.corda.flows.IssuerFlow\$IssuanceRequester"]]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
|
|||||||
rpcUsers = [
|
rpcUsers = [
|
||||||
['username' : "bigCorpUser",
|
['username' : "bigCorpUser",
|
||||||
'password' : "test",
|
'password' : "test",
|
||||||
'permissions' : ["StartFlow.net.corda.flows.CashPaymentFlow"]]
|
'permissions': ["StartFlow.net.corda.flows.CashPaymentFlow"]]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ import com.google.common.net.HostAndPort
|
|||||||
import joptsimple.OptionParser
|
import joptsimple.OptionParser
|
||||||
import net.corda.bank.api.BankOfCordaClientApi
|
import net.corda.bank.api.BankOfCordaClientApi
|
||||||
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
import net.corda.bank.api.BankOfCordaWebApi.IssueRequestParams
|
||||||
import net.corda.flows.IssuerFlow
|
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.flows.CashPaymentFlow
|
import net.corda.flows.CashPaymentFlow
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
@ -59,8 +59,7 @@ private class BankOfCordaDriver {
|
|||||||
startWebserver(bankOfCorda.get())
|
startWebserver(bankOfCorda.get())
|
||||||
waitForAllNodesToFinish()
|
waitForAllNodesToFinish()
|
||||||
}, isDebug = true)
|
}, isDebug = true)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), "BigCorporation", "1", "BankOfCorda")
|
val requestParams = IssueRequestParams(options.valueOf(quantity), options.valueOf(currency), "BigCorporation", "1", "BankOfCorda")
|
||||||
when (role) {
|
when (role) {
|
||||||
@ -76,10 +75,10 @@ private class BankOfCordaDriver {
|
|||||||
if (result)
|
if (result)
|
||||||
println("Successfully processed Cash Issue request")
|
println("Successfully processed Cash Issue request")
|
||||||
}
|
}
|
||||||
Role.ISSUER -> {}
|
Role.ISSUER -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("Exception occurred: $e \n ${e.printStackTrace()}")
|
println("Exception occurred: $e \n ${e.printStackTrace()}")
|
||||||
exitProcess(1)
|
exitProcess(1)
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,18 @@ class BankOfCordaWebApi(val rpc: CordaRPCOps) {
|
|||||||
data class IssueRequestParams(val amount: Long, val currency: String,
|
data class IssueRequestParams(val amount: Long, val currency: String,
|
||||||
val issueToPartyName: String, val issueToPartyRefAsString: String,
|
val issueToPartyName: String, val issueToPartyRefAsString: String,
|
||||||
val issuerBankName: String)
|
val issuerBankName: String)
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
val logger = loggerFor<BankOfCordaWebApi>()
|
val logger = loggerFor<BankOfCordaWebApi>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("date")
|
@Path("date")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
fun getCurrentDate(): Any {
|
fun getCurrentDate(): Any {
|
||||||
return mapOf("date" to LocalDateTime.now().toLocalDate())
|
return mapOf("date" to LocalDateTime.now().toLocalDate())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request asset issuance
|
* Request asset issuance
|
||||||
*/
|
*/
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package net.corda.bank.plugin
|
package net.corda.bank.plugin
|
||||||
|
|
||||||
import net.corda.bank.api.BankOfCordaWebApi
|
import net.corda.bank.api.BankOfCordaWebApi
|
||||||
import net.corda.flows.IssuerFlow
|
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.node.CordaPluginRegistry
|
import net.corda.core.node.CordaPluginRegistry
|
||||||
import net.corda.core.serialization.OpaqueBytes
|
import net.corda.core.serialization.OpaqueBytes
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
|
|
||||||
class BankOfCordaPlugin : CordaPluginRegistry() {
|
class BankOfCordaPlugin : CordaPluginRegistry() {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.corda.irs.api
|
package net.corda.irs.api
|
||||||
|
|
||||||
import net.corda.core.contracts.filterStatesOfType
|
import net.corda.core.contracts.filterStatesOfType
|
||||||
import net.corda.core.crypto.AnonymousParty
|
|
||||||
import net.corda.core.crypto.Party
|
import net.corda.core.crypto.Party
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
|
@ -213,6 +213,7 @@ object NodeInterestRates {
|
|||||||
else -> throw IllegalArgumentException("Oracle received data of different type than expected.")
|
else -> throw IllegalArgumentException("Oracle received data of different type than expected.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val leaves = ftx.filteredLeaves
|
val leaves = ftx.filteredLeaves
|
||||||
if (!leaves.checkWithFun(::check))
|
if (!leaves.checkWithFun(::check))
|
||||||
throw IllegalArgumentException()
|
throw IllegalArgumentException()
|
||||||
|
@ -304,7 +304,7 @@ class InterestRateSwap : Contract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
open class FixedLeg<P: AbstractParty>(
|
open class FixedLeg<P : AbstractParty>(
|
||||||
var fixedRatePayer: P,
|
var fixedRatePayer: P,
|
||||||
notional: Amount<Currency>,
|
notional: Amount<Currency>,
|
||||||
paymentFrequency: Frequency,
|
paymentFrequency: Frequency,
|
||||||
@ -362,6 +362,7 @@ class InterestRateSwap : Contract {
|
|||||||
fixedRatePayer, notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate,
|
fixedRatePayer, notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate,
|
||||||
terminationDateAdjustment, dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay,
|
terminationDateAdjustment, dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay,
|
||||||
paymentCalendar, interestPeriodAdjustment, fixedRate, rollConvention)
|
paymentCalendar, interestPeriodAdjustment, fixedRate, rollConvention)
|
||||||
|
|
||||||
fun toAnonymous(): FixedLeg<AnonymousParty> {
|
fun toAnonymous(): FixedLeg<AnonymousParty> {
|
||||||
return FixedLeg(fixedRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
return FixedLeg(fixedRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
||||||
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
||||||
@ -370,7 +371,7 @@ class InterestRateSwap : Contract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
open class FloatingLeg<P: AbstractParty>(
|
open class FloatingLeg<P : AbstractParty>(
|
||||||
var floatingRatePayer: P,
|
var floatingRatePayer: P,
|
||||||
notional: Amount<Currency>,
|
notional: Amount<Currency>,
|
||||||
paymentFrequency: Frequency,
|
paymentFrequency: Frequency,
|
||||||
@ -458,6 +459,7 @@ class InterestRateSwap : Contract {
|
|||||||
paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment, rollConvention,
|
paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment, rollConvention,
|
||||||
fixingRollConvention, resetDayInMonth, fixingPeriod, resetRule, fixingsPerPayment,
|
fixingRollConvention, resetDayInMonth, fixingPeriod, resetRule, fixingsPerPayment,
|
||||||
fixingCalendar, index, indexSource, indexTenor)
|
fixingCalendar, index, indexSource, indexTenor)
|
||||||
|
|
||||||
fun toAnonymous(): FloatingLeg<AnonymousParty> {
|
fun toAnonymous(): FloatingLeg<AnonymousParty> {
|
||||||
return FloatingLeg(floatingRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
return FloatingLeg(floatingRatePayer.toAnonymous(), notional, paymentFrequency, effectiveDate, effectiveDateAdjustment, terminationDate, terminationDateAdjustment,
|
||||||
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
dayCountBasisDay, dayCountBasisYear, dayInMonth, paymentRule, paymentDelay, paymentCalendar, interestPeriodAdjustment,
|
||||||
@ -662,7 +664,7 @@ class InterestRateSwap : Contract {
|
|||||||
/**
|
/**
|
||||||
* The state class contains the 4 major data classes.
|
* The state class contains the 4 major data classes.
|
||||||
*/
|
*/
|
||||||
data class State<P: AbstractParty>(
|
data class State<P : AbstractParty>(
|
||||||
val fixedLeg: FixedLeg<P>,
|
val fixedLeg: FixedLeg<P>,
|
||||||
val floatingLeg: FloatingLeg<P>,
|
val floatingLeg: FloatingLeg<P>,
|
||||||
val calculation: Calculation,
|
val calculation: Calculation,
|
||||||
|
@ -73,7 +73,7 @@ object AutoOfferFlow {
|
|||||||
return stx
|
return stx
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T: AbstractParty> notUs(parties: List<T>): List<T> {
|
private fun <T : AbstractParty> notUs(parties: List<T>): List<T> {
|
||||||
val notUsParties: MutableList<T> = arrayListOf()
|
val notUsParties: MutableList<T> = arrayListOf()
|
||||||
for (party in parties) {
|
for (party in parties) {
|
||||||
if (serviceHub.myInfo.legalIdentity != party) {
|
if (serviceHub.myInfo.legalIdentity != party) {
|
||||||
|
@ -136,6 +136,7 @@ class NodeInterestRatesTest {
|
|||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val ftx1 = wtx1.buildFilteredTransaction(::filterAllOutputs)
|
val ftx1 = wtx1.buildFilteredTransaction(::filterAllOutputs)
|
||||||
assertFailsWith<IllegalArgumentException> { oracle.sign(ftx1) }
|
assertFailsWith<IllegalArgumentException> { oracle.sign(ftx1) }
|
||||||
tx.addCommand(Cash.Commands.Move(), ALICE_PUBKEY)
|
tx.addCommand(Cash.Commands.Move(), ALICE_PUBKEY)
|
||||||
|
@ -20,7 +20,7 @@ object SimmRevaluation {
|
|||||||
val myIdentity = serviceHub.myInfo.legalIdentity.toAnonymous()
|
val myIdentity = serviceHub.myInfo.legalIdentity.toAnonymous()
|
||||||
if (myIdentity == curState.parties[0]) {
|
if (myIdentity == curState.parties[0]) {
|
||||||
val otherParty = serviceHub.identityService.partyFromAnonymous(curState.parties[1])
|
val otherParty = serviceHub.identityService.partyFromAnonymous(curState.parties[1])
|
||||||
require (otherParty != null) { "Other party must be known by this node" }
|
require(otherParty != null) { "Other party must be known by this node" }
|
||||||
subFlow(SimmFlow.Requester(otherParty!!, valuationDate, stateAndRef))
|
subFlow(SimmFlow.Requester(otherParty!!, valuationDate, stateAndRef))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package net.corda.traderdemo
|
package net.corda.traderdemo
|
||||||
|
|
||||||
import net.corda.flows.IssuerFlow
|
import net.corda.core.div
|
||||||
import net.corda.core.node.services.ServiceInfo
|
import net.corda.core.node.services.ServiceInfo
|
||||||
|
import net.corda.flows.IssuerFlow
|
||||||
import net.corda.node.driver.driver
|
import net.corda.node.driver.driver
|
||||||
import net.corda.node.services.startFlowPermission
|
import net.corda.node.services.startFlowPermission
|
||||||
import net.corda.node.services.transactions.SimpleNotaryService
|
import net.corda.node.services.transactions.SimpleNotaryService
|
||||||
|
import net.corda.nodeapi.User
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import net.corda.core.div
|
|
||||||
import net.corda.nodeapi.User
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
||||||
|
@ -4,7 +4,6 @@ import com.google.common.util.concurrent.Futures
|
|||||||
import net.corda.contracts.testing.calculateRandomlySizedAmounts
|
import net.corda.contracts.testing.calculateRandomlySizedAmounts
|
||||||
import net.corda.core.contracts.Amount
|
import net.corda.core.contracts.Amount
|
||||||
import net.corda.core.contracts.DOLLARS
|
import net.corda.core.contracts.DOLLARS
|
||||||
import net.corda.core.contracts.Issued
|
|
||||||
import net.corda.core.getOrThrow
|
import net.corda.core.getOrThrow
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
Reference in New Issue
Block a user