package Ġcom . template . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġcom . r 3 . cord a . lib . tokens . contracts . commands . Re deem Token Command Ċ import Ġcom . r 3 . cord a . lib . tokens . contracts . utilities . without Issuer Ċ import Ġcom . r 3 . cord a . lib . tokens . selection . Token Query By Ċ import Ġcom . r 3 . cord a . lib . tokens . selection . database . selector . Database Token Selection Ċ import Ġcom . r 3 . cord a . lib . tokens . workflows . flows . re deem . add F ung ible Tokens To Re deem Ċ import Ġcom . r 3 . cord a . lib . tokens . workflows . flows . re deem . add Tokens To Re deem Ċ import Ġcom . template . contracts . Cause Contract Ċ import Ġcom . template . states . Cause Ċ import Ġnet . cord a . core . contracts . Unique Identifier Ċ import Ġnet . cord a . core . flows .* Ċ import Ġnet . cord a . core . node . services . vault . Query Criteria Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . transactions . Transaction Builder Ċ Ċ @ Initi ating Flow Ċ @ Start able By RPC Ċ class ĠSet tle Cause Flow ( ĊĠĠĠ Ġval Ġcause Id Ġ: ĠUnique Identifier Ċ ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnot ary Ġ= Ġservice Hub . network Map Cache . not ary Id entities [ 0 ] ĊĊĠĠĠĠĠĠĠ Ġval Ġcriteria Ġ= ĠQuery Criteria . Linear State Query Criteria ( linear Id Ġ= ĠlistOf ( cause Id )) ĊĠĠĠĠĠĠĠ Ġval Ġcause State In Ġ= Ġservice Hub . vault Service . query By ( Cause :: class . java , Ġcriteria ). states . single () ĊĊĠĠĠĠĠĠĠ Ġval Ġtx Builder Ġ= ĠTransaction Builder ( not ary ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Input State ( cause State In ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Command ( Cause Contract . Commands . Set tle (), ĠlistOf ( our Identity . own ing Key )) ĊĊĠĠĠĠĠĠĠ Ġval Ġamount Ġ= Ġcause State In . state . data . needed Amount ĊĊĠĠĠĠĠĠĠ Ġadd F ung ible Tokens To Re deem ( tx Builder , Ġservice Hub , Ġamount . without Issuer (), Ġamount . token . issuer , Ġour Identity ) ĊĊĠĠĠĠĠĠĠ Ġtx Builder . verify ( service Hub ) ĊĊĠĠĠĠĠĠĠ Ġval Ġissuer Session Ġ= Ġinitiate Flow ( amount . token . issuer ) ĊĊĠĠĠĠĠĠĠ Ġval Ġp tx Ġ= Ġservice Hub . sign Initial Transaction ( tx Builder ) ĊĊĠĠĠĠĠĠĠ Ġval Ġst x Ġ= Ġsub Flow ( Collect Signatures Flow ( pt x , ĠlistOf ( issuer Session ))) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Final ity Flow ( st x , ĠlistOf ( issuer Session ))) ĊĠĠĠ Ġ} Ċ }