Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CL: Remove user_rewards and allow_deprecated #816

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading