mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +00:00
contracts: Remove warnings
This commit is contained in:
parent
3faf268feb
commit
a2e6e78b16
@ -229,7 +229,7 @@ public class JavaCommercialPaper implements Contract {
|
|||||||
return SecureHash.sha256("https://en.wikipedia.org/wiki/Commercial_paper");
|
return SecureHash.sha256("https://en.wikipedia.org/wiki/Commercial_paper");
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
|
public TransactionBuilder generateIssue(@NotNull PartyAndReference issuance, @NotNull Amount<Issued<Currency>> faceValue, @Nullable Instant maturityDate, @NotNull Party notary) {
|
||||||
State state = new State(issuance, issuance.getParty().getOwningKey(), faceValue, maturityDate);
|
State state = new State(issuance, issuance.getParty().getOwningKey(), faceValue, maturityDate);
|
||||||
TransactionState output = new TransactionState<>(state, notary);
|
TransactionState output = new TransactionState<>(state, notary);
|
||||||
return new TransactionType.General.Builder().withItems(output, new Command(new Commands.Issue(), issuance.getParty().getOwningKey()));
|
return new TransactionType.General.Builder().withItems(output, new Command(new Commands.Issue(), issuance.getParty().getOwningKey()));
|
||||||
|
@ -172,7 +172,7 @@ class Cash : FungibleAsset<Currency>() {
|
|||||||
val keysUsed = gathered.map { it.state.data.owner }.toSet()
|
val keysUsed = gathered.map { it.state.data.owner }.toSet()
|
||||||
|
|
||||||
val states = gathered.groupBy { it.state.data.deposit }.map {
|
val states = gathered.groupBy { it.state.data.deposit }.map {
|
||||||
val (deposit, coins) = it
|
val coins = it.value
|
||||||
val totalAmount = coins.map { it.state.data.amount }.sumOrThrow()
|
val totalAmount = coins.map { it.state.data.amount }.sumOrThrow()
|
||||||
TransactionState(State(totalAmount, to), coins.first().state.notary)
|
TransactionState(State(totalAmount, to), coins.first().state.notary)
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ class CashTests {
|
|||||||
makeCash(80.SWISS_FRANCS, MINI_CORP, 2)
|
makeCash(80.SWISS_FRANCS, MINI_CORP, 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
fun makeSpend(amount: Amount<Currency>, dest: PublicKey, corp: Party, depositRef: OpaqueBytes = defaultRef): WireTransaction {
|
fun makeSpend(amount: Amount<Currency>, dest: PublicKey, @Suppress("UNUSED_PARAMETER") corp: Party, @Suppress("UNUSED_PARAMETER") depositRef: OpaqueBytes = defaultRef): WireTransaction {
|
||||||
val tx = TransactionType.General.Builder()
|
val tx = TransactionType.General.Builder()
|
||||||
Cash().generateSpend(tx, amount, dest, WALLET)
|
Cash().generateSpend(tx, amount, dest, WALLET)
|
||||||
return tx.toWireTransaction()
|
return tx.toWireTransaction()
|
||||||
@ -516,8 +516,8 @@ class CashTests {
|
|||||||
Cash.State(4000.DOLLARS `issued by` defaultIssuer, MEGA_CORP_PUBKEY)
|
Cash.State(4000.DOLLARS `issued by` defaultIssuer, MEGA_CORP_PUBKEY)
|
||||||
)
|
)
|
||||||
// Test that summing everything produces the total number of dollars
|
// Test that summing everything produces the total number of dollars
|
||||||
var expected = 7000.DOLLARS `issued by` defaultIssuer
|
val expected = 7000.DOLLARS `issued by` defaultIssuer
|
||||||
var actual = states.sumCash()
|
val actual = states.sumCash()
|
||||||
assertEquals(expected, actual)
|
assertEquals(expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user