Skip to content

Commit

Permalink
Merge pull request #513 from confio/ap-voting-migrate-multisig-id
Browse files Browse the repository at this point in the history
tgrade-ap-voting migrate multisig
  • Loading branch information
maurolacy authored Jul 19, 2022
2 parents a2fa0b7 + 86aecd7 commit 1bece1c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
10 changes: 9 additions & 1 deletion contracts/tgrade-ap-voting/MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

This guide lists API changes between releases of *Tgrade* contracts.

## 0.12.1 -> UNRELEASED

### tgrade-ap-voting

* Add support for setting `multisig_code_id` during migration.
Also sets `waiting_period`.
Only for versions lower than 0.13.0.

## 0.8.1 -> UNRELEASED

### tgrade-ap-voting

* Added `multisig_code` field to instantiation message containing the code of
`cw3_fixed_multisig` contract to handle arbiters verification
`cw3_fixed_multisig` contract to handle arbiters verification.
2 changes: 1 addition & 1 deletion contracts/tgrade-ap-voting/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub type Response = cosmwasm_std::Response<TgradeMsg>;
pub type SubMsg = cosmwasm_std::SubMsg<TgradeMsg>;

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:tgrade_validator_voting_proposals";
const CONTRACT_NAME: &str = "crates.io:tgrade_ap_voting";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

const AWAITING_MULTISIG_RESP: u64 = 1;
Expand Down
13 changes: 12 additions & 1 deletion contracts/tgrade-ap-voting/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,19 @@ pub fn migrate_config(
next_complaint_id: config.next_complaint_id,
multisig_code_id: msg.multisig_code,
}
} else if *version < "0.13.0".parse::<Version>().unwrap() {
let mut config = CONFIG.load(deps.storage)?;
if msg.multisig_code > 0 {
// tgrade-1.0.0 does not set multisig_code_id during bootstrap
config.multisig_code_id = msg.multisig_code;
}
if msg.waiting_period.seconds() > 0 {
// tgrade-1.0.0 does not set waiting_period during bootstrap
config.waiting_period = msg.waiting_period;
}
config
} else {
// It is already properly migrated
// It is already properly migrated / no multisig code id set
return Ok(());
};

Expand Down
2 changes: 2 additions & 0 deletions contracts/tgrade-ap-voting/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ pub struct ListComplaintsResp {
pub struct MigrationMsg {
/// Cw3 fixed multisig contract code
pub multisig_code: u64,
/// Waiting period in seconds for this contract
pub waiting_period: Duration,
}

0 comments on commit 1bece1c

Please sign in to comment.