Merged in rnicoll-cash-move (pull request #120)

Move cash contract into its own package
This commit is contained in:
Ross Nicoll 2016-05-31 17:15:12 +01:00
commit fae934e7b0
16 changed files with 29 additions and 23 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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<ContractState>.sumCash() = filterIsInstance<Cash.State>().map { it.
fun Iterable<ContractState>.sumCashOrNull() = filterIsInstance<Cash.State>().map { it.amount }.sumOrNull()
/** Sums the cash states in the list, returning zero of the given currency if there are none. */
fun Iterable<ContractState>.sumCashOrZero(currency: Currency) = filterIsInstance<Cash.State>().map { it.amount }.sumOrZero(currency)
fun Iterable<ContractState>.sumCashOrZero(currency: Currency) = filterIsInstance<Cash.State>().map { it.amount }.sumOrZero(currency)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.*

View File

@ -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() }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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`

View File

@ -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

View File

@ -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

View File

@ -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