Skip to content

Commit 3965876

Browse files
authored
Add comment with a reason for not using client smart contract (#278)
1 parent 8211e30 commit 3965876

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

fplus-http-server/src/router/application.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub async fn trigger(
8787
let CompleteGovernanceReviewInfo {
8888
allocation_amount,
8989
client_contract_address,
90+
reason_for_not_using_client_smart_contract,
9091
} = info.into_inner();
9192
let response = ldn_application
9293
.complete_governance_review(
@@ -95,6 +96,7 @@ pub async fn trigger(
9596
query.repo.clone(),
9697
allocation_amount,
9798
client_contract_address,
99+
reason_for_not_using_client_smart_contract,
98100
)
99101
.await
100102
.map_err(ErrorBadRequest)?;

fplus-lib/src/core/mod.rs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ pub struct ApplicationQueryParams {
237237
pub struct CompleteGovernanceReviewInfo {
238238
pub allocation_amount: String,
239239
pub client_contract_address: Option<String>,
240+
pub reason_for_not_using_client_smart_contract: Option<String>,
240241
}
241242

242243
#[derive(Deserialize)]
@@ -998,6 +999,7 @@ impl LDNApplication {
998999
repo: String,
9991000
allocation_amount: String,
10001001
client_contract_address: Option<String>,
1002+
reason_for_not_using_client_smart_contract: Option<String>,
10011003
) -> Result<ApplicationFile, LDNError> {
10021004
let app_state = self.app_state().await?;
10031005
if app_state != AppState::KYCRequested
@@ -1074,7 +1076,7 @@ impl LDNApplication {
10741076
file_content,
10751077
Some(app_path.clone()),
10761078
None,
1077-
client_contract_address,
1079+
client_contract_address.clone(),
10781080
)
10791081
.await
10801082
.map_err(|e| {
@@ -1100,11 +1102,25 @@ impl LDNApplication {
11001102
.await?;
11011103
Self::add_comment_to_issue(
11021104
app_file.issue_number.clone(),
1103-
owner,
1104-
repo,
1105+
owner.clone(),
1106+
repo.clone(),
11051107
"Application is ready to sign".to_string(),
11061108
)
11071109
.await?;
1110+
if let Some(reason_for_not_using_client_smart_contract) =
1111+
reason_for_not_using_client_smart_contract
1112+
{
1113+
Self::add_comment_to_issue(
1114+
app_file.issue_number.clone(),
1115+
owner.clone(),
1116+
repo.clone(),
1117+
format!(
1118+
"## Reason for not using Client Smart Contract\n {}",
1119+
reason_for_not_using_client_smart_contract
1120+
),
1121+
)
1122+
.await?;
1123+
}
11081124
}
11091125

11101126
Ok(app_file)
@@ -1589,6 +1605,19 @@ impl LDNApplication {
15891605

15901606
self.issue_updates(&app_file.issue_number, comment, label)
15911607
.await?;
1608+
1609+
if app_file.allocation.0.len() == 1 {
1610+
if let Some(client_contract_address) = app_file.client_contract_address.clone() {
1611+
Self::add_comment_to_issue(
1612+
app_file.issue_number.clone(),
1613+
owner.clone(),
1614+
repo.clone(),
1615+
format!("## Allocation has been made through the Client Smart Contract\nContract address: `{}`\n[How to create verified DDO deals using DataCap?](https://github.com/fidlabs/contract-metaallocator/blob/main/HowToUseClientSmartContract.md#this-step-by-step-guide-explains-how-to-create-verified-ddo-deals-using-datacap-granted-through-a-client-smart-contract-with-boost)", client_contract_address),
1616+
)
1617+
.await?;
1618+
}
1619+
}
1620+
15921621
Ok(app_file)
15931622
}
15941623

0 commit comments

Comments
 (0)