SHARE
TWEET

Untitled

a guest Jun 18th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. IOUState:
  2. @BelongsToContract(IOUContract::class)
  3. data class IOUState(val value: Int,
  4.                     val lender: Party,
  5.                     val borrower: Party,
  6.                     val thirdParty: Party,
  7.                     override val linearId: UniqueIdentifier = UniqueIdentifier()):
  8.         LinearState, QueryableState {
  9.     /** The public keys of the involved parties. */
  10.     //override val participants: MutableList<AbstractParty> get() = mutableListOf(lender, borrower)
  11.     override val participants = mutableListOf(lender, borrower)
  12.  
  13.  
  14. ExampleFlow:
  15. var iouState = IOUState(iouValue, serviceHub.myInfo.legalIdentities.first(), otherParty, thirdParty)
  16.  
  17. iouState.participants.add(thirdParty)
  18.  
  19. val txCommand = Command(IOUContract.Commands.Create(), iouState.participants.map { it.owningKey })
  20.  
  21. val counterparties = iouState.participants.map { it as Party }.filter { it.owningKey != ourIdentity.owningKey }.toSet()
  22.  
  23. counterparties.forEach { p -> flowSessions.add(initiateFlow(p))}
  24.  
  25. val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, flowSessions, GATHERING_SIGS.childProgressTracker()))
  26.  
  27.             // Stage 5.
  28.             progressTracker.currentStep = FINALISING_TRANSACTION
  29.             // Notarise and record the transaction in both parties' vaults.
  30.             return subFlow(FinalityFlow(fullySignedTx, flowSessions, FINALISING_TRANSACTION.childProgressTracker()))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top