terra/token_bridge: fix cw20 migrations (#745)

commit-id:c8aac03a
This commit is contained in:
Csongor Kiss 2022-01-20 19:06:34 +00:00 committed by GitHub
parent 00ddd5f02b
commit 5d90af5195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -122,7 +122,13 @@ const WRAPPED_ASSET_UPDATING: &str = "updating";
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult<Response> {
let bucket = wrapped_asset_address(deps.storage);
let mut bucket = wrapped_asset_address(deps.storage);
// Remove registered asset with old code ID.
let asset_id = deps.api.addr_canonicalize("terra16q5pke2vueu23y8punvj70h0cp0s0rc7vrzl57")?;
bucket.remove(&asset_id);
assert!(bucket.load(&asset_id).is_err());
let mut messages = vec![];
for item in bucket.range(None, None, Order::Ascending) {
let contract_address = item?.0;