Skip to content

Commit

Permalink
Handle old approach to grant datacap (#241)
Browse files Browse the repository at this point in the history
Co-authored-by: Filip Lelek <[email protected]>
  • Loading branch information
Filip-L and filip-neti authored Nov 4, 2024
1 parent 153d0fb commit 72d0e0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
14 changes: 5 additions & 9 deletions fplus-http-server/src/router/application.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use actix_web::{get, post, web, HttpResponse, Responder};
use fplus_lib::core::{
application::file::{StorageProviderChangeVerifier, VerifierGrantDataCapCids, VerifierInput},
application::file::{StorageProviderChangeVerifier, VerifierInput},
ApplicationQueryParams, BranchDeleteInfo, CompleteGovernanceReviewInfo,
CompleteNewApplicationApprovalInfo, CompleteNewApplicationProposalInfo, CreateApplicationInfo,
DcReachedInfo, GithubQueryParams, LDNApplication, MoreInfoNeeded, NotifyRefillInfo,
Expand Down Expand Up @@ -116,10 +116,8 @@ pub async fn propose(
github_username: query.github_username.clone(), // Use the provided `github_username` parameter
signing_address: signer.signing_address,
created_at: signer.created_at,
message_cids: VerifierGrantDataCapCids {
message_cid: signer.message_cids.message_cid,
increase_allowance_cid: signer.message_cids.increase_allowance_cid,
},
message_cid: signer.message_cids.message_cid,
increase_allowance_cid: signer.message_cids.increase_allowance_cid,
};
match ldn_application
.complete_new_application_proposal(
Expand Down Expand Up @@ -230,10 +228,8 @@ pub async fn approve(
github_username: query.github_username.clone(), // Use the provided `github_username` parameter
signing_address: signer.signing_address,
created_at: signer.created_at,
message_cids: VerifierGrantDataCapCids {
message_cid: signer.message_cids.message_cid,
increase_allowance_cid: signer.message_cids.increase_allowance_cid,
},
message_cid: signer.message_cids.message_cid,
increase_allowance_cid: signer.message_cids.increase_allowance_cid,
};
match ldn_application
.complete_new_application_approval(
Expand Down
12 changes: 4 additions & 8 deletions fplus-lib/src/core/application/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ pub struct VerifierInput {
pub github_username: String,
pub signing_address: String,
pub created_at: String,
pub message_cids: VerifierGrantDataCapCids,
pub message_cid: String,
pub increase_allowance_cid: Option<String>,
}

impl From<VerifierInput> for Verifier {
Expand All @@ -415,7 +416,8 @@ impl From<VerifierInput> for Verifier {
github_username: input.github_username,
signing_address: input.signing_address,
created_at: input.created_at,
message_cids: input.message_cids,
message_cid: input.message_cid,
increase_allowance_cid: input.increase_allowance_cid,
}
}
}
Expand All @@ -428,12 +430,6 @@ pub struct Verifier {
pub signing_address: String,
#[serde(rename = "Created At")]
pub created_at: String,
#[serde(rename = "Message CIDs")]
pub message_cids: VerifierGrantDataCapCids,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VerifierGrantDataCapCids {
#[serde(rename = "Message CID")]
pub message_cid: String,
#[serde(
Expand Down
4 changes: 2 additions & 2 deletions fplus-lib/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3446,8 +3446,8 @@ _(OLD vs NEW)_

if let Some(first_verifier) = allocation.signers.0.first() {
signing_address.clone_from(&first_verifier.signing_address);
message_cid.clone_from(&first_verifier.message_cids.message_cid);
increase_allowance_cid = first_verifier.message_cids.increase_allowance_cid.clone();
message_cid.clone_from(&first_verifier.message_cid);
increase_allowance_cid = first_verifier.increase_allowance_cid.clone();
}
}

Expand Down

0 comments on commit 72d0e0d

Please sign in to comment.