Skip to content

Commit 4e98544

Browse files
authored
chore(cw20-token-minter): remove temporary migration code (#4426)
2 parents cc9f352 + e35b11d commit 4e98544

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

cosmwasm/cw20-token-minter/src/contract.rs

+16-31
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,29 @@ pub fn instantiate(
5050

5151
#[cw_serde]
5252
pub struct MigrateMsg {
53-
/// Update admins of these contracts to the `new_admin`
54-
pub cw20_contracts: Vec<cosmwasm_std::Addr>,
53+
/// Update the admin for all *new* cw20 token contracts.
54+
#[serde(default)]
55+
pub new_admin: Option<cosmwasm_std::Addr>,
5556

56-
/// BE VERY CATIOUS WITH WHO TO BE THE ADMIN
57-
pub new_admin: cosmwasm_std::Addr,
58-
59-
/// New cw20 code id that we are gonna migrate all `cw2_contracts`
60-
pub new_cw20_code_id: u64,
57+
/// New code id to store for all *new* cw20 token contracts.
58+
#[serde(default)]
59+
pub new_cw20_code_id: Option<u64>,
6160
}
6261

6362
#[entry_point]
6463
pub fn migrate(deps: DepsMut, _: Env, msg: MigrateMsg) -> StdResult<Response> {
65-
// Save the admin for the future instantiates
66-
CW20_ADMIN.save(deps.storage, &msg.new_admin)?;
67-
68-
CONFIG.update::<_, cosmwasm_std::StdError>(deps.storage, |mut c| {
69-
c.cw20_base_code_id = msg.new_cw20_code_id;
70-
Ok(c)
71-
})?;
64+
if let Some(new_admin) = msg.new_admin {
65+
CW20_ADMIN.save(deps.storage, &new_admin)?;
66+
}
7267

73-
// let migrate_msg = to_json_binary(&UpgradeMsg::<Empty, _>::Migrate(Empty {}))?;
68+
if let Some(new_cw20_code_id) = msg.new_cw20_code_id {
69+
CONFIG.update::<_, cosmwasm_std::StdError>(deps.storage, |mut c| {
70+
c.cw20_base_code_id = new_cw20_code_id;
71+
Ok(c)
72+
})?;
73+
}
7474

75-
// Update all the owned cw20s
76-
Ok(
77-
Response::new().add_messages(msg.cw20_contracts.into_iter().flat_map(|contract| {
78-
[
79-
// WasmMsg::Migrate {
80-
// contract_addr: contract.to_string(),
81-
// new_code_id: msg.new_cw20_code_id,
82-
// msg: migrate_msg.clone(),
83-
// },
84-
WasmMsg::UpdateAdmin {
85-
contract_addr: contract.to_string(),
86-
admin: msg.new_admin.to_string(),
87-
},
88-
]
89-
})),
90-
)
75+
Ok(Response::new())
9176
}
9277

9378
#[entry_point]

0 commit comments

Comments
 (0)