Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
quasisamurai committed Sep 14, 2023
1 parent 95b2a71 commit 57f7440
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
2 changes: 1 addition & 1 deletion contracts/before-send-hook/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use before_send_hook_test::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use std::{env::current_dir, fs::create_dir_all};
use tokenfactory::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
let mut out_dir = current_dir().unwrap();
Expand Down
30 changes: 13 additions & 17 deletions contracts/before-send-hook/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::msg::{BlockBeforeSendMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, SudoMsg, SudoResResponse, TrackBeforeSendMsg};
use cosmwasm_std::{
entry_point, Deps, DepsMut, Env, MessageInfo,
Response, StdResult,
use crate::msg::{
BlockBeforeSendMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg, SudoMsg, SudoResResponse,
TrackBeforeSendMsg,
};
use crate::state::{SUDO_RES_BLOCK, SUDO_RES_TRACK};
use cosmwasm_std::{entry_point, Deps, DepsMut, Env, MessageInfo, Response, StdResult};

#[entry_point]
pub fn instantiate(
Expand All @@ -12,7 +12,6 @@ pub fn instantiate(
_info: MessageInfo,
_msg: InstantiateMsg,
) -> StdResult<Response> {

SUDO_RES_TRACK.save(deps.storage, &false)?;
SUDO_RES_BLOCK.save(deps.storage, &false)?;

Expand All @@ -32,23 +31,20 @@ pub fn execute(
#[entry_point]
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<SudoResResponse> {
match msg {
QueryMsg::SudoResultBlockBefore {
} => query_sudo_result_block_before(deps),
QueryMsg::SudoResultTrackBefore {
} => query_sudo_result_track_before(deps),
QueryMsg::SudoResultBlockBefore {} => query_sudo_result_block_before(deps),
QueryMsg::SudoResultTrackBefore {} => query_sudo_result_track_before(deps),
}
}

#[entry_point]
pub fn sudo(
deps: DepsMut,
_env: Env,
_info: MessageInfo,
msg: SudoMsg,
) -> StdResult<Response> {
pub fn sudo(deps: DepsMut, _env: Env, _info: MessageInfo, msg: SudoMsg) -> StdResult<Response> {
match msg {
SudoMsg::TrackBeforeSendSudoMsg {track_before_send_msg } => sudo_result_track_before(deps, track_before_send_msg),
SudoMsg::BlockBeforeSendSudoMsg {block_before_send_msg} => sudo_result_block_before(deps, block_before_send_msg),
SudoMsg::TrackBeforeSendSudoMsg {
track_before_send_msg,
} => sudo_result_track_before(deps, track_before_send_msg),
SudoMsg::BlockBeforeSendSudoMsg {
block_before_send_msg,
} => sudo_result_block_before(deps, block_before_send_msg),
}
}

Expand Down
29 changes: 14 additions & 15 deletions contracts/before-send-hook/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std:: Coin;
use cosmwasm_std::Coin;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand All @@ -7,14 +7,13 @@ pub struct InstantiateMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
}
pub enum ExecuteMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
SudoResultBlockBefore {},
SudoResultTrackBefore {}
SudoResultTrackBefore {},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
Expand All @@ -23,9 +22,9 @@ pub enum SudoMsg {
BlockBeforeSendSudoMsg {
block_before_send_msg: BlockBeforeSendMsg,
},
TrackBeforeSendSudoMsg {
track_before_send_msg: TrackBeforeSendMsg
}
TrackBeforeSendSudoMsg {
track_before_send_msg: TrackBeforeSendMsg,
},
}

/// Information about if the contract is currently paused.
Expand All @@ -38,18 +37,18 @@ pub enum SudoResResponse {

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct TrackBeforeSendMsg {
from: String,
to: String,
amount: Coin
pub struct TrackBeforeSendMsg {
from: String,
to: String,
amount: Coin,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct BlockBeforeSendMsg {
from: String,
to: String,
amount: Coin
pub struct BlockBeforeSendMsg {
from: String,
to: String,
amount: Coin,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
Expand Down
1 change: 0 additions & 1 deletion contracts/before-send-hook/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ use cw_storage_plus::Item;
/// contains number of transfers to addresses observed by the contract.
pub const SUDO_RES_BLOCK: Item<bool> = Item::new("sudo_res_block");
pub const SUDO_RES_TRACK: Item<bool> = Item::new("sudo_res_track");

0 comments on commit 57f7440

Please sign in to comment.