diff --git a/contracts/ecash/src/contract/mod.rs b/contracts/ecash/src/contract/mod.rs index a201ade356..de5db33e2e 100644 --- a/contracts/ecash/src/contract/mod.rs +++ b/contracts/ecash/src/contract/mod.rs @@ -30,6 +30,7 @@ use sylvia::{contract, entry_points}; mod helpers; +mod queued_migrations; #[cfg(test)] mod test; @@ -105,7 +106,6 @@ impl NymEcashContract<'_> { &Config { group_addr, holding_account, - redemption_gateway_share: Decimal::percent(5), deposit_amount, }, )?; @@ -447,6 +447,8 @@ impl NymEcashContract<'_> { set_build_information!(ctx.deps.storage)?; cw2::ensure_from_older_version(ctx.deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + queued_migrations::remove_redemption_gateway_share(ctx.deps)?; + Ok(Response::new()) } } diff --git a/contracts/ecash/src/contract/queued_migrations.rs b/contracts/ecash/src/contract/queued_migrations.rs new file mode 100644 index 0000000000..a479330aca --- /dev/null +++ b/contracts/ecash/src/contract/queued_migrations.rs @@ -0,0 +1,42 @@ +// Copyright 2024 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use crate::contract::NymEcashContract; +use crate::helpers::Config; +use cosmwasm_std::{Addr, Coin, Decimal, DepsMut}; +use cw4::Cw4Contract; +use cw_storage_plus::Item; +use nym_ecash_contract_common::EcashContractError; +use serde::{Deserialize, Serialize}; + +pub fn remove_redemption_gateway_share(deps: DepsMut) -> Result<(), EcashContractError> { + #[derive(Serialize, Deserialize)] + struct OldConfig { + group_addr: Cw4Contract, + holding_account: Addr, + + redemption_gateway_share: Decimal, + deposit_amount: Coin, + } + + impl From for Config { + fn from(config: OldConfig) -> Self { + Config { + group_addr: config.group_addr, + holding_account: config.holding_account, + deposit_amount: config.deposit_amount, + } + } + } + + const OLD_CONFIG: Item = Item::new("config"); + + let old_config = OLD_CONFIG.load(deps.storage)?; + let new_config = old_config.into(); + + NymEcashContract::new() + .config + .save(deps.storage, &new_config)?; + + Ok(()) +} diff --git a/contracts/ecash/src/helpers.rs b/contracts/ecash/src/helpers.rs index 650dc82f5c..b19b1e646d 100644 --- a/contracts/ecash/src/helpers.rs +++ b/contracts/ecash/src/helpers.rs @@ -3,8 +3,7 @@ use crate::constants::{BLACKLIST_PROPOSAL_REPLY_ID, REDEMPTION_PROPOSAL_REPLY_ID}; use cosmwasm_std::{ - to_binary, Addr, Coin, CosmosMsg, Decimal, Reply, StdError, StdResult, SubMsg, SubMsgResult, - WasmMsg, + to_binary, Addr, Coin, CosmosMsg, Reply, StdError, StdResult, SubMsg, SubMsgResult, WasmMsg, }; use cw4::Cw4Contract; use nym_contracts_common::events::try_find_attribute; @@ -22,8 +21,6 @@ pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); pub struct Config { pub group_addr: Cw4Contract, pub holding_account: Addr, - - pub redemption_gateway_share: Decimal, pub deposit_amount: Coin, }