Skip to content

Commit

Permalink
fix(minor-rewards): remove old migration handler (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcobb23 authored Nov 14, 2024
1 parent ada9e92 commit 9f91b1e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 317 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contracts/rewards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ serde_json = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
assert_ok = { workspace = true }
cw-multi-test = "0.15.1"

[lints]
Expand Down
22 changes: 15 additions & 7 deletions contracts/rewards/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ mod query;

const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
const BASE_VERSION: &str = "1.1.0";

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(
deps: DepsMut,
_env: Env,
_msg: Empty,
) -> Result<Response, axelar_wasm_std::error::ContractError> {
migrations::v1_0_0::migrate(deps.storage)?;

// any version checks should be done before here
cw2::assert_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION)?;

cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;

Expand Down Expand Up @@ -191,7 +190,8 @@ pub fn query(

#[cfg(test)]
mod tests {
use cosmwasm_std::testing::{mock_dependencies, mock_env};
use assert_ok::assert_ok;
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::{coins, Addr, BlockInfo, Uint128};
use cw_multi_test::{App, ContractWrapper, Executor};
use router_api::ChainName;
Expand All @@ -203,9 +203,17 @@ mod tests {
#[test]
fn migrate_sets_contract_version() {
let mut deps = mock_dependencies();

#[allow(deprecated)]
migrations::v1_0_0::tests::instantiate_contract(deps.as_mut(), "denom");
let env = mock_env();
let info = mock_info("instantiator", &[]);
assert_ok!(instantiate(
deps.as_mut(),
env,
info,
InstantiateMsg {
governance_address: "governance".to_string(),
rewards_denom: "uaxl".to_string()
}
));

migrate(deps.as_mut(), mock_env(), Empty {}).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion contracts/rewards/src/contract/migrations/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod v1_0_0;

309 changes: 0 additions & 309 deletions contracts/rewards/src/contract/migrations/v1_0_0.rs

This file was deleted.

0 comments on commit 9f91b1e

Please sign in to comment.