mirror of
https://github.com/corda/corda.git
synced 2025-06-22 09:08:49 +00:00
Allow for easier conversion from Amount<Issued<T>> to Amount<T> and de-issuerify a few places.
This commit is contained in:
@ -8,8 +8,6 @@ import com.r3corda.contracts.testing.fillWithSomeTestCash
|
||||
import com.r3corda.core.contracts.DOLLARS
|
||||
import com.r3corda.core.contracts.SignedTransaction
|
||||
import com.r3corda.core.contracts.`issued by`
|
||||
import com.r3corda.core.crypto.Party
|
||||
import com.r3corda.core.crypto.generateKeyPair
|
||||
import com.r3corda.core.days
|
||||
import com.r3corda.core.random63BitValue
|
||||
import com.r3corda.core.seconds
|
||||
@ -43,8 +41,7 @@ class TradeSimulation(runAsync: Boolean, latencyInjector: InMemoryMessagingNetwo
|
||||
}
|
||||
seller.services.recordTransactions(issuance)
|
||||
|
||||
val cashIssuerKey = generateKeyPair()
|
||||
val amount = 1000.DOLLARS `issued by` Party("Big friendly bank", cashIssuerKey.public).ref(1)
|
||||
val amount = 1000.DOLLARS
|
||||
val sessionID = random63BitValue()
|
||||
val buyerProtocol = TwoPartyTradeProtocol.Buyer(
|
||||
seller.info.identity,
|
||||
|
@ -54,14 +54,14 @@ class TwoPartyTradeProtocolTests {
|
||||
lateinit var net: MockNetwork
|
||||
|
||||
private fun runSeller(smm: StateMachineManager, notary: NodeInfo,
|
||||
otherSide: Party, assetToSell: StateAndRef<OwnableState>, price: Amount<Issued<Currency>>,
|
||||
otherSide: Party, assetToSell: StateAndRef<OwnableState>, price: Amount<Currency>,
|
||||
myKeyPair: KeyPair, buyerSessionID: Long): ListenableFuture<SignedTransaction> {
|
||||
val seller = TwoPartyTradeProtocol.Seller(otherSide, notary, assetToSell, price, myKeyPair, buyerSessionID)
|
||||
return smm.add("${TwoPartyTradeProtocol.TOPIC}.seller", seller)
|
||||
}
|
||||
|
||||
private fun runBuyer(smm: StateMachineManager, notaryNode: NodeInfo,
|
||||
otherSide: Party, acceptablePrice: Amount<Issued<Currency>>, typeToBuy: Class<out OwnableState>,
|
||||
otherSide: Party, acceptablePrice: Amount<Currency>, typeToBuy: Class<out OwnableState>,
|
||||
sessionID: Long): ListenableFuture<SignedTransaction> {
|
||||
val buyer = TwoPartyTradeProtocol.Buyer(otherSide, notaryNode.identity, acceptablePrice, typeToBuy, sessionID)
|
||||
return smm.add("${TwoPartyTradeProtocol.TOPIC}.buyer", buyer)
|
||||
@ -106,7 +106,7 @@ class TwoPartyTradeProtocolTests {
|
||||
bobNode.smm,
|
||||
notaryNode.info,
|
||||
aliceNode.info.identity,
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
CommercialPaper.State::class.java,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -115,7 +115,7 @@ class TwoPartyTradeProtocolTests {
|
||||
notaryNode.info,
|
||||
bobNode.info.identity,
|
||||
"alice's paper".outputStateAndRef(),
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
ALICE_KEY,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -158,7 +158,7 @@ class TwoPartyTradeProtocolTests {
|
||||
notaryNode.info,
|
||||
bobNode.info.identity,
|
||||
"alice's paper".outputStateAndRef(),
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
ALICE_KEY,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -166,7 +166,7 @@ class TwoPartyTradeProtocolTests {
|
||||
bobNode.smm,
|
||||
notaryNode.info,
|
||||
aliceNode.info.identity,
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
CommercialPaper.State::class.java,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -279,7 +279,7 @@ class TwoPartyTradeProtocolTests {
|
||||
notaryNode.info,
|
||||
bobNode.info.identity,
|
||||
"alice's paper".outputStateAndRef(),
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
ALICE_KEY,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -287,7 +287,7 @@ class TwoPartyTradeProtocolTests {
|
||||
bobNode.smm,
|
||||
notaryNode.info,
|
||||
aliceNode.info.identity,
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
CommercialPaper.State::class.java,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -390,7 +390,7 @@ class TwoPartyTradeProtocolTests {
|
||||
notaryNode.info,
|
||||
bobNode.info.identity,
|
||||
"alice's paper".outputStateAndRef(),
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
ALICE_KEY,
|
||||
buyerSessionID
|
||||
)
|
||||
@ -398,7 +398,7 @@ class TwoPartyTradeProtocolTests {
|
||||
bobNode.smm,
|
||||
notaryNode.info,
|
||||
aliceNode.info.identity,
|
||||
1000.DOLLARS `issued by` issuer,
|
||||
1000.DOLLARS,
|
||||
CommercialPaper.State::class.java,
|
||||
buyerSessionID
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ class WalletWithCashTest {
|
||||
|
||||
// A tx that spends our money.
|
||||
val spendTX = TransactionType.General.Builder().apply {
|
||||
Cash().generateSpend(this, 80.DOLLARS `issued by` MEGA_CORP.ref(1), BOB_PUBKEY, listOf(myOutput))
|
||||
Cash().generateSpend(this, 80.DOLLARS, BOB_PUBKEY, listOf(myOutput))
|
||||
signWith(freshKey)
|
||||
signWith(DUMMY_NOTARY_KEY)
|
||||
}.toSignedTransaction()
|
||||
|
Reference in New Issue
Block a user