Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh schema + add empty migrate handlers #52

Merged
merged 10 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make migrate handlers empty, regenerate schema
  • Loading branch information
oldremez committed Apr 17, 2023
commit cdb1ad7a719d72f9ef4c1f3fbbc7a3354cd4f004
3 changes: 2 additions & 1 deletion contracts/dao/cwd-core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ pub fn query_dao_uri(deps: Deps) -> StdResult<Binary> {
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
Ok(Response::default())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(
_deps: DepsMut,
deps: DepsMut,
_env: Env,
_msg: MigrateMsg,
) -> Result<Response, PreProposeOverruleError> {
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
Ok(Response::default())
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MigrateMsg",
"type": "object",
"required": [
"overrule_pre_propose"
],
"properties": {
"overrule_pre_propose": {
"type": "string"
}
}
"type": "object"
}
16 changes: 2 additions & 14 deletions contracts/subdaos/cwd-subdao-timelock-single/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ use neutron_dao_pre_propose_overrule::msg::{
};
use neutron_subdao_core::msg::QueryMsg as SubdaoQuery;
use neutron_subdao_pre_propose_single::msg::QueryMsg as PreProposeQuery;
use neutron_subdao_timelock_single::types::ConfigOld;
use neutron_subdao_timelock_single::{
msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg},
types::{Config, ProposalListResponse, ProposalStatus, SingleChoiceProposal},
};

use crate::error::ContractError;
use crate::state::{CONFIG, CONFIG_OLD, DEFAULT_LIMIT, PROPOSALS};
use crate::state::{CONFIG, DEFAULT_LIMIT, PROPOSALS};

pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-subdao-timelock-single";
pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -276,20 +275,9 @@ pub fn query_list_proposals(
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result<Response, ContractError> {
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
// Set contract to version to latest
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
let old_config: ConfigOld = CONFIG_OLD.load(deps.storage)?;

let new_overrule_pre_propose = deps.api.addr_validate(&msg.overrule_pre_propose)?;
let new_config = Config {
owner: old_config.owner,
overrule_pre_propose: new_overrule_pre_propose,
subdao: old_config.subdao,
};

CONFIG.save(deps.storage, &new_config)?;

Ok(Response::default())
}

Expand Down
5 changes: 2 additions & 3 deletions contracts/subdaos/cwd-subdao-timelock-single/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use cw_storage_plus::{Item, Map};
use neutron_subdao_timelock_single::types::{Config, ConfigOld, SingleChoiceProposal};
use neutron_subdao_timelock_single::types::{Config, SingleChoiceProposal};

/// Default limit for proposal pagination.
pub const DEFAULT_LIMIT: u64 = 30;

pub const CONFIG_OLD: Item<ConfigOld> = Item::new("config");
pub const CONFIG: Item<Config> = Item::new("configv2");
pub const CONFIG: Item<Config> = Item::new("config");
pub const PROPOSALS: Map<u64, SingleChoiceProposal> = Map::new("proposals");
4 changes: 1 addition & 3 deletions packages/neutron-subdao-timelock-single/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,4 @@ pub enum QueryMsg {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct MigrateMsg {
pub overrule_pre_propose: String,
}
pub struct MigrateMsg {}
8 changes: 0 additions & 8 deletions packages/neutron-subdao-timelock-single/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ pub struct Config {
pub subdao: Addr,
}

#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
pub struct ConfigOld {
pub owner: Addr,
pub timelock_duration: u64,
// subDAO core module can timelock proposals.
pub subdao: Addr,
}

#[derive(Serialize, Deserialize, Clone, JsonSchema, Debug, Eq, PartialEq)]
pub struct SingleChoiceProposal {
/// The ID of the proposal being returned.
Expand Down