package Ġnet . cord a . core . internal Ċ Ċ import Ġnet . cord a . core . Delete For DJ VM Ċ import Ġnet . cord a . core . contracts .* Ċ import Ġnet . cord a . core . node . Services For Resolution Ċ import Ġnet . cord a . core . node . services . Attachment Id Ċ import Ġnet . cord a . core . transactions . Contract Upgrade Wire Transaction Ċ Ċ @ Delete For DJ VM Ċ object ĠContract Upgrade Utils Ġ{ ĊĠĠĠ Ġfun Ġ< Old State Ġ: ĠContract State , ĠNew State Ġ: ĠContract State > Ġassemble Upgrade Tx ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstate And Ref : ĠState And Ref < Old State >, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġupgraded Contract Class : ĠClass < out ĠUp graded Contract < Old State , ĠNew State >>, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprivacy Salt : ĠPrivacy Salt , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġservices : ĠServices For Resolution ĊĠĠĠ Ġ): ĠContract Upgrade Wire Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( state And Ref . state . enc um br ance Ġ== Ġnull ) Ġ{ Ġ" Up grading Ġan Ġenc umber ed Ġstate Ġis Ġnot Ġyet Ġsupported " Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġlegacy Constraint Ġ= Ġstate And Ref . state . constraint ĊĠĠĠĠĠĠĠ Ġval Ġlegacy Contract Attachment Id Ġ= Ġwhen Ġ( legacy Constraint ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠHash Attachment Constraint Ġ-> Ġlegacy Constraint . attachment Id ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġget Contract Attachment Id ( state And Ref . state . contract , Ġservices ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġupgraded Contract Attachment Id Ġ= Ġget Contract Attachment Id ( up graded Contract Class . name , Ġservices ) ĊĊĠĠĠĠĠĠĠ Ġval Ġinputs Ġ= ĠlistOf ( state And Ref . ref ) ĊĠĠĠĠĠĠĠ Ġreturn ĠContract Upgrade Transaction Builder ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinputs , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstate And Ref . state . not ary , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlegacy Contract Attachment Id , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġupgraded Contract Class . name , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġupgraded Contract Attachment Id , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivacy Salt ĊĠĠĠĠĠĠĠ Ġ). build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Contract Attachment Id ( name : ĠContract ClassName , Ġservices : ĠServices For Resolution ): ĠAttachment Id Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġservices . cord app Provider . get Contract Attachment ID ( name ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠIllegalStateException (" Attachment Ġnot Ġfound Ġfor Ġcontract : Ġ$ name ") ĊĠĠĠ Ġ} Ċ }