Skip to content

Instantly share code, notes, and snippets.

@amolpednekar
Last active January 8, 2019 04:36
Show Gist options
  • Save amolpednekar/5234d4a651b007a66734156c4b5c7e80 to your computer and use it in GitHub Desktop.
Save amolpednekar/5234d4a651b007a66734156c4b5c7e80 to your computer and use it in GitHub Desktop.
// Authorise the upgrade of all the State instances using OldContract.
listOf(partyAProxy, partyBProxy).forEach { proxy ->
// Extract all the unconsumed State instances from the vault.
val stateAndRefs = proxy.vaultQuery(OldState::class.java).states
// Run the upgrade flow for each one.
stateAndRefs
.filter { stateAndRef ->
stateAndRef.state.contract.equals(OldContract.id)
}.forEach { stateAndRef ->
proxy.startFlowDynamic(
ContractUpgradeFlow.Authorise::class.java,
stateAndRef,
NewContractAndState::class.java)
}
}
Thread.sleep(5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment