Skip to content

Commit

Permalink
remove user_rewards and allow_deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
magiodev committed Aug 26, 2024
1 parent f5c188d commit 89c20a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
18 changes: 17 additions & 1 deletion smart-contracts/osmosis/contracts/cl-vault/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::error::ContractError;
use crate::helpers::coinlist::CoinList;
use crate::helpers::getters::get_range_admin;
use crate::helpers::prepend::prepend_claim_msg;
use crate::instantiate::{
Expand Down Expand Up @@ -38,7 +39,7 @@ use cosmwasm_std::{
to_json_binary, Addr, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response,
};
use cw2::set_contract_version;
use cw_storage_plus::Item;
use cw_storage_plus::{Item, Map};
// version info for migration info
const CONTRACT_NAME: &str = "crates.io:cl-vault";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -250,6 +251,10 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, Co
}
MIGRATION_STATUS.remove(deps.storage);

// UserRewards
pub const USER_REWARDS: Map<Addr, CoinList> = Map::new("user_rewards");
USER_REWARDS.clear(deps.storage);

let response = Response::new().add_attribute("migrate", "successful");
Ok(response)
}
Expand Down Expand Up @@ -297,6 +302,12 @@ mod tests {
.save(&mut deps.storage, &MigrationStatus::Closed)
.unwrap();

// UserRewards mocking
pub const USER_REWARDS: Map<Addr, CoinList> = Map::new("user_rewards");
USER_REWARDS
.save(&mut deps.storage, Addr::unchecked("user"), &CoinList::new())
.unwrap();

// Migrate and assert new states
migrate(
deps.as_mut(),
Expand All @@ -316,5 +327,10 @@ mod tests {
assert!(matches!(OLD_VAULT_CONFIG.may_load(&deps.storage), Ok(None)));

assert!(matches!(MIGRATION_STATUS.may_load(&deps.storage), Ok(None)));

assert!(matches!(
USER_REWARDS.may_load(&deps.storage, Addr::unchecked("user")),
Ok(None)
));
}
}
5 changes: 1 addition & 4 deletions smart-contracts/osmosis/contracts/cl-vault/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use crate::{helpers::coinlist::CoinList, vault::merge::CurrentMergeWithdraw};
use crate::vault::merge::CurrentMergeWithdraw;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, Coin, Decimal, Decimal256, Uint128};
use cw_storage_plus::{Deque, Item, Map};
use osmosis_std::types::osmosis::poolmanager::v1beta1::SwapAmountInRoute;

#[deprecated]
pub const USER_REWARDS: Map<Addr, CoinList> = Map::new("user_rewards");

#[cw_serde]
pub struct Metadata {
/// the underlying thesis of the vault's positions, eg aggresive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use osmosis_std::types::osmosis::concentratedliquidity::v1beta1::MsgCreatePositi
use crate::helpers::getters::get_unused_pair_balances;
use crate::msg::{ExecuteMsg, MergePositionMsg};
use crate::reply::Replies;
#[allow(deprecated)]
use crate::state::{Position, POOL_CONFIG, POSITION};
use crate::vault::{concentrated_liquidity::create_position, merge::MergeResponse};
use crate::ContractError;
Expand Down

0 comments on commit 89c20a8

Please sign in to comment.