This repository was archived by the owner on Mar 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,12 @@ export const checkCandidate = async (
129129 logger . info ( `${ candidate . name } beefy keys not valid` , constraintsLabel ) ;
130130 }
131131
132+ // TODO: enable at deadline
133+ const kycValid = true ; //await checkKYC(candidate);
134+ if ( ! kycValid ) {
135+ logger . info ( `${ candidate . name } kyc not valid` , constraintsLabel ) ;
136+ }
137+
132138 valid =
133139 onlineValid &&
134140 validateValid &&
@@ -142,7 +148,8 @@ export const checkCandidate = async (
142148 blockedValid &&
143149 kusamaValid &&
144150 providerValid &&
145- beefyValid ;
151+ beefyValid &&
152+ kycValid ;
146153
147154 await setValid ( candidate , valid ) ;
148155
Original file line number Diff line number Diff line change 88 setConnectionTimeInvalidity ,
99 setIdentityInvalidity ,
1010 setKusamaRankInvalidity ,
11+ setKYCInvalidity ,
1112 setLatestClientReleaseValidity ,
1213 setOfflineAccumulatedInvalidity ,
1314 setOnlineValidity ,
@@ -434,3 +435,20 @@ export const checkBeefyKeys = async (
434435 throw new Error ( "could not make validity check" ) ;
435436 }
436437} ;
438+
439+ export const checkKYC = async ( candidate : Candidate ) : Promise < boolean > => {
440+ try {
441+ const isKYC = await queries . isKYC ( candidate . stash ) ;
442+ if ( isKYC ) {
443+ const invalidityString = `${ candidate . name } is not KYC` ;
444+ await setKYCInvalidity ( candidate , false , invalidityString ) ;
445+ return false ;
446+ } else {
447+ await setKYCInvalidity ( candidate , true ) ;
448+ return true ;
449+ }
450+ } catch ( e ) {
451+ logger . warn ( `Error trying to get beefy keys...` , constraintsLabel ) ;
452+ throw new Error ( "could not make validity check" ) ;
453+ }
454+ } ;
Original file line number Diff line number Diff line change @@ -1053,6 +1053,21 @@ export const setBeefyKeysInvalidity = async (
10531053 ) ;
10541054} ;
10551055
1056+ export const setKYCInvalidity = async (
1057+ candidate : Candidate ,
1058+ isValid : boolean ,
1059+ message ?: string ,
1060+ ) : Promise < void > => {
1061+ const invalidityMessage = message ? message : `${ candidate . name } is not KYC` ;
1062+ setCandidateInvalidity (
1063+ candidate ,
1064+ InvalidityReasonType . BEEFY ,
1065+ isValid ,
1066+ invalidityMessage ,
1067+ true ,
1068+ ) ;
1069+ } ;
1070+
10561071// Sets valid boolean for node
10571072export const setValid = async (
10581073 candidate : Candidate ,
You can’t perform that action at this time.
0 commit comments