Skip to content

Commit

Permalink
cleanup based on review by humanalgorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
taitruong committed Dec 28, 2023
1 parent 60277c0 commit 49667d5
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions contracts/ics721-base-tester/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
StdResult, WasmMsg,
};
use cw2::set_contract_version;
use ics721_types::ibc::NonFungibleTokenPacketData;
use ics721_types::ibc_types::NonFungibleTokenPacketData;

use crate::{
error::ContractError,
Expand Down Expand Up @@ -65,7 +65,7 @@ pub fn execute(
mod receive_callbacks {
use cosmwasm_std::{ensure_eq, from_json, DepsMut, MessageInfo, Response};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
types::{Ics721AckCallbackMsg, Ics721ReceiveCallbackMsg, Ics721Status},
};

Expand Down
2 changes: 1 addition & 1 deletion contracts/ics721-base-tester/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum ExecuteMsg {
channel_id: String,
timeout: IbcTimeout,

data: ics721_types::ibc::NonFungibleTokenPacketData,
data: ics721_types::ibc_types::NonFungibleTokenPacketData,
},
SetAckMode {
ack_mode: AckMode,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/ics721-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod error;
pub mod ibc;
pub mod ibc_types;
pub mod token_types;
pub mod types;
2 changes: 1 addition & 1 deletion packages/ics721-types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cosmwasm_schema::{cw_serde, schemars::JsonSchema};
use cosmwasm_std::{Binary, IbcPacket};
use serde::{Deserialize, Serialize};

use crate::ibc::NonFungibleTokenPacketData;
use crate::ibc_types::NonFungibleTokenPacketData;

#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq)]
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
2 changes: 1 addition & 1 deletion packages/ics721/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
IbcMsg, MessageInfo, Response, StdResult, SubMsg, WasmMsg,
};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
token_types::{Class, ClassId, Token, TokenId},
};
use serde::{de::DeserializeOwned, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion packages/ics721/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::Deserialize;

use crate::{ibc::ACK_CALLBACK_REPLY_ID, ContractError};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
types::{
Ics721AckCallbackMsg, Ics721Callbacks, Ics721Memo, Ics721ReceiveCallbackMsg, Ics721Status,
ReceiverExecuteMsg,
Expand Down
12 changes: 6 additions & 6 deletions packages/ics721/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
StdResult, SubMsgResult, WasmMsg,
};
use cw_utils::parse_reply_instantiate_data;
use ics721_types::{ibc::NonFungibleTokenPacketData, types::Ics721Status};
use ics721_types::{ibc_types::NonFungibleTokenPacketData, types::Ics721Status};
use serde::{de::DeserializeOwned, Serialize};

use crate::{
Expand All @@ -22,15 +22,15 @@ use crate::{
/// Submessage reply ID used for instantiating cw721 contracts.
pub(crate) const INSTANTIATE_CW721_REPLY_ID: u64 = 0;
/// Submessage reply ID used for instantiating the proxy contract.
pub(crate) const INSTANTIATE_INCOMING_PROXY_REPLY_ID: u64 = 4;
pub(crate) const INSTANTIATE_INCOMING_PROXY_REPLY_ID: u64 = 1;
/// Submessage reply ID used for instantiating the proxy contract.
pub(crate) const INSTANTIATE_OUTGOING_PROXY_REPLY_ID: u64 = 1;
pub(crate) const INSTANTIATE_OUTGOING_PROXY_REPLY_ID: u64 = 2;
/// Submessages dispatched with this reply ID will set the ack on the
/// response depending on if the submessage execution succeded or
/// failed.
pub(crate) const ACK_AND_DO_NOTHING: u64 = 2;
pub(crate) const ACK_AND_DO_NOTHING_REPLY_ID: u64 = 3;
/// Reply on callback
pub(crate) const ACK_CALLBACK_REPLY_ID: u64 = 3;
pub(crate) const ACK_CALLBACK_REPLY_ID: u64 = 4;
/// The IBC version this contract expects to communicate with.
pub const IBC_VERSION: &str = "ics721-1";

Expand Down Expand Up @@ -271,7 +271,7 @@ where
}
// These messages don't need to do any state changes in the
// reply - just need to commit an ack.
ACK_AND_DO_NOTHING => {
ACK_AND_DO_NOTHING_REPLY_ID => {
match reply.result {
// On success, set a successful ack. Nothing else to do.
SubMsgResult::Ok(_) => Ok(Response::new().set_data(ack_success())),
Expand Down
6 changes: 3 additions & 3 deletions packages/ics721/src/ibc_packet_receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use zip_optional::Zippable;

use crate::{
helpers::{generate_receive_callback_msg, get_instantiate2_address, get_receive_callback},
ibc::ACK_AND_DO_NOTHING,
ibc::ACK_AND_DO_NOTHING_REPLY_ID,
ibc_helpers::{get_endpoint_prefix, try_pop_source_prefix},
msg::{CallbackMsg, ExecuteMsg},
state::{
Expand All @@ -18,7 +18,7 @@ use crate::{
ContractError,
};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
token_types::{Class, ClassId, Token, TokenId},
types::ReceiverExecuteMsg,
};
Expand Down Expand Up @@ -349,6 +349,6 @@ impl ActionAggregator {
funds: vec![],
}
};
Ok(SubMsg::reply_always(message, ACK_AND_DO_NOTHING))
Ok(SubMsg::reply_always(message, ACK_AND_DO_NOTHING_REPLY_ID))
}
}
2 changes: 1 addition & 1 deletion packages/ics721/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod token_types;
pub mod utils;
pub use crate::error::ContractError;
pub use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
token_types::{Class, ClassId, Token, TokenId},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/ics721/src/testing/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
utils::get_collection_data,
};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
token_types::{ClassId, TokenId},
};

Expand Down
10 changes: 5 additions & 5 deletions packages/ics721/src/testing/ibc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cosmwasm_std::{

use crate::{
execute::Ics721Execute,
ibc::{Ics721Ibc, ACK_AND_DO_NOTHING, IBC_VERSION, INSTANTIATE_CW721_REPLY_ID},
ibc::{Ics721Ibc, ACK_AND_DO_NOTHING_REPLY_ID, IBC_VERSION, INSTANTIATE_CW721_REPLY_ID},
ibc_helpers::{ack_fail, ack_success, try_get_ack_error},
msg::{CallbackMsg, ExecuteMsg, InstantiateMsg, QueryMsg},
query::Ics721Query,
Expand All @@ -19,7 +19,7 @@ use crate::{
ContractError,
};
use ics721_types::{
ibc::NonFungibleTokenPacketData,
ibc_types::NonFungibleTokenPacketData,
token_types::{ClassId, TokenId},
types::Ics721Callbacks,
};
Expand Down Expand Up @@ -180,7 +180,7 @@ fn test_stateless_reply() {
let mut deps = mock_dependencies();

let rep = Reply {
id: ACK_AND_DO_NOTHING,
id: ACK_AND_DO_NOTHING_REPLY_ID,
result: SubMsgResult::Ok(SubMsgResponse {
events: vec![],
data: None,
Expand All @@ -192,7 +192,7 @@ fn test_stateless_reply() {
assert_eq!(res.data, Some(ack_success()));

let rep = Reply {
id: ACK_AND_DO_NOTHING,
id: ACK_AND_DO_NOTHING_REPLY_ID,
result: SubMsgResult::Err("some failure".to_string()),
};
let res = Ics721Contract::default()
Expand Down Expand Up @@ -497,7 +497,7 @@ fn test_ibc_packet_receive_invalid_packet_data() {

assert!(error
.unwrap()
.starts_with("Error parsing into type ics721_types::ibc::NonFungibleTokenPacketData"))
.starts_with("Error parsing into type ics721_types::ibc_types::NonFungibleTokenPacketData"))
}

#[test]
Expand Down

0 comments on commit 49667d5

Please sign in to comment.