diff --git a/contracts/account-history-contract/src/action/mod.rs b/contracts/account-history-contract/src/action/mod.rs index 12cc5b4d..641ed9de 100644 --- a/contracts/account-history-contract/src/action/mod.rs +++ b/contracts/account-history-contract/src/action/mod.rs @@ -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; +} diff --git a/contracts/account-history-contract/src/action/sudo/update_metadata_prices.rs b/contracts/account-history-contract/src/action/sudo/update_metadata_prices.rs new file mode 100644 index 00000000..3d5293d5 --- /dev/null +++ b/contracts/account-history-contract/src/action/sudo/update_metadata_prices.rs @@ -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) -> StdResult> { + 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()) +} diff --git a/contracts/account-history-contract/src/entry_point/sudo.rs b/contracts/account-history-contract/src/entry_point/sudo.rs index 33d06fff..950a6491 100644 --- a/contracts/account-history-contract/src/entry_point/sudo.rs +++ b/contracts/account-history-contract/src/entry_point/sudo.rs @@ -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}; @@ -12,7 +13,8 @@ pub fn sudo(mut deps: DepsMut, _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()) } } }