mirror of
https://github.com/corda/corda.git
synced 2025-01-01 02:36:44 +00:00
Remove use of names from contracts
Remove dependency on name data that cash/obligation state objects will not have access to party details (such as name) once privacy is correctly enforced.
This commit is contained in:
parent
8cb27f1052
commit
998aa8e024
@ -190,7 +190,7 @@ class Obligation<P> : Contract {
|
||||
"amount in settle command ${command.value.amount} matches settled total $totalAmountSettled" by (command.value.amount == totalAmountSettled)
|
||||
"signatures are present from all obligors" by command.signers.containsAll(requiredSigners)
|
||||
"there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L }
|
||||
"at obligor ${obligor.name} the obligations after settlement balance" by
|
||||
"at obligor ${obligor} the obligations after settlement balance" by
|
||||
(inputAmount == outputAmount + Amount(totalPenniesSettled, groupingKey))
|
||||
}
|
||||
return setOf(command.value)
|
||||
|
@ -99,7 +99,7 @@ abstract class AbstractConserveAmount<S : FungibleAsset<T>, C : CommandData, T :
|
||||
|
||||
requireThat {
|
||||
"there are no zero sized inputs" by inputs.none { it.amount.quantity == 0L }
|
||||
"for reference ${deposit.reference} at issuer ${deposit.party.name} the amounts balance: ${inputAmount.quantity} - ${amountExitingLedger.quantity} != ${outputAmount.quantity}" by
|
||||
"for reference ${deposit.reference} at issuer ${deposit.party} the amounts balance: ${inputAmount.quantity} - ${amountExitingLedger.quantity} != ${outputAmount.quantity}" by
|
||||
(inputAmount == outputAmount + amountExitingLedger)
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class CashTests {
|
||||
// Move fails: not allowed to summon money.
|
||||
tweak {
|
||||
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
|
||||
// Issue works.
|
||||
@ -305,14 +305,14 @@ class CashTests {
|
||||
transaction {
|
||||
input { inState }
|
||||
output { outState `issued by` MINI_CORP }
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Can't change deposit reference when splitting.
|
||||
transaction {
|
||||
input { inState }
|
||||
output { outState.copy(amount = inState.amount / 2).editDepositRef(0) }
|
||||
output { outState.copy(amount = inState.amount / 2).editDepositRef(1) }
|
||||
this `fails with` "for reference [01] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Can't mix currencies.
|
||||
transaction {
|
||||
@ -338,7 +338,7 @@ class CashTests {
|
||||
input { inState `issued by` MINI_CORP }
|
||||
output { outState }
|
||||
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
|
||||
this `fails with` "at issuer MiniCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Can't combine two different deposits at the same issuer.
|
||||
transaction {
|
||||
@ -386,10 +386,10 @@ class CashTests {
|
||||
|
||||
command(MEGA_CORP_PUBKEY, MINI_CORP_PUBKEY) { Cash.Commands.Move() }
|
||||
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
|
||||
command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) }
|
||||
this `fails with` "at issuer MiniCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
|
||||
command(MINI_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` MINI_CORP.ref(defaultRef)) }
|
||||
this.verifies()
|
||||
@ -404,7 +404,7 @@ class CashTests {
|
||||
output { outState.copy(amount = inState.amount - (200.DOLLARS `issued by` defaultIssuer)) }
|
||||
command(MEGA_CORP_PUBKEY) { Cash.Commands.Exit(200.DOLLARS `issued by` defaultIssuer) }
|
||||
command(DUMMY_PUBKEY_1) { Cash.Commands.Move() }
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,13 +418,13 @@ class CashTests {
|
||||
// Can't merge them together.
|
||||
tweak {
|
||||
output { inState.copy(owner = DUMMY_PUBKEY_2, amount = 2000.DOLLARS `issued by` defaultIssuer) }
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Missing MiniCorp deposit
|
||||
tweak {
|
||||
output { inState.copy(owner = DUMMY_PUBKEY_2) }
|
||||
output { inState.copy(owner = DUMMY_PUBKEY_2) }
|
||||
this `fails with` "at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
|
||||
// This works.
|
||||
|
@ -143,7 +143,7 @@ class ObligationTests {
|
||||
// Move fails: not allowed to summon money.
|
||||
tweak {
|
||||
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
|
||||
// Issue works.
|
||||
@ -609,7 +609,7 @@ class ObligationTests {
|
||||
transaction {
|
||||
input { inState }
|
||||
output { outState `issued by` MINI_CORP }
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Can't mix currencies.
|
||||
transaction {
|
||||
@ -636,7 +636,7 @@ class ObligationTests {
|
||||
input { inState `issued by` MINI_CORP }
|
||||
output { outState }
|
||||
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
|
||||
this `fails with` "for reference [00] at issuer MiniCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
}
|
||||
|
||||
@ -678,10 +678,10 @@ class ObligationTests {
|
||||
|
||||
command(DUMMY_PUBKEY_1) { Obligation.Commands.Move() }
|
||||
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
|
||||
command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.DOLLARS.quantity, inState.amount.token.copy(product = megaCorpDollarSettlement))) }
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
|
||||
command(DUMMY_PUBKEY_1) { Obligation.Commands.Exit(Amount(200.POUNDS.quantity, inState.amount.token.copy(product = megaCorpPoundSettlement))) }
|
||||
this.verifies()
|
||||
@ -698,13 +698,13 @@ class ObligationTests {
|
||||
// Can't merge them together.
|
||||
tweak {
|
||||
output { inState.copy(beneficiary = DUMMY_PUBKEY_2, quantity = 200000L) }
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
// Missing MiniCorp deposit
|
||||
tweak {
|
||||
output { inState.copy(beneficiary = DUMMY_PUBKEY_2) }
|
||||
output { inState.copy(beneficiary = DUMMY_PUBKEY_2) }
|
||||
this `fails with` "for reference [00] at issuer MegaCorp the amounts balance"
|
||||
this `fails with` "the amounts balance"
|
||||
}
|
||||
|
||||
// This works.
|
||||
|
Loading…
Reference in New Issue
Block a user