Skip to content

Commit

Permalink
default 0 equity for missing token
Browse files Browse the repository at this point in the history
  • Loading branch information
RUAN0007 committed Sep 2, 2024
1 parent 51db482 commit 58c1682
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/zk-por-core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,11 @@ pub fn parse_account_state(parsed_data: &Map<String, Value>, tokens: &Vec<String
if let Some(debts) = parsed_data.get("debt") {
let debts = debts.as_object().unwrap();
for token in tokens.iter() {
let mut parsed_debt = F::ZERO;
if let Some(val) = debts.get(token) {
let parsed_debt =
F::from_canonical_u64(val.as_str().unwrap().parse::<u64>().unwrap());
parsed_debts.push(parsed_debt);
} else {
panic!("fail to find debt for token: {:?} in accountID {:?}", token, account_id);
parsed_debt = F::from_canonical_u64(val.as_str().unwrap().parse::<u64>().unwrap());
}
parsed_debts.push(parsed_debt);
}
} else {
// if there is no debt, we fill it with zero
Expand Down

0 comments on commit 58c1682

Please sign in to comment.