@@ -48,17 +48,23 @@ pub fn build(
48
48
let q_min_balance: f64 = ( min_balance / ( 10 ^ 8 ) ) as f64 ;
49
49
50
50
let mut client = GraphQLClient :: new ( ) ;
51
- let mut flag = false ;
51
+ let mut found = false ;
52
+ let mut from_date_index = 0_usize ;
52
53
53
54
for id in identities {
55
+ if found {
56
+ break
57
+ }
58
+
54
59
if let Identity :: Evm { network, address } = id {
55
60
if matches ! ( network, EvmNetwork :: Ethereum ) {
56
61
if let Ok ( addr) = from_utf8 ( address. as_ref ( ) ) {
57
62
let addresses = vec ! [ addr. to_string( ) ] ;
58
63
59
- for from_date in ASSERTION_FROM_DATE . iter ( ) {
60
- // if flag is true, no need to check it continually
61
- if flag {
64
+ for ( index, from_date) in ASSERTION_FROM_DATE . iter ( ) . enumerate ( ) {
65
+ // if found is true, no need to check it continually
66
+ if found {
67
+ from_date_index = index + 1 ;
62
68
break
63
69
}
64
70
let credentials = VerifiedCredentialsIsHodlerIn :: new (
@@ -73,7 +79,7 @@ pub fn build(
73
79
. check_verified_credentials_is_hodler ( credentials)
74
80
. map_err ( from_data_provider_error) ?;
75
81
for hodler in is_hodler_out. verified_credentials_is_hodler . iter ( ) {
76
- flag = flag || hodler. is_hodler ;
82
+ found = found || hodler. is_hodler ;
77
83
}
78
84
}
79
85
} ;
@@ -84,8 +90,7 @@ pub fn build(
84
90
let a10 = Assertion :: A10 ( min_balance) ;
85
91
match Credential :: generate_unsigned_credential ( & a10, who, & shard. clone ( ) , bn) {
86
92
Ok ( mut credential_unsigned) => {
87
- credential_unsigned. credential_subject . values . push ( flag) ;
88
-
93
+ credential_unsigned. update_holder ( from_date_index, min_balance) ;
89
94
return Ok ( credential_unsigned)
90
95
} ,
91
96
Err ( e) => {
0 commit comments