Skip to content

Commit

Permalink
fix typo (#108)
Browse files Browse the repository at this point in the history
* add client echo limit

* update error msg

* update StorageKey

* add client echo test

* fix typo
  • Loading branch information
MagicGordon authored Sep 19, 2024
1 parent cb1b31d commit eda132f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ref-exchange/src/client_echo_limit.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::*;

pub fn read_ce_tw_from_storage() -> UnorderedSet<AccountId> {
if let Some(content) = env::storage_read(CLIENT_ECHO_TOKEN_ID_WHITHELIST.as_bytes()) {
if let Some(content) = env::storage_read(CLIENT_ECHO_TOKEN_ID_WHITELIST.as_bytes()) {
UnorderedSet::try_from_slice(&content).expect("deserialize client echo token id whitelist failed.")
} else {
UnorderedSet::new(StorageKey::ClientEchoTokenIdWhitelistItem)
Expand All @@ -10,13 +10,13 @@ pub fn read_ce_tw_from_storage() -> UnorderedSet<AccountId> {

pub fn write_ce_tw_to_storage(client_echo_token_id_whitelist: UnorderedSet<AccountId>) {
env::storage_write(
CLIENT_ECHO_TOKEN_ID_WHITHELIST.as_bytes(),
CLIENT_ECHO_TOKEN_ID_WHITELIST.as_bytes(),
&client_echo_token_id_whitelist.try_to_vec().unwrap(),
);
}

pub fn read_ce_sw_from_storage() -> UnorderedSet<AccountId> {
if let Some(content) = env::storage_read(CLIENT_ECHO_SENDER_ID_WHITHELIST.as_bytes()) {
if let Some(content) = env::storage_read(CLIENT_ECHO_SENDER_ID_WHITELIST.as_bytes()) {
UnorderedSet::try_from_slice(&content).expect("deserialize client echo sender id whitelist failed.")
} else {
UnorderedSet::new(StorageKey::ClientEchoSenderIdWhitelistItem)
Expand All @@ -25,7 +25,7 @@ pub fn read_ce_sw_from_storage() -> UnorderedSet<AccountId> {

pub fn write_ce_sw_to_storage(client_echo_sender_id_whitelist: UnorderedSet<AccountId>) {
env::storage_write(
CLIENT_ECHO_SENDER_ID_WHITHELIST.as_bytes(),
CLIENT_ECHO_SENDER_ID_WHITELIST.as_bytes(),
&client_echo_sender_id_whitelist.try_to_vec().unwrap(),
);
}
Expand Down
4 changes: 2 additions & 2 deletions ref-exchange/src/custom_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pub const DEGEN_ORACLE_CONFIG_STORAGE_KEY: &str = "custom_degen_oracle_config_ke
pub const POOL_LIMIT: &str = "pl";

// Key for client echo limit
pub const CLIENT_ECHO_TOKEN_ID_WHITHELIST: &str = "ce_tw";
pub const CLIENT_ECHO_SENDER_ID_WHITHELIST: &str = "ce_sw";
pub const CLIENT_ECHO_TOKEN_ID_WHITELIST: &str = "ce_tw";
pub const CLIENT_ECHO_SENDER_ID_WHITELIST: &str = "ce_sw";

0 comments on commit eda132f

Please sign in to comment.