diff --git a/contracts/src/main/java/com/r3corda/contracts/JavaCommercialPaper.java b/contracts/src/main/java/com/r3corda/contracts/JavaCommercialPaper.java index ee3a7eda9f..d427299188 100644 --- a/contracts/src/main/java/com/r3corda/contracts/JavaCommercialPaper.java +++ b/contracts/src/main/java/com/r3corda/contracts/JavaCommercialPaper.java @@ -1,5 +1,8 @@ package com.r3corda.contracts; +import com.r3corda.contracts.cash.Cash; +import com.r3corda.contracts.cash.CashKt; +import com.r3corda.contracts.cash.InsufficientBalanceException; import com.r3corda.core.contracts.TransactionForVerification.InOutGroup; import com.r3corda.core.contracts.*; import com.r3corda.core.crypto.NullPublicKey; diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt b/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt index f0e11bbb45..1a0f8ddc85 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/CommercialPaper.kt @@ -1,5 +1,8 @@ package com.r3corda.contracts +import com.r3corda.contracts.cash.Cash +import com.r3corda.contracts.cash.InsufficientBalanceException +import com.r3corda.contracts.cash.sumCashBy import com.r3corda.core.* import com.r3corda.core.contracts.* import com.r3corda.core.crypto.NullPublicKey diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/CrowdFund.kt b/contracts/src/main/kotlin/com/r3corda/contracts/CrowdFund.kt index 4cdb715b79..4e39361ce4 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/CrowdFund.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/CrowdFund.kt @@ -1,5 +1,8 @@ package com.r3corda.contracts +import com.r3corda.contracts.cash.Cash +import com.r3corda.contracts.cash.sumCash +import com.r3corda.contracts.cash.sumCashBy import com.r3corda.core.* import com.r3corda.core.contracts.* import com.r3corda.core.crypto.Party diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/Cash.kt b/contracts/src/main/kotlin/com/r3corda/contracts/cash/Cash.kt similarity index 98% rename from contracts/src/main/kotlin/com/r3corda/contracts/Cash.kt rename to contracts/src/main/kotlin/com/r3corda/contracts/cash/Cash.kt index 1c24eaf4fb..b64d2106b6 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/Cash.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/cash/Cash.kt @@ -1,8 +1,5 @@ -package com.r3corda.contracts +package com.r3corda.contracts.cash -import com.r3corda.contracts.cash.CashIssuanceDefinition -import com.r3corda.contracts.cash.CommonCashState -import com.r3corda.core.* import com.r3corda.core.contracts.* import com.r3corda.core.crypto.Party import com.r3corda.core.crypto.SecureHash @@ -276,5 +273,4 @@ fun Iterable.sumCash() = filterIsInstance().map { it. fun Iterable.sumCashOrNull() = filterIsInstance().map { it.amount }.sumOrNull() /** Sums the cash states in the list, returning zero of the given currency if there are none. */ -fun Iterable.sumCashOrZero(currency: Currency) = filterIsInstance().map { it.amount }.sumOrZero(currency) - +fun Iterable.sumCashOrZero(currency: Currency) = filterIsInstance().map { it.amount }.sumOrZero(currency) \ No newline at end of file diff --git a/contracts/src/main/kotlin/com/r3corda/contracts/testing/TestUtils.kt b/contracts/src/main/kotlin/com/r3corda/contracts/testing/TestUtils.kt index abc44fae51..246be01388 100644 --- a/contracts/src/main/kotlin/com/r3corda/contracts/testing/TestUtils.kt +++ b/contracts/src/main/kotlin/com/r3corda/contracts/testing/TestUtils.kt @@ -1,6 +1,8 @@ package com.r3corda.contracts.testing import com.r3corda.contracts.* +import com.r3corda.contracts.cash.Cash +import com.r3corda.contracts.cash.CASH_PROGRAM_ID import com.r3corda.core.contracts.Amount import com.r3corda.core.contracts.Contract import com.r3corda.core.crypto.NullPublicKey diff --git a/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt b/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt index 98aa195b6f..46b6f6f4e8 100644 --- a/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt +++ b/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt @@ -1,8 +1,8 @@ package com.r3corda.protocols import co.paralleluniverse.fibers.Suspendable -import com.r3corda.contracts.Cash -import com.r3corda.contracts.sumCashBy +import com.r3corda.contracts.cash.Cash +import com.r3corda.contracts.cash.sumCashBy import com.r3corda.core.contracts.* import com.r3corda.core.crypto.DigitalSignature import com.r3corda.core.crypto.Party diff --git a/contracts/src/test/kotlin/com/r3corda/contracts/CommercialPaperTests.kt b/contracts/src/test/kotlin/com/r3corda/contracts/CommercialPaperTests.kt index ee3b4f270d..5ce1959d2d 100644 --- a/contracts/src/test/kotlin/com/r3corda/contracts/CommercialPaperTests.kt +++ b/contracts/src/test/kotlin/com/r3corda/contracts/CommercialPaperTests.kt @@ -2,12 +2,14 @@ package com.r3corda.contracts import com.r3corda.contracts.testing.CASH import com.r3corda.contracts.testing.`owned by` +import com.r3corda.contracts.cash.Cash import com.r3corda.core.contracts.* import com.r3corda.core.crypto.SecureHash import com.r3corda.core.days import com.r3corda.core.node.services.testing.MockStorageService import com.r3corda.core.seconds import com.r3corda.core.testing.* + import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized diff --git a/contracts/src/test/kotlin/com/r3corda/contracts/CrowdFundTests.kt b/contracts/src/test/kotlin/com/r3corda/contracts/CrowdFundTests.kt index 79331f9b61..5f837282af 100644 --- a/contracts/src/test/kotlin/com/r3corda/contracts/CrowdFundTests.kt +++ b/contracts/src/test/kotlin/com/r3corda/contracts/CrowdFundTests.kt @@ -1,5 +1,6 @@ package com.r3corda.contracts +import com.r3corda.contracts.cash.Cash import com.r3corda.contracts.testing.CASH import com.r3corda.contracts.testing.`owned by` import com.r3corda.core.contracts.* diff --git a/contracts/src/test/kotlin/com/r3corda/contracts/CashTests.kt b/contracts/src/test/kotlin/com/r3corda/contracts/cash/CashTests.kt similarity index 98% rename from contracts/src/test/kotlin/com/r3corda/contracts/CashTests.kt rename to contracts/src/test/kotlin/com/r3corda/contracts/cash/CashTests.kt index d034124a20..1152d576d8 100644 --- a/contracts/src/test/kotlin/com/r3corda/contracts/CashTests.kt +++ b/contracts/src/test/kotlin/com/r3corda/contracts/cash/CashTests.kt @@ -1,10 +1,6 @@ -import com.r3corda.contracts.Cash +package com.r3corda.contracts.cash + import com.r3corda.contracts.DummyContract -import com.r3corda.contracts.InsufficientBalanceException -import com.r3corda.contracts.sumCash -import com.r3corda.contracts.sumCashBy -import com.r3corda.contracts.sumCashOrNull -import com.r3corda.contracts.sumCashOrZero import com.r3corda.contracts.testing.`issued by` import com.r3corda.contracts.testing.`owned by` import com.r3corda.core.contracts.* @@ -45,7 +41,7 @@ class CashTests { tweak { output { outState } // No command arguments - this `fails requirement` "required com.r3corda.contracts.Cash.Commands.Move command" + this `fails requirement` "required com.r3corda.contracts.cash.Cash.Commands.Move command" } tweak { output { outState } @@ -301,7 +297,7 @@ class CashTests { tweak { arg(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS) } - this `fails requirement` "required com.r3corda.contracts.Cash.Commands.Move command" + this `fails requirement` "required com.r3corda.contracts.cash.Cash.Commands.Move command" tweak { arg(DUMMY_PUBKEY_1) { Cash.Commands.Move() } diff --git a/docs/source/release-notes.rst b/docs/source/release-notes.rst index 8861e16a60..547e927203 100644 --- a/docs/source/release-notes.rst +++ b/docs/source/release-notes.rst @@ -8,7 +8,7 @@ Unreleased Here are changes in git master that haven't yet made it to a snapshot release: -* Nothing yet +* The cash contract has moved from com.r3corda.contracts to com.r3corda.contracts.cash. Milestone 0 diff --git a/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt b/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt index 91d59c88b4..04216dd6ea 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/wallet/NodeWalletService.kt @@ -1,7 +1,7 @@ package com.r3corda.node.services.wallet import com.codahale.metrics.Gauge -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.core.ThreadBox import com.r3corda.core.contracts.* import com.r3corda.core.crypto.Party diff --git a/node/src/main/kotlin/com/r3corda/node/services/wallet/WalletImpl.kt b/node/src/main/kotlin/com/r3corda/node/services/wallet/WalletImpl.kt index e3d5cb5cec..c400ca62b6 100644 --- a/node/src/main/kotlin/com/r3corda/node/services/wallet/WalletImpl.kt +++ b/node/src/main/kotlin/com/r3corda/node/services/wallet/WalletImpl.kt @@ -1,6 +1,6 @@ package com.r3corda.node.services.wallet -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.core.contracts.Amount import com.r3corda.core.contracts.ContractState import com.r3corda.core.contracts.StateAndRef diff --git a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt index 179f706a25..519ee494aa 100644 --- a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt @@ -1,7 +1,7 @@ package com.r3corda.node.messaging import com.google.common.util.concurrent.ListenableFuture -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.contracts.CommercialPaper import com.r3corda.contracts.testing.CASH import com.r3corda.contracts.testing.`issued by` diff --git a/node/src/test/kotlin/com/r3corda/node/services/NodeInterestRatesTest.kt b/node/src/test/kotlin/com/r3corda/node/services/NodeInterestRatesTest.kt index fdcc3fa3a1..52eabed3eb 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/NodeInterestRatesTest.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/NodeInterestRatesTest.kt @@ -1,6 +1,6 @@ package com.r3corda.node.services -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.contracts.testing.CASH import com.r3corda.contracts.testing.`owned by` import com.r3corda.core.bd diff --git a/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt b/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt index bd4f3c7130..c5dc65b40a 100644 --- a/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt +++ b/node/src/test/kotlin/com/r3corda/node/services/NodeWalletServiceTest.kt @@ -1,6 +1,6 @@ package com.r3corda.node.services -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.core.contracts.DOLLARS import com.r3corda.core.contracts.TransactionBuilder import com.r3corda.core.contracts.USD diff --git a/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt b/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt index 10529b6ab0..3b3202f87c 100644 --- a/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt +++ b/src/main/kotlin/com/r3corda/demos/RateFixDemo.kt @@ -1,6 +1,6 @@ package com.r3corda.demos -import com.r3corda.contracts.Cash +import com.r3corda.contracts.cash.Cash import com.r3corda.core.contracts.DOLLARS import com.r3corda.core.contracts.FixOf import com.r3corda.core.contracts.TransactionBuilder