@@ -194,6 +194,7 @@ pub struct ApplicationQueryParams {
194194#[ derive( Deserialize ) ]
195195pub struct CompleteGovernanceReviewInfo {
196196 pub allocation_amount : String ,
197+ pub client_contract_address : Option < String > ,
197198}
198199
199200#[ derive( Deserialize ) ]
@@ -847,6 +848,7 @@ impl LDNApplication {
847848 owner : String ,
848849 repo : String ,
849850 allocation_amount : String ,
851+ client_contract_address : Option < String > ,
850852 ) -> Result < ApplicationFile , LDNError > {
851853 match self . app_state ( ) . await {
852854 Ok ( s) => match s {
@@ -878,7 +880,11 @@ impl LDNApplication {
878880 allocation_amount_parsed,
879881 ) ;
880882
881- let app_file = app_file. complete_governance_review ( actor. clone ( ) , request) ;
883+ let app_file = app_file. complete_governance_review (
884+ actor. clone ( ) ,
885+ request,
886+ client_contract_address. clone ( ) ,
887+ ) ;
882888 let file_content = serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ;
883889 let app_path = & self . file_name . clone ( ) ;
884890 let app_branch = self . branch_name . clone ( ) ;
@@ -904,16 +910,23 @@ impl LDNApplication {
904910 Ok ( prs) => {
905911 if let Some ( pr) = prs. first ( ) {
906912 let number = pr. number ;
907- let _ = database:: applications:: update_application (
913+ database:: applications:: update_application (
908914 app_file. id . clone ( ) ,
909915 owner. clone ( ) ,
910916 repo. clone ( ) ,
911917 number,
912918 serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ,
913919 Some ( app_path. clone ( ) ) ,
914920 None ,
921+ client_contract_address,
915922 )
916- . await ;
923+ . await
924+ . map_err ( |e| {
925+ LDNError :: Load ( format ! (
926+ "Failed to update application: {} /// {}" ,
927+ app_file. id, e
928+ ) )
929+ } ) ?;
917930
918931 Self :: issue_datacap_allocation_requested (
919932 app_file. clone ( ) ,
@@ -1064,16 +1077,23 @@ impl LDNApplication {
10641077 Ok ( prs) => {
10651078 if let Some ( pr) = prs. first ( ) {
10661079 let number = pr. number ;
1067- let _ = database:: applications:: update_application (
1080+ database:: applications:: update_application (
10681081 app_file. id . clone ( ) ,
10691082 owner. clone ( ) ,
10701083 repo. clone ( ) ,
10711084 number,
10721085 serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ,
10731086 Some ( self . file_name . clone ( ) ) ,
10741087 None ,
1088+ app_file. client_contract_address . clone ( ) ,
10751089 )
1076- . await ;
1090+ . await
1091+ . map_err ( |e| {
1092+ LDNError :: Load ( format ! (
1093+ "Failed to update application: {} /// {}" ,
1094+ app_file. id, e
1095+ ) )
1096+ } ) ?;
10771097 Self :: issue_start_sign_dc (
10781098 app_file. issue_number . clone ( ) ,
10791099 owner. clone ( ) ,
@@ -1223,6 +1243,7 @@ impl LDNApplication {
12231243 serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ,
12241244 Some ( self . file_name . clone ( ) ) ,
12251245 None ,
1246+ app_file. client_contract_address . clone ( ) ,
12261247 )
12271248 . await
12281249 {
@@ -1994,6 +2015,7 @@ impl LDNApplication {
19942015 serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ,
19952016 Some ( ldn_application. file_name . clone ( ) ) ,
19962017 None ,
2018+ app_file. client_contract_address ,
19972019 )
19982020 . await ;
19992021 }
@@ -2066,6 +2088,7 @@ impl LDNApplication {
20662088 serde_json:: to_string_pretty ( & db_application_file) . unwrap ( ) ,
20672089 Some ( filename. clone ( ) ) ,
20682090 None ,
2091+ db_application_file. client_contract_address . clone ( ) ,
20692092 )
20702093 . await ;
20712094
@@ -2364,6 +2387,7 @@ impl LDNApplication {
23642387 file_content. clone ( ) ,
23652388 Some ( filename. clone ( ) ) ,
23662389 None ,
2390+ application_file. client_contract_address . clone ( ) ,
23672391 )
23682392 . await
23692393 . map_err ( |e| {
@@ -2667,6 +2691,7 @@ impl LDNApplication {
26672691 parsed_ldn. datacap ,
26682692 pr_application. allocation . clone ( ) ,
26692693 pr_application. lifecycle . clone ( ) ,
2694+ pr_application. client_contract_address . clone ( ) ,
26702695 )
26712696 . await ;
26722697
@@ -2722,16 +2747,23 @@ impl LDNApplication {
27222747 if let Some ( pr) = prs. first ( ) {
27232748 let number = pr. number ;
27242749
2725- let _ = database:: applications:: update_application (
2750+ database:: applications:: update_application (
27262751 app_file. id . clone ( ) ,
27272752 application_model. owner . clone ( ) ,
27282753 application_model. repo . clone ( ) ,
27292754 number,
27302755 serde_json:: to_string_pretty ( & app_file) . unwrap ( ) ,
27312756 Some ( application_model. path . clone ( ) . unwrap ( ) ) ,
27322757 None ,
2758+ app_file. client_contract_address ,
27332759 )
2734- . await ;
2760+ . await
2761+ . map_err ( |e| {
2762+ LDNError :: Load ( format ! (
2763+ "Failed to update application: {} /// {}" ,
2764+ app_file. id, e
2765+ ) )
2766+ } ) ?;
27352767 }
27362768 }
27372769 Err ( e) => log:: warn!( "Failed to get pull request by head: {}" , e) ,
@@ -2805,6 +2837,7 @@ impl LDNApplication {
28052837 parsed_ldn. datacap ,
28062838 merged_application. allocation . clone ( ) ,
28072839 merged_application. lifecycle . clone ( ) ,
2840+ merged_application. client_contract_address . clone ( ) ,
28082841 )
28092842 . await ;
28102843
@@ -3482,6 +3515,7 @@ _The initial issue can be edited in order to solve the request of the verifier.
34823515 serde_json:: to_string_pretty ( & gh_app. application_file ) . unwrap ( ) ,
34833516 None ,
34843517 Some ( gh_app. sha . clone ( ) ) ,
3518+ gh_app. application_file . client_contract_address . clone ( ) ,
34853519 )
34863520 . await
34873521 . unwrap ( ) ;
@@ -3564,6 +3598,7 @@ _The initial issue can be edited in order to solve the request of the verifier.
35643598 serde_json:: to_string_pretty ( & gh_app. application_file ) . unwrap ( ) ,
35653599 Some ( gh_app. path . clone ( ) ) ,
35663600 Some ( gh_app. sha . clone ( ) ) ,
3601+ gh_app. application_file . client_contract_address . clone ( ) ,
35673602 )
35683603 . await
35693604 . unwrap ( ) ;
@@ -3787,6 +3822,7 @@ _The initial issue can be edited in order to solve the request of the verifier.
37873822 serde_json:: to_string_pretty ( & application_file) . unwrap ( ) ,
37883823 app_model. path . clone ( ) ,
37893824 None ,
3825+ application_file. client_contract_address . clone ( ) ,
37903826 )
37913827 . await
37923828 . expect ( "Failed to update_application in DB!" ) ;
@@ -3933,6 +3969,7 @@ _The initial issue can be edited in order to solve the request of the verifier.
39333969 serde_json:: to_string_pretty ( & application_file) . unwrap ( ) ,
39343970 app_model. path . clone ( ) ,
39353971 None ,
3972+ application_file. client_contract_address . clone ( ) ,
39363973 )
39373974 . await
39383975 . expect ( "Failed to update_application in DB!" ) ;
0 commit comments