Skip to content

Commit 48a15cc

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

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
use crate::cron_module_param_types::{
2-
MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_UPDATE_PARAMS_CRON,
3-
PARAMS_QUERY_PATH_CRON,
4-
};
5-
use crate::dex_module_param_types::{
6-
MsgUpdateParamsDex, ParamsRequestDex, ParamsResponseDex, MSG_TYPE_UPDATE_PARAMS_DEX,
7-
PARAMS_QUERY_PATH_DEX,
8-
};
1+
use crate::cron_module_types::{MsgUpdateParamsCron, ParamsRequestCron, ParamsResponseCron, MSG_TYPE_ADD_SCHEDULE, MSG_TYPE_REMOVE_SCHEDULE, MSG_TYPE_UPDATE_PARAMS_CRON, PARAMS_QUERY_PATH_CRON};
2+
use crate::dex_module_param_types::{MsgUpdateParamsDex, ParamsRequestDex, ParamsResponseDex, MSG_TYPE_UPDATE_PARAMS_DEX, PARAMS_QUERY_PATH_DEX};
93
use crate::tokenfactory_module_param_types::{
104
MsgUpdateParamsTokenfactory, ParamsRequestTokenfactory, ParamsResponseTokenfactory,
115
MSG_TYPE_UPDATE_PARAMS_TOKENFACTORY, PARAMS_QUERY_PATH_TOKENFACTORY,
@@ -245,10 +239,23 @@ fn check_proposal_execute_message(
245239
} else if typed_proposal.type_field.as_str() == MSG_TYPE_UPDATE_PARAMS_DEX {
246240
check_dex_update_msg_params(deps, strategy, proposal)?;
247241
Ok(())
242+
} else if typed_proposal.type_field.as_str() == MSG_TYPE_ADD_SCHEDULE {
243+
if strategy.has_cron_add_schedule_permission() {
244+
Ok(())
245+
} else {
246+
Err(ContractError::Unauthorized {})
247+
}
248+
} else if typed_proposal.type_field.as_str() == MSG_TYPE_REMOVE_SCHEDULE {
249+
if strategy.has_cron_remove_schedule_permission() {
250+
Ok(())
251+
} else {
252+
Err(ContractError::Unauthorized {})
253+
}
248254
} else {
249255
Err(ContractError::Unauthorized {})
250256
}
251257
}
258+
252259
/// Checks that the strategy owner is authorised to change the parameters of the
253260
/// cron module. We query the current values for each parameter & compare them to
254261
/// 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)