Skip to content

Commit 42d5e35

Browse files
authored
feat: allow migration from terraswap v0.0.0
2 parents df1f112 + 4e54421 commit 42d5e35

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

contracts/cw20-taxed/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cw20-taxed"
3-
version = "1.1.0+taxed003"
3+
version = "1.1.0+taxed004"
44
authors = ["Till Ziegler <tz@schoeneweide.tk>"]
55
edition = "2021"
66
description = "Basic implementation of a CosmWasm-20 compliant token with blacklist tax"

contracts/cw20-taxed/src/state.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ pub mod migrate_v1 {
8383
Ok(version.contract == CONTRACT_NAME_TERRASWAP && version.version == "0.0.0")
8484
}
8585

86+
pub fn is_cw_base_v0(store: &dyn Storage) -> StdResult<bool> {
87+
let version = get_contract_version(store)?;
88+
Ok(version.contract == "crates.io:cw20-base" && version.version == "0.0.0")
89+
}
90+
8691
pub fn is_cw_base_1_0_1(store: &dyn Storage) -> StdResult<bool> {
8792
let version = get_contract_version(store)?;
8893
Ok(version.contract == "crates.io:cw20-base" && version.version == "1.0.1")
@@ -121,6 +126,11 @@ pub mod migrate_v1 {
121126
set_contract_version(store, CONTRACT_NAME, "1.1.0")?;
122127
return Ok(());
123128

129+
// this is for terraswap tokens - normalize to v1.1.0
130+
} else if is_cw_base_v0(store)? {
131+
set_contract_version(store, CONTRACT_NAME, "1.1.0")?;
132+
return Ok(());
133+
124134
// no known migration path -play safe and throw
125135
} else {
126136
return Err(StdError::generic_err(

0 commit comments

Comments
 (0)