From 89c20a860e916cd1ca01b9403568551ab63f3639 Mon Sep 17 00:00:00 2001 From: magiodev <31893902+magiodev@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:28:24 +0200 Subject: [PATCH] remove user_rewards and allow_deprecated --- .../osmosis/contracts/cl-vault/src/contract.rs | 18 +++++++++++++++++- .../osmosis/contracts/cl-vault/src/state.rs | 5 +---- .../cl-vault/src/vault/autocompound.rs | 1 - 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/contract.rs b/smart-contracts/osmosis/contracts/cl-vault/src/contract.rs index 95f761bed..7e6d2e956 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/contract.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/contract.rs @@ -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::{ @@ -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"); @@ -250,6 +251,10 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result = Map::new("user_rewards"); + USER_REWARDS.clear(deps.storage); + let response = Response::new().add_attribute("migrate", "successful"); Ok(response) } @@ -297,6 +302,12 @@ mod tests { .save(&mut deps.storage, &MigrationStatus::Closed) .unwrap(); + // UserRewards mocking + pub const USER_REWARDS: Map = 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(), @@ -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) + )); } } diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/state.rs b/smart-contracts/osmosis/contracts/cl-vault/src/state.rs index 1b55e6c78..63cdd58c2 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/state.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/state.rs @@ -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 = Map::new("user_rewards"); - #[cw_serde] pub struct Metadata { /// the underlying thesis of the vault's positions, eg aggresive diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/vault/autocompound.rs b/smart-contracts/osmosis/contracts/cl-vault/src/vault/autocompound.rs index beddf70a1..56764670a 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/vault/autocompound.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/vault/autocompound.rs @@ -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;