mirror of
https://github.com/corda/corda.git
synced 2024-12-20 05:28:21 +00:00
Merged in rnicoll-cash-move (pull request #120)
Move cash contract into its own package
This commit is contained in:
commit
fae934e7b0
@ -1,5 +1,8 @@
|
|||||||
package com.r3corda.contracts;
|
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.TransactionForVerification.InOutGroup;
|
||||||
import com.r3corda.core.contracts.*;
|
import com.r3corda.core.contracts.*;
|
||||||
import com.r3corda.core.crypto.NullPublicKey;
|
import com.r3corda.core.crypto.NullPublicKey;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.r3corda.contracts
|
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.*
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
import com.r3corda.core.crypto.NullPublicKey
|
import com.r3corda.core.crypto.NullPublicKey
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.r3corda.contracts
|
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.*
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
import com.r3corda.core.crypto.Party
|
import com.r3corda.core.crypto.Party
|
||||||
|
@ -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.contracts.*
|
||||||
import com.r3corda.core.crypto.Party
|
import com.r3corda.core.crypto.Party
|
||||||
import com.r3corda.core.crypto.SecureHash
|
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()
|
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. */
|
/** 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)
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
package com.r3corda.contracts.testing
|
package com.r3corda.contracts.testing
|
||||||
|
|
||||||
import com.r3corda.contracts.*
|
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.Amount
|
||||||
import com.r3corda.core.contracts.Contract
|
import com.r3corda.core.contracts.Contract
|
||||||
import com.r3corda.core.crypto.NullPublicKey
|
import com.r3corda.core.crypto.NullPublicKey
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.r3corda.protocols
|
package com.r3corda.protocols
|
||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import com.r3corda.contracts.Cash
|
import com.r3corda.contracts.cash.Cash
|
||||||
import com.r3corda.contracts.sumCashBy
|
import com.r3corda.contracts.cash.sumCashBy
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
import com.r3corda.core.crypto.DigitalSignature
|
import com.r3corda.core.crypto.DigitalSignature
|
||||||
import com.r3corda.core.crypto.Party
|
import com.r3corda.core.crypto.Party
|
||||||
|
@ -2,12 +2,14 @@ package com.r3corda.contracts
|
|||||||
|
|
||||||
import com.r3corda.contracts.testing.CASH
|
import com.r3corda.contracts.testing.CASH
|
||||||
import com.r3corda.contracts.testing.`owned by`
|
import com.r3corda.contracts.testing.`owned by`
|
||||||
|
import com.r3corda.contracts.cash.Cash
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
import com.r3corda.core.crypto.SecureHash
|
import com.r3corda.core.crypto.SecureHash
|
||||||
import com.r3corda.core.days
|
import com.r3corda.core.days
|
||||||
import com.r3corda.core.node.services.testing.MockStorageService
|
import com.r3corda.core.node.services.testing.MockStorageService
|
||||||
import com.r3corda.core.seconds
|
import com.r3corda.core.seconds
|
||||||
import com.r3corda.core.testing.*
|
import com.r3corda.core.testing.*
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.junit.runners.Parameterized
|
import org.junit.runners.Parameterized
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.r3corda.contracts
|
package com.r3corda.contracts
|
||||||
|
|
||||||
|
import com.r3corda.contracts.cash.Cash
|
||||||
import com.r3corda.contracts.testing.CASH
|
import com.r3corda.contracts.testing.CASH
|
||||||
import com.r3corda.contracts.testing.`owned by`
|
import com.r3corda.contracts.testing.`owned by`
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import com.r3corda.contracts.Cash
|
package com.r3corda.contracts.cash
|
||||||
|
|
||||||
import com.r3corda.contracts.DummyContract
|
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.`issued by`
|
||||||
import com.r3corda.contracts.testing.`owned by`
|
import com.r3corda.contracts.testing.`owned by`
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
@ -45,7 +41,7 @@ class CashTests {
|
|||||||
tweak {
|
tweak {
|
||||||
output { outState }
|
output { outState }
|
||||||
// No command arguments
|
// 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 {
|
tweak {
|
||||||
output { outState }
|
output { outState }
|
||||||
@ -301,7 +297,7 @@ class CashTests {
|
|||||||
|
|
||||||
tweak {
|
tweak {
|
||||||
arg(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS) }
|
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 {
|
tweak {
|
||||||
arg(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
|
arg(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
|
@ -8,7 +8,7 @@ Unreleased
|
|||||||
|
|
||||||
Here are changes in git master that haven't yet made it to a snapshot release:
|
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
|
Milestone 0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.r3corda.node.services.wallet
|
package com.r3corda.node.services.wallet
|
||||||
|
|
||||||
import com.codahale.metrics.Gauge
|
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.ThreadBox
|
||||||
import com.r3corda.core.contracts.*
|
import com.r3corda.core.contracts.*
|
||||||
import com.r3corda.core.crypto.Party
|
import com.r3corda.core.crypto.Party
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.r3corda.node.services.wallet
|
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.Amount
|
||||||
import com.r3corda.core.contracts.ContractState
|
import com.r3corda.core.contracts.ContractState
|
||||||
import com.r3corda.core.contracts.StateAndRef
|
import com.r3corda.core.contracts.StateAndRef
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.r3corda.node.messaging
|
package com.r3corda.node.messaging
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture
|
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.CommercialPaper
|
||||||
import com.r3corda.contracts.testing.CASH
|
import com.r3corda.contracts.testing.CASH
|
||||||
import com.r3corda.contracts.testing.`issued by`
|
import com.r3corda.contracts.testing.`issued by`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.r3corda.node.services
|
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.CASH
|
||||||
import com.r3corda.contracts.testing.`owned by`
|
import com.r3corda.contracts.testing.`owned by`
|
||||||
import com.r3corda.core.bd
|
import com.r3corda.core.bd
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.r3corda.node.services
|
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.DOLLARS
|
||||||
import com.r3corda.core.contracts.TransactionBuilder
|
import com.r3corda.core.contracts.TransactionBuilder
|
||||||
import com.r3corda.core.contracts.USD
|
import com.r3corda.core.contracts.USD
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.r3corda.demos
|
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.DOLLARS
|
||||||
import com.r3corda.core.contracts.FixOf
|
import com.r3corda.core.contracts.FixOf
|
||||||
import com.r3corda.core.contracts.TransactionBuilder
|
import com.r3corda.core.contracts.TransactionBuilder
|
||||||
|
Loading…
Reference in New Issue
Block a user