Skip to content

Commit 0a08b83

Browse files
committed
Handling the list of tokens in BridgingAuthorityBootstrapService.kt
1 parent 063e51b commit 0a08b83

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

Tokens/stockpaydividend/bridging-flows/src/main/kotlin/com/r3/corda/lib/tokens/bridging/flows/BridgeFungibleTokenFlow.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class BridgeFungibleTokenFlow(
7070
additionalCommand = additionalCommand,
7171
destination = destination,
7272
mint = mint,
73-
mintAuthority = mintAuthority
73+
mintAuthority = mintAuthority,
74+
holder
7475
)
7576
)
7677
}
@@ -106,14 +107,14 @@ constructor(
106107
val additionalCommand: BridgingContract.BridgingCommand,
107108
val destination: Pubkey,
108109
val mint: Pubkey,
109-
val mintAuthority: Pubkey
110+
val mintAuthority: Pubkey,
111+
val holder: AbstractParty
110112
) : AbstractMoveTokensFlow() { //TODO move away from this abstract class, it's progress tracker mention only token move
111113

112114
@Suspendable
113115
override fun addMove(transactionBuilder: TransactionBuilder) {
114116

115117
val amount = token.state.data.amount
116-
val holder = ourIdentity //TODO confidential identity
117118
val output = FungibleToken(amount, holder)
118119
addMoveTokens(transactionBuilder = transactionBuilder, inputs = listOf(token), outputs = listOf(output))
119120

Tokens/stockpaydividend/bridging-flows/src/main/kotlin/com/r3/corda/lib/tokens/bridging/flows/BridgingAuthorityBootstrapService.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ class BridgingAuthorityBootstrapService(appServiceHub: AppServiceHub) : Singleto
5757

5858
private fun callFlow(producedStockStates: Collection<StockState>, appServiceHub: AppServiceHub) {
5959
producedStockStates.forEach { stockState ->
60-
val tokens = appServiceHub.vaultService.tokenAmountsByToken(
60+
appServiceHub.vaultService.tokenAmountsByToken(
6161
stockState.toPointer(
6262
stockState.javaClass
6363
)
64-
).states
65-
appServiceHub.startFlow(
66-
BridgeFungibleTokenFlow(
67-
holdingIdentityPartyAndCertificate.party,
68-
emptyList(),
69-
tokens.first(), //TODO handle multiple tokens
70-
bridgeAuthorityParty
64+
).states.forEach { token ->
65+
appServiceHub.startFlow(
66+
BridgeFungibleTokenFlow(
67+
holdingIdentityPartyAndCertificate.party,
68+
emptyList(),
69+
token,
70+
bridgeAuthorityParty
71+
)
7172
)
72-
)
73+
}
7374
}
7475
}
7576

Tokens/stockpaydividend/bridging-flows/src/main/kotlin/com/r3/corda/lib/tokens/bridging/flows/rpc/BridgeTokens.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import com.r3.corda.lib.tokens.contracts.states.FungibleToken
1010
import net.corda.core.contracts.StateAndRef
1111
import net.corda.core.utilities.ProgressTracker
1212

13+
// This flow is only for tests. In real life the @BridgingAuthorityBootstrapService.kt would run the BridgeFungibleTokenFlow directly.
1314
@InitiatingFlow
1415
@StartableByRPC
1516
class BridgeToken(
16-
val token: StateAndRef<FungibleToken>, //TODO change to a list?
17+
val token: StateAndRef<FungibleToken>,
1718
val bridgeAuthority: Party
1819
) : FlowLogic<String>() {
1920

@@ -25,7 +26,7 @@ class BridgeToken(
2526
//Use built-in flow for move tokens to the recipient
2627
val stx = subFlow(
2728
BridgeFungibleTokenFlow(
28-
ourIdentity, //TODO confidentialIdentity
29+
ourIdentity,
2930
emptyList(),
3031
token,
3132
bridgeAuthority

0 commit comments

Comments
 (0)