diff --git a/Cargo.lock b/Cargo.lock index 5ffc9d261..7670fb828 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,7 +43,7 @@ name = "astro-satellite-package" version = "0.1.0" source = "git+https://github.com/astroport-fi/astroport_ibc#ffb48ebfd7dbbc010cf86c9b02bad236c456fca0" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/astroport-governance)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", ] @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "astroport-escrow-fee-distributor" version = "1.0.2" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" +source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -152,7 +152,7 @@ dependencies = [ "anyhow", "astroport", "astroport-factory", - "astroport-governance 1.4.0", + "astroport-governance", "astroport-mocks", "astroport-native-coin-registry", "astroport-nft", @@ -194,18 +194,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "astroport-governance" -version = "1.2.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" -dependencies = [ - "astroport", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 0.15.1", - "cw20 0.15.1", -] - [[package]] name = "astroport-governance" version = "1.2.0" @@ -218,19 +206,6 @@ dependencies = [ "cw20 0.15.1", ] -[[package]] -name = "astroport-governance" -version = "1.4.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance#259fbc78d33f1b76e4213054babc95a1d9202f5c" -dependencies = [ - "astroport", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus 0.15.1", - "cw20 0.15.1", - "thiserror", -] - [[package]] name = "astroport-liquidity-manager" version = "1.0.2" @@ -264,7 +239,7 @@ dependencies = [ "astroport", "astroport-escrow-fee-distributor", "astroport-factory", - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "astroport-native-coin-registry", "astroport-pair", "astroport-pair-stable", @@ -341,9 +316,9 @@ dependencies = [ [[package]] name = "astroport-nft" version = "1.0.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" +source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", "cw2 0.15.1", @@ -1558,9 +1533,9 @@ checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generator-controller" version = "1.3.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" +source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -2916,9 +2891,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "voting-escrow" version = "1.3.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" +source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", @@ -2931,9 +2906,9 @@ dependencies = [ [[package]] name = "voting-escrow-delegation" version = "1.0.0" -source = "git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main#784452baf414f13d8b9e7de461391eb765ff9043" +source = "git+https://github.com/astroport-fi/astroport-governance#f0ef7c6dde76fc77ce360262923366a5cde3c3f8" dependencies = [ - "astroport-governance 1.2.0 (git+https://github.com/astroport-fi/hidden_astroport_governance?branch=main)", + "astroport-governance", "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 0.15.1", diff --git a/contracts/cw20_ics20/src/ibc.rs b/contracts/cw20_ics20/src/ibc.rs index ab0e52510..0ae785f06 100644 --- a/contracts/cw20_ics20/src/ibc.rs +++ b/contracts/cw20_ics20/src/ibc.rs @@ -1,7 +1,3 @@ -use astroport::outpost_handler::Cw20HookMsg; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - use cosmwasm_schema::cw_serde; use cosmwasm_std::{ attr, entry_point, from_binary, to_binary, BankMsg, Binary, CosmosMsg, Deps, DepsMut, Env, @@ -9,6 +5,11 @@ use cosmwasm_std::{ IbcEndpoint, IbcOrder, IbcPacket, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, Reply, Response, SubMsg, SubMsgResult, Uint128, WasmMsg, }; +use cw20::Cw20ExecuteMsg; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use astroport::outpost_handler::Cw20HookMsg; use crate::amount::Amount; use crate::error::{ContractError, Never}; @@ -16,7 +17,6 @@ use crate::state::{ reduce_channel_balance, undo_reduce_channel_balance, ChannelInfo, ReplyArgs, ALLOW_LIST, CHANNEL_INFO, CONFIG, REPLY_ARGS, }; -use cw20::Cw20ExecuteMsg; pub const ICS20_VERSION: &str = "ics20-1"; pub const ICS20_ORDERING: IbcOrder = IbcOrder::Unordered; @@ -488,15 +488,17 @@ fn send_amount(amount: Amount, recipient: String) -> CosmosMsg { #[cfg(test)] mod test { - use super::*; - use crate::test_helpers::*; + use cosmwasm_std::testing::{mock_env, mock_info}; + use cosmwasm_std::{coins, to_vec, IbcEndpoint, IbcMsg, IbcTimeout, Timestamp}; + use cw20::Cw20ReceiveMsg; + + use astroport::cw20_ics20::TransferMsg; use crate::contract::{execute, migrate, query_channel}; use crate::msg::{ExecuteMsg, MigrateMsg}; - use astroport::cw20_ics20::TransferMsg; - use cosmwasm_std::testing::{mock_env, mock_info}; - use cosmwasm_std::{coins, to_vec, Addr, IbcEndpoint, IbcMsg, IbcTimeout, Timestamp}; - use cw20::Cw20ReceiveMsg; + use crate::test_helpers::*; + + use super::*; #[test] fn check_ack_json() { @@ -586,10 +588,6 @@ mod test { ) } - fn mock_relayer_addr() -> Addr { - Addr::unchecked("relayer") - } - #[test] fn send_receive_cw20() { let send_channel = "channel-9"; @@ -608,7 +606,7 @@ mod test { mock_receive_packet(send_channel, 1876543210, cw20_denom, "local-rcpt", None); // cannot receive this denom yet - let msg = IbcPacketReceiveMsg::new(recv_packet.clone(), mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet.clone()); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); @@ -653,14 +651,14 @@ mod test { assert_eq!(state.total_sent, vec![Amount::cw20(987654321, cw20_addr)]); // cannot receive more than we sent - let msg = IbcPacketReceiveMsg::new(recv_high_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_high_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); assert_eq!(ack, no_funds); // we can receive less than we sent - let msg = IbcPacketReceiveMsg::new(recv_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert_eq!(1, res.messages.len()); assert_eq!( @@ -703,7 +701,7 @@ mod test { mock_receive_packet(send_channel, 1876543210, cw20_denom, "local-rcpt", None); // cannot receive this denom yet - let msg = IbcPacketReceiveMsg::new(recv_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); @@ -748,14 +746,14 @@ mod test { assert_eq!(state.total_sent, vec![Amount::cw20(987654321, cw20_addr)]); // cannot receive more than we sent - let msg = IbcPacketReceiveMsg::new(recv_high_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_high_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); assert_eq!(ack, no_funds); // We can receive less than we sent, but if a memo is set without a handler, we fail - let msg = IbcPacketReceiveMsg::new(recv_packet_with_memo, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet_with_memo); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); // No messages should be sent @@ -784,7 +782,7 @@ mod test { mock_receive_packet(send_channel, 1876543210, denom, "local-rcpt", None); // cannot receive this denom yet - let msg = IbcPacketReceiveMsg::new(recv_packet.clone(), mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet.clone()); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); @@ -807,14 +805,14 @@ mod test { assert_eq!(state.total_sent, vec![Amount::native(987654321, denom)]); // cannot receive more than we sent - let msg = IbcPacketReceiveMsg::new(recv_high_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_high_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert!(res.messages.is_empty()); let ack: Ics20Ack = from_binary(&res.acknowledgement).unwrap(); assert_eq!(ack, no_funds); // we can receive less than we sent - let msg = IbcPacketReceiveMsg::new(recv_packet, mock_relayer_addr()); + let msg = IbcPacketReceiveMsg::new(recv_packet); let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); assert_eq!(1, res.messages.len()); assert_eq!(