chore: ecash contract migration to remove unused 'redemption_gateway_share' (#5104)
This commit is contained in:
committed by
GitHub
parent
74db9ab779
commit
3147d6aef7
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
|
||||
// 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<OldConfig> 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<OldConfig> = 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(())
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user