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

Commit

Permalink
Merge branch 'main' into feat/add-missing-pool-info
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptokage1996 authored Jul 18, 2024
2 parents 8f9ad7f + cefef67 commit ea481e3
Show file tree
Hide file tree
Showing 29 changed files with 135 additions and 1,725 deletions.
7 changes: 2 additions & 5 deletions bindings/src/account_history/msg/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ pub enum ExecuteMsg {
delete_old_data_enabled: Option<bool>,
delete_epoch: Option<u64>,
},
UpdateAccount {},
CleanHistory {
limit: u64,
},
CleanOldHistory {
CleanStorage {
limit: u64,
},
CleanStorageBulk {},
}
4 changes: 2 additions & 2 deletions bindings/src/account_history/msg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ pub use sudo::SudoMsg;
pub mod query_resp {
mod get_all_resp;
mod get_rewards_resp;
mod get_storage_size;
mod liquid_asset;
mod membership_tier_response;
mod params_resp;
mod total_value_per_asset_resp;
mod user_value_response;

pub use get_all_resp::GetAllResp;
pub use get_rewards_resp::GetRewardsResp;
pub use get_storage_size::StorageSizeResp;
pub use liquid_asset::LiquidAsset;
pub use membership_tier_response::MembershipTierResponse;
pub use params_resp::ParamsResp;
pub use total_value_per_asset_resp::GetLiquidAssetsResp;
pub use user_value_response::UserValueResponse;
Expand Down
6 changes: 2 additions & 4 deletions bindings/src/account_history/msg/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ pub enum QueryMsg {
GetPoolBalances { user_address: String },
#[returns(GetRewardsResp)]
GetRewards { user_address: String },
#[returns(MembershipTierResponse)]
GetMembershipTier { user_address: String },
#[returns(PerpetualAssets)]
GetPerpetualAssets { user_address: String },
#[returns(Decimal)]
Expand Down Expand Up @@ -160,8 +158,8 @@ pub enum QueryMsg {
IncentiveAprs {},

#[cfg(feature = "debug")]
#[returns(Uint128)]
AddressQueueSize {},
#[returns(StorageSizeResp)]
StorageSize {},

#[cfg(feature = "debug")]
#[returns(ContractVersion)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use cosmwasm_schema::cw_serde;

#[cw_serde]
pub struct StorageSizeResp {
pub user_address_queue_data_size: u128,
pub history_data_size: u128,
pub old_history_2_data_size: u128,
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use cosmwasm_std::{DepsMut, Response, StdResult};

use crate::states::{HISTORY, OLD_HISTORY_2, USER_ADDRESS_QUEUE};
use elys_bindings::{ElysMsg, ElysQuery};

pub fn clean_up_storage(deps: &mut DepsMut<ElysQuery>, limit: u64) -> StdResult<Response<ElysMsg>> {
// Delete history values
for _ in 0..limit {
if let Some(val) = HISTORY.first(deps.storage)? {
HISTORY.remove(deps.storage, &val.0);
}
if let Some(val) = OLD_HISTORY_2.first(deps.storage)? {
OLD_HISTORY_2.remove(deps.storage, &val.0);
}
if !USER_ADDRESS_QUEUE.is_empty(deps.storage).unwrap() {
let _ = USER_ADDRESS_QUEUE.pop_front(deps.storage);
}
}
Ok(Response::default())
}
16 changes: 7 additions & 9 deletions contracts/account-history-contract/src/action/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
pub mod sudo {
mod update_account_chain;
pub use update_account_chain::{
clean_old_history, clean_up_history, update_account, update_account_chain,
};
}

pub mod query {
mod get_liquid_assets;
use crate::error::ContractError;
Expand All @@ -13,7 +6,6 @@ pub mod query {
mod get_masterchef_pending_rewards;
mod get_masterchef_pool_apr;
mod get_masterchef_stable_stake_apr;
mod get_membership_tier;
mod get_perpetual_asset;
mod get_pool_balances;
mod get_pools;
Expand Down Expand Up @@ -62,13 +54,19 @@ pub mod query {
pub use get_masterchef_pending_rewards::get_masterchef_pending_rewards;
pub use get_masterchef_pool_apr::get_masterchef_pool_apr;
pub use get_masterchef_stable_stake_apr::get_masterchef_stable_stake_apr;
pub use get_membership_tier::get_membership_tier;
pub use get_perpetual_asset::get_perpetuals_assets;
pub use get_rewards::get_rewards;
pub use get_staked_assets::get_staked_assets;
}

pub mod execute {
mod add_user_address_to_queue;
mod clean_up_storage;
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;
}

This file was deleted.

3 changes: 0 additions & 3 deletions contracts/account-history-contract/src/action/sudo/mod.rs

This file was deleted.

This file was deleted.

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())
}
Loading

0 comments on commit ea481e3

Please sign in to comment.