Closed taitruong closed 3 months ago
This migration does affect not only v0.16 - but also older versions. Migration logic assumes current contract is version v0.16 (and lower): https://github.com/CosmWasm/cw-nfts/blob/177a993dfb5a1a3164be1baf274f43b1ca53da53/contracts/cw721-base/src/upgrades/v0_17.rs#L14-L19
Instead it may query for ownership
and if it doesn't exist, it could do a migration, like this:
// cw721 v0.17 and higher holds ownership in the contract
let ownership: StdResult<Ownership<Addr>> = deps
.querier
.query_wasm_smart(sender, &cw721_base::msg::QueryMsg::Ownership::<Addr> {});
if ownership.is_err() {
// cw721 v0.16 and lower holds minter
let minter_response: cw721_base_016::msg::MinterResponse = deps
.querier
.query_wasm_smart(sender, &cw721_base_016::QueryMsg::Minter::<Empty> {})?;
// migration logic here...
}
Fixed in #161
current version is v0.18 but it still uses this: https://github.com/CosmWasm/cw-nfts/blob/177a993dfb5a1a3164be1baf274f43b1ca53da53/contracts/cw721-base/src/upgrades/v0_17.rs#L23-L24
So response attributes are not correct. There are const like
EXPECTED_FROM_VERSION
andCONTRACT_VERSION
it could use forfrom_version
andto_version