Skip to content

Commit 6196949

Browse files
committed
add and remove schedule msgs can be modified in chain manager
1 parent cc590b9 commit 6196949

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

contracts/dao/neutron-chain-manager/src/contract.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::cron_module_param_types::{
2-
MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_UPDATE_PARAMS_CRON,
3-
PARAMS_QUERY_PATH_CRON,
1+
use crate::cron_module_types::{
2+
MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_ADD_SCHEDULE,
3+
MSG_TYPE_REMOVE_SCHEDULE, MSG_TYPE_UPDATE_PARAMS_CRON, PARAMS_QUERY_PATH_CRON,
44
};
55
use crate::dex_module_param_types::{
66
MsgUpdateParamsDex, ParamsRequestDex, ParamsResponseDex, MSG_TYPE_UPDATE_PARAMS_DEX,
@@ -245,10 +245,23 @@ fn check_proposal_execute_message(
245245
} else if typed_proposal.type_field.as_str() == MSG_TYPE_UPDATE_PARAMS_DEX {
246246
check_dex_update_msg_params(deps, strategy, proposal)?;
247247
Ok(())
248+
} else if typed_proposal.type_field.as_str() == MSG_TYPE_ADD_SCHEDULE {
249+
if strategy.has_cron_add_schedule_permission() {
250+
Ok(())
251+
} else {
252+
Err(ContractError::Unauthorized {})
253+
}
254+
} else if typed_proposal.type_field.as_str() == MSG_TYPE_REMOVE_SCHEDULE {
255+
if strategy.has_cron_remove_schedule_permission() {
256+
Ok(())
257+
} else {
258+
Err(ContractError::Unauthorized {})
259+
}
248260
} else {
249261
Err(ContractError::Unauthorized {})
250262
}
251263
}
264+
252265
/// Checks that the strategy owner is authorised to change the parameters of the
253266
/// cron module. We query the current values for each parameter & compare them to
254267
/// the values in the proposal; all modifications must be allowed by the strategy.

contracts/dao/neutron-chain-manager/src/cron_module_param_types.rs renamed to contracts/dao/neutron-chain-manager/src/cron_module_types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use serde::{Deserialize, Serialize};
55

66
pub const PARAMS_QUERY_PATH_CRON: &str = "/neutron.cron.Query/Params";
77
pub const MSG_TYPE_UPDATE_PARAMS_CRON: &str = "/neutron.cron.MsgUpdateParams";
8+
pub const MSG_TYPE_ADD_SCHEDULE: &str = "/neutron.cron.MsgAddSchedule";
9+
pub const MSG_TYPE_REMOVE_SCHEDULE: &str = "/neutron.cron.MsgRemoveSchedule";
810

911
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
1012
#[serde(rename_all = "snake_case")]

contracts/dao/neutron-chain-manager/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod contract;
2-
mod cron_module_param_types;
2+
mod cron_module_types;
33
mod dex_module_param_types;
44
mod error;
55
pub mod msg;

contracts/dao/neutron-chain-manager/src/testing/mock_querier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cron_module_param_types::{ParamsCron, ParamsResponseCron};
1+
use crate::cron_module_types::{ParamsCron, ParamsResponseCron};
22
use crate::dex_module_param_types::{ParamsDex, ParamsResponseDex};
33
use crate::tokenfactory_module_param_types::{ParamsResponseTokenfactory, ParamsTokenfactory};
44
use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage};

0 commit comments

Comments
 (0)