diff --git a/Cargo.lock b/Cargo.lock index 794915e..477e4ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,8 +160,8 @@ dependencies = [ [[package]] name = "astroport" -version = "5.3.0" -source = "git+https://github.com/astroport-fi/astroport-core#8bb2e109cfb717bee2cdd1495f385d2db1e8726d" +version = "5.4.0" +source = "git+https://github.com/astroport-fi/astroport-core#034ec4375ce50e34d9e9aff15d1f86d497b27b81" dependencies = [ "astroport-circular-buffer", "cosmos-sdk-proto 0.19.0", @@ -179,7 +179,7 @@ dependencies = [ [[package]] name = "astroport-circular-buffer" version = "0.2.0" -source = "git+https://github.com/astroport-fi/astroport-core#8bb2e109cfb717bee2cdd1495f385d2db1e8726d" +source = "git+https://github.com/astroport-fi/astroport-core#034ec4375ce50e34d9e9aff15d1f86d497b27b81" dependencies = [ "cosmwasm-schema 1.5.7", "cosmwasm-std 1.5.7", diff --git a/contracts/cron/src/contract.rs b/contracts/cron/src/contract.rs index 23e2483..538eeca 100644 --- a/contracts/cron/src/contract.rs +++ b/contracts/cron/src/contract.rs @@ -1,13 +1,16 @@ use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; use crate::state::{BEGIN_BLOCKER_SHEDULES, END_BLOCKER_SHEDULES}; use cosmwasm_std::{ - entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, + entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, + StdResult, }; use cw2::set_contract_version; const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME")); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); +const MODULE_ACCOUNT: &str = "neutron1cd6wafvehv79pm2yxth40thpyc7dc0yrqkyk95"; + #[entry_point] pub fn instantiate( deps: DepsMut, @@ -21,10 +24,14 @@ pub fn instantiate( } #[entry_point] -pub fn execute(deps: DepsMut, _: Env, _: MessageInfo, msg: ExecuteMsg) -> StdResult { +pub fn execute(deps: DepsMut, _: Env, info: MessageInfo, msg: ExecuteMsg) -> StdResult { deps.api .debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str()); + if info.sender.as_str() != MODULE_ACCOUNT { + return Err(StdError::generic_err("Unauthorized")); + } + match msg { ExecuteMsg::AddBeginBlockerSchedule { name } => { let counter = BEGIN_BLOCKER_SHEDULES @@ -46,16 +53,6 @@ pub fn execute(deps: DepsMut, _: Env, _: MessageInfo, msg: ExecuteMsg) -> StdRes END_BLOCKER_SHEDULES.save(deps.storage, name, &counter)?; - Ok(Response::default()) - } - ExecuteMsg::RemoveBeginBlockerSchedule { name } => { - BEGIN_BLOCKER_SHEDULES.remove(deps.storage, name); - - Ok(Response::default()) - } - ExecuteMsg::RemoveEndBlockerSchedule { name } => { - END_BLOCKER_SHEDULES.remove(deps.storage, name); - Ok(Response::default()) } } diff --git a/contracts/cron/src/msg.rs b/contracts/cron/src/msg.rs index 8ce337e..e75d6c4 100644 --- a/contracts/cron/src/msg.rs +++ b/contracts/cron/src/msg.rs @@ -9,8 +9,6 @@ pub struct InstantiateMsg {} pub enum ExecuteMsg { AddBeginBlockerSchedule { name: String }, AddEndBlockerSchedule { name: String }, - RemoveBeginBlockerSchedule { name: String }, - RemoveEndBlockerSchedule { name: String }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]