@@ -4,7 +4,7 @@ pub fn read_ce_tw_from_storage() -> UnorderedSet<AccountId> {
4
4
if let Some ( content) = env:: storage_read ( CLIENT_ECHO_TOKEN_ID_WHITHELIST . as_bytes ( ) ) {
5
5
UnorderedSet :: try_from_slice ( & content) . expect ( "deserialize client echo token id whitelist failed." )
6
6
} else {
7
- UnorderedSet :: new ( StorageKey :: ClientEchoTokenIdWhitelist )
7
+ UnorderedSet :: new ( StorageKey :: ClientEchoTokenIdWhitelistItem )
8
8
}
9
9
}
10
10
@@ -19,7 +19,7 @@ pub fn read_ce_sw_from_storage() -> UnorderedSet<AccountId> {
19
19
if let Some ( content) = env:: storage_read ( CLIENT_ECHO_SENDER_ID_WHITHELIST . as_bytes ( ) ) {
20
20
UnorderedSet :: try_from_slice ( & content) . expect ( "deserialize client echo sender id whitelist failed." )
21
21
} else {
22
- UnorderedSet :: new ( StorageKey :: ClientEchoSenderIdWhitelist )
22
+ UnorderedSet :: new ( StorageKey :: ClientEchoSenderIdWhitelistItem )
23
23
}
24
24
}
25
25
@@ -45,7 +45,8 @@ impl Contract {
45
45
assert ! ( self . is_owner_or_guardians( ) , "{}" , ERR100_NOT_ALLOWED ) ;
46
46
let mut client_echo_token_id_whitelist = read_ce_tw_from_storage ( ) ;
47
47
for token_id in token_ids {
48
- assert ! ( client_echo_token_id_whitelist. insert( token_id. as_ref( ) ) , "Token id already exist" ) ;
48
+ let is_success = client_echo_token_id_whitelist. insert ( token_id. as_ref ( ) ) ;
49
+ assert ! ( is_success, "Token id already exist" ) ;
49
50
}
50
51
write_ce_tw_to_storage ( client_echo_token_id_whitelist) ;
51
52
}
@@ -56,7 +57,8 @@ impl Contract {
56
57
self . assert_owner ( ) ;
57
58
let mut client_echo_token_id_whitelist = read_ce_tw_from_storage ( ) ;
58
59
for token_id in token_ids {
59
- assert ! ( client_echo_token_id_whitelist. remove( token_id. as_ref( ) ) , "Invalid token id" ) ;
60
+ let is_success = client_echo_token_id_whitelist. remove ( token_id. as_ref ( ) ) ;
61
+ assert ! ( is_success, "Invalid token id" ) ;
60
62
}
61
63
write_ce_tw_to_storage ( client_echo_token_id_whitelist) ;
62
64
}
@@ -72,7 +74,8 @@ impl Contract {
72
74
assert ! ( self . is_owner_or_guardians( ) , "{}" , ERR100_NOT_ALLOWED ) ;
73
75
let mut client_echo_sender_id_whitelist = read_ce_sw_from_storage ( ) ;
74
76
for sender_id in sender_ids {
75
- assert ! ( client_echo_sender_id_whitelist. insert( sender_id. as_ref( ) ) , "Sender id already exist" ) ;
77
+ let is_success = client_echo_sender_id_whitelist. insert ( sender_id. as_ref ( ) ) ;
78
+ assert ! ( is_success, "Sender id already exist" ) ;
76
79
}
77
80
write_ce_sw_to_storage ( client_echo_sender_id_whitelist) ;
78
81
}
@@ -83,7 +86,8 @@ impl Contract {
83
86
self . assert_owner ( ) ;
84
87
let mut client_echo_sender_id_whitelist = read_ce_sw_from_storage ( ) ;
85
88
for sender_id in sender_ids {
86
- assert ! ( client_echo_sender_id_whitelist. remove( sender_id. as_ref( ) ) , "Invalid sender id" ) ;
89
+ let is_success = client_echo_sender_id_whitelist. remove ( sender_id. as_ref ( ) ) ;
90
+ assert ! ( is_success, "Invalid sender id" ) ;
87
91
}
88
92
write_ce_sw_to_storage ( client_echo_sender_id_whitelist) ;
89
93
}
0 commit comments