Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
add: bulk clean history storage
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptokage1996 committed Jul 11, 2024
1 parent ce34c51 commit b2e982b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions bindings/src/account_history/msg/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ pub enum ExecuteMsg {
CleanStorage {
limit: u64,
},
CleanStorageBulk {},
}
12 changes: 10 additions & 2 deletions contracts/account-history-contract/src/entry_point/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use elys_bindings::{account_history::msg::ExecuteMsg, ElysMsg, ElysQuery};
use crate::{
action::execute::{add_user_address_to_queue, clean_up_storage},
states::{
DELETE_EPOCH, DELETE_OLD_DATA_ENABLED, PARAMS_ADMIN, PROCESSED_ACCOUNT_PER_BLOCK,
TRADE_SHIELD_ADDRESS, UPDATE_ACCOUNT_ENABLED,
DELETE_EPOCH, DELETE_OLD_DATA_ENABLED, HISTORY, OLD_HISTORY_2, PARAMS_ADMIN,
PROCESSED_ACCOUNT_PER_BLOCK, TRADE_SHIELD_ADDRESS, UPDATE_ACCOUNT_ENABLED,
},
};

Expand Down Expand Up @@ -64,5 +64,13 @@ pub fn execute(
let resp = clean_up_storage(&mut deps, limit)?;
Ok(resp)
}
ExecuteMsg::CleanStorageBulk {} => {
if info.sender != PARAMS_ADMIN.load(deps.storage)? {
return Err(StdError::generic_err("Unauthorized"));
}
HISTORY.clear(deps.storage);
OLD_HISTORY_2.clear(deps.storage);
Ok(Response::new())
}
}
}

0 comments on commit b2e982b

Please sign in to comment.