Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(registry): is_community_verified #73

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions contracts/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ impl Contract {

/// Returns tuple of community_verified proof and IAH proof.
/// If `is_human` is false, then the `is_human` check is skipped and empty list is
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
/// returned. Otherwise `is_human` is assumed to be required and if the IAH check fails,
/// the community verification is skipped (so two empty lists are returned).
/// returned.
/// EXPERIMENTAL: the function API can change in the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add here ? Maybe if first SBTs is empty that means it is not community verified

pub fn is_community_verified(&self, account: AccountId, is_human: bool) -> (SBTs, SBTs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the is human here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid is_human call

self._is_community_verified(&account, is_human)
}
Expand All @@ -163,12 +163,7 @@ impl Contract {
return (vec![], vec![]);
}
let iah_proof = if is_human {
let iah_proof = self._is_human(account, true);
// iah is required, but user is not human. Early return.
if iah_proof.is_empty() {
return (vec![], iah_proof);
}
iah_proof
self._is_human(account, true)
} else {
vec![]
};
Expand All @@ -177,9 +172,8 @@ impl Contract {
for (issuer, classes) in &self.community_verified_set {
let issuer_proof = self._list_sbts_by_classes(account, issuer, classes);
if issuer_proof.is_empty() {
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
return (vec![], iah_proof);
proof.push((issuer.clone(), issuer_proof));
}
proof.push((issuer.clone(), issuer_proof));
}
(proof, iah_proof)
}
Expand Down
Loading