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

Commit

Permalink
fix: test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptokage1996 committed Jul 12, 2024
1 parent b2e982b commit 7a14bbd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions contracts/account-history-contract/src/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ pub mod execute {
pub use add_user_address_to_queue::add_user_address_to_queue;
pub use clean_up_storage::clean_up_storage;
}

pub mod sudo {
mod update_metadata_prices;
pub use update_metadata_prices::update_metadata_prices;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::states::METADATA;
use cosmwasm_std::{DepsMut, Response, StdResult};
use elys_bindings::{ElysMsg, ElysQuerier, ElysQuery};

pub fn update_metadata_prices(deps: DepsMut<ElysQuery>) -> StdResult<Response<ElysMsg>> {
let querier = ElysQuerier::new(&deps.querier);

// update metadata prices
let mut metadata = METADATA.load(deps.storage)?;
metadata = metadata.update_prices(&querier)?;
METADATA.save(deps.storage, &metadata)?;

Ok(Response::default())
}
4 changes: 3 additions & 1 deletion contracts/account-history-contract/src/entry_point/sudo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::action::execute::clean_up_storage;
use crate::action::sudo::update_metadata_prices;
use crate::states::DELETE_OLD_DATA_ENABLED;
use crate::{msg::SudoMsg, states::DELETE_EPOCH};
use cosmwasm_std::{entry_point, DepsMut, Env, Response, StdResult};
Expand All @@ -12,7 +13,8 @@ pub fn sudo(mut deps: DepsMut<ElysQuery>, _env: Env, msg: SudoMsg) -> StdResult<
if DELETE_OLD_DATA_ENABLED.load(deps.storage)? == true {
clean_up_storage(&mut deps, epoch)?;
}
return Ok(Response::new());
update_metadata_prices(deps)?;
Ok(Response::new())
}
}
}

0 comments on commit 7a14bbd

Please sign in to comment.