Migratable Counter is a project to demonstrate contract migration in testing environment and on testnet.
To migrate from v1.0.0 (contracts/counter
) to v2.0.0 (contracts/counter-new
) following changes are required:
- Remove
ResetCounter {}
and addSetCounter { value: Uint128 }
inmsg.rs
- Update
QueryCounters {} -> Vec<(Addr, Uint128)>
toQueryCounters { addresses: Option<Vec<String>> } -> Vec<QueryCountersResponse>
and implementstruct QueryCountersResponse { owner: Addr, counter_value: Uint128 }
inmsg.rs
- Add
ActionType::Mul
intypes.rs
- Update
TOTAL_CALLS: Item<u32>
toTOTAL_CALLS: Item<Uint128>
instate.rs
- Add
pub const TOTAL_CALLS_PREVIOUS: Item<Uint128> = Item::new("total v1.0.0 contract calls");
and saveTOTAL_CALLS
value toTOTAL_CALLS_PREVIOUS
.TOTAL_CALLS
must be cleared
COUNTERS
state and contract balances must be preserved.