Skip to content

Commit cc7321c

Browse files
Fixed Hydro v3.2.0 migration (#251)
1 parent 7eebd08 commit cc7321c

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ compile-inner:
3434
cosmwasm/optimizer:0.16.0
3535

3636
schema:
37-
# to install ts tooling see here: https://docs.cosmology.zone/ts-codegen
37+
# to install TS tooling see here: https://docs.hyperweb.io/ts-codegen
3838

3939
cd contracts/hydro && cargo run --bin hydro_schema
4040
cd contracts/tribute && cargo run --bin tribute_schema

artifacts/checksums.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
872843538f64fddbdb63f238270df8bdeb7b433193973dba80303821f3ce1d52 dao_voting_adapter.wasm
22
a1b2f7f0b77ca19d092bb70e2777f022f9e38326dfe8e70a03ac4571b407faf9 gatekeeper.wasm
3-
83872900a62b7f50d236a3c6040d27899df520d453c2ab8fd7254bbec9de2f7f hydro.wasm
3+
1072947a96908c2d13b2a1dadfc7d781e1690960ba3582934af78eb8fc5697e4 hydro.wasm
44
76c72dcddf59a7d9dcd7d56da7367ff926554eac34b465fd580317fd9dbfd628 st_token_info_provider.wasm
55
f92f2dc9fd5a684a7fa44f7f79629e5f10cbc1ab1bab4c82775ba538e8bad097 tribute.wasm

artifacts/hydro.wasm

65 Bytes
Binary file not shown.

contracts/hydro/src/migration/migrate.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,23 @@ pub fn migrate(
4343
msg: MigrateMsgV3_2_0,
4444
) -> Result<Response<NeutronMsg>, ContractError> {
4545
check_contract_version(deps.storage, CONTRACT_VERSION_V3_1_1)?;
46-
pause_contract_before_migration(&mut deps, &env)?;
4746

4847
let response = match msg {
48+
// Constants must be migrated first in order for contract pausing not to break the state!
4949
MigrateMsgV3_2_0::MigrateToV3_2_0 {} => migrate_v3_1_1_to_unreleased(&mut deps),
50-
MigrateMsgV3_2_0::MigrateLocksV1ToV2 { start, limit } => migrate_locks_batch(
51-
&mut deps,
52-
env.block.height,
53-
start.unwrap_or(0),
54-
limit.unwrap_or(50),
55-
),
50+
MigrateMsgV3_2_0::MigrateLocksV1ToV2 { start, limit } => {
51+
pause_contract_before_migration(&mut deps, &env)?;
52+
53+
migrate_locks_batch(
54+
&mut deps,
55+
env.block.height,
56+
start.unwrap_or(0),
57+
limit.unwrap_or(50),
58+
)
59+
}
5660
MigrateMsgV3_2_0::MigrateVotesV1ToV2 { start, limit } => {
61+
pause_contract_before_migration(&mut deps, &env)?;
62+
5763
migrate_votes_batch(&mut deps, start.unwrap_or(0), limit.unwrap_or(50))
5864
}
5965
}?;

contracts/hydro/src/migration/unreleased.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn migrate_v3_1_1_to_unreleased(
6767
&TokenInfoProvider::LSM(lsm_token_info_provider),
6868
)?;
6969

70-
Ok(Response::new().add_attribute("action", "migrate_v3_1_1_to_unreleased"))
70+
Ok(Response::new().add_attribute("action", "migrate_v3_1_1_to_v3_2_0"))
7171
}
7272

7373
// Migrate locks from V1 to V2 storage structures

0 commit comments

Comments
 (0)