Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deps #187

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 90 additions & 63 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ mesh-simple-price-feed = { path = "./contracts/consumer/simple-price-feed" }
mesh-virtual-staking = { path = "./contracts/consumer/virtual-staking" }

sylvia = "0.8.1"
cosmwasm-schema = "1.3.3"
cosmwasm-std = { version = "1.3.3", features = ["ibc3", "cosmwasm_1_3"] }
cw-storage-plus = "1.1.0"
cw-utils = "1.0.1"
cw2 = "1.0.1"
cosmwasm-schema = "1.5.4"
cosmwasm-std = { version = "1.5.4", features = ["ibc3", "cosmwasm_1_3"] }
cw-storage-plus = "1.2.0"
cw-utils = "1.0.3"
cw2 = "1.1.2"
osmosis-std = "0.20.1"
schemars = "0.8.11"
serde = { version = "1.0.152", default-features = false, features = ["derive"] }
thiserror = "1.0.38"
semver = "1.0.4"
itertools = "0.11.0"
schemars = "0.8.17"
serde = { version = "1.0.199", default-features = false, features = ["derive"] }
thiserror = "1.0.59"
semver = "1.0.22"
itertools = "0.12.1"

# dev deps
anyhow = "1"
cw-multi-test = "0.16.5"
derivative = "2"
test-case = "2.2.0"
test-case = "3.3.1"

[profile.release]
codegen-units = 1
Expand Down
10 changes: 5 additions & 5 deletions contracts/consumer/converter/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_std::{
ensure_eq, to_binary, Addr, BankMsg, Coin, CosmosMsg, Decimal, Deps, DepsMut, Event, Fraction,
MessageInfo, Reply, Response, SubMsg, SubMsgResponse, Uint128, Validator, WasmMsg,
ensure_eq, to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Decimal, Deps, DepsMut, Event,
Fraction, MessageInfo, Reply, Response, SubMsg, SubMsgResponse, Uint128, Validator, WasmMsg,
};
use cw2::set_contract_version;
use cw_storage_plus::Item;
Expand Down Expand Up @@ -203,7 +203,7 @@ impl ConverterContract<'_> {
let msg = virtual_staking_api::ExecMsg::Bond { validator, amount };
let msg = WasmMsg::Execute {
contract_addr: self.virtual_stake.load(deps.storage)?.into(),
msg: to_binary(&msg)?,
msg: to_json_binary(&msg)?,
funds: vec![],
};

Expand All @@ -227,7 +227,7 @@ impl ConverterContract<'_> {
let msg = virtual_staking_api::ExecMsg::Unbond { validator, amount };
let msg = WasmMsg::Execute {
contract_addr: self.virtual_stake.load(deps.storage)?.into(),
msg: to_binary(&msg)?,
msg: to_json_binary(&msg)?,
funds: vec![],
};

Expand All @@ -254,7 +254,7 @@ impl ConverterContract<'_> {
};
let msg = WasmMsg::Execute {
contract_addr: self.virtual_stake.load(deps.storage)?.into(),
msg: to_binary(&msg)?,
msg: to_json_binary(&msg)?,
funds: vec![],
};

Expand Down
14 changes: 7 additions & 7 deletions contracts/consumer/converter/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use cosmwasm_std::entry_point;

use cosmwasm_std::{
from_slice, to_binary, DepsMut, Env, Event, Ibc3ChannelOpenResponse, IbcBasicResponse,
from_json, to_json_binary, DepsMut, Env, Event, Ibc3ChannelOpenResponse, IbcBasicResponse,
IbcChannel, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg,
IbcChannelOpenResponse, IbcMsg, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg,
IbcReceiveResponse, IbcTimeout, Validator,
Expand Down Expand Up @@ -73,7 +73,7 @@ pub fn ibc_channel_open(
version: SUPPORTED_IBC_PROTOCOL_VERSION.to_string(),
}
} else {
let v: ProtocolVersion = from_slice(channel.version.as_bytes())?;
let v: ProtocolVersion = from_json(channel.version.as_bytes())?;
// if we can build a response to this, then it is compatible. And we use the highest version there
v.build_response(SUPPORTED_IBC_PROTOCOL_VERSION, MIN_IBC_PROTOCOL_VERSION)?
};
Expand Down Expand Up @@ -108,7 +108,7 @@ pub fn ibc_channel_connect(

// Ensure the counterparty responded with a version we support.
// Note: here, we error if it is higher than what we proposed originally
let v: ProtocolVersion = from_slice(counterparty_version.as_bytes())?;
let v: ProtocolVersion = from_json(counterparty_version.as_bytes())?;
v.verify_compatibility(SUPPORTED_IBC_PROTOCOL_VERSION, MIN_IBC_PROTOCOL_VERSION)?;

// store the channel
Expand Down Expand Up @@ -162,7 +162,7 @@ pub(crate) fn valset_update_msg(
};
let msg = IbcMsg::SendPacket {
channel_id: channel.endpoint.channel_id.clone(),
data: to_binary(&packet)?,
data: to_json_binary(&packet)?,
timeout: packet_timeout_validator(env),
};
Ok(msg)
Expand All @@ -188,7 +188,7 @@ pub fn ibc_packet_receive(
_env: Env,
msg: IbcPacketReceiveMsg,
) -> Result<IbcReceiveResponse, ContractError> {
let packet: ProviderPacket = from_slice(&msg.packet.data)?;
let packet: ProviderPacket = from_json(msg.packet.data)?;
let contract = ConverterContract::new();
let res = match packet {
ProviderPacket::Stake {
Expand Down Expand Up @@ -246,7 +246,7 @@ pub fn ibc_packet_ack(
_env: Env,
msg: IbcPacketAckMsg,
) -> Result<IbcBasicResponse, ContractError> {
let ack: AckWrapper = from_slice(&msg.acknowledgement.data)?;
let ack: AckWrapper = from_json(&msg.acknowledgement.data)?;
let mut res = IbcBasicResponse::new();
match ack {
AckWrapper::Result(_) => {}
Expand Down Expand Up @@ -286,7 +286,7 @@ pub(crate) fn make_ibc_packet(
let channel = IBC_CHANNEL.load(ctx.deps.storage)?;
Ok(IbcMsg::SendPacket {
channel_id: channel.endpoint.channel_id,
data: to_binary(&packet)?,
data: to_json_binary(&packet)?,
timeout: packet_timeout_rewards(&ctx.env),
})
}
4 changes: 3 additions & 1 deletion contracts/consumer/converter/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,9 @@ fn valset_update_works() {
assert_eq!(
res.unwrap_err(),
ContractError::Std(StdError::NotFound {
kind: "cosmwasm_std::ibc::IbcChannel".to_string()
kind:
"type: cosmwasm_std::ibc::IbcChannel; key: [69, 62, 63, 5F, 63, 68, 61, 6E, 6E, 65, 6C]"
.to_string()
})
);
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/consumer/remote-price-feed/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use cosmwasm_std::entry_point;

use cosmwasm_std::{
from_slice, to_binary, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse, IbcChannel,
from_json, to_json_binary, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse, IbcChannel,
IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcMsg,
IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, IbcTimeout,
Timestamp,
Expand Down Expand Up @@ -65,7 +65,7 @@ pub fn ibc_channel_open(
}

// we handshake with the counterparty version, it must not be empty
let v: ProtocolVersion = from_slice(counterparty_version.as_bytes())?;
let v: ProtocolVersion = from_json(counterparty_version.as_bytes())?;
// if we can build a response to this, then it is compatible. And we use the highest version there
let version = v.build_response(SUPPORTED_IBC_PROTOCOL_VERSION, MIN_IBC_PROTOCOL_VERSION)?;

Expand Down Expand Up @@ -125,7 +125,7 @@ pub fn ibc_packet_ack(
_env: Env,
msg: IbcPacketAckMsg,
) -> Result<IbcBasicResponse, ContractError> {
let ack: PriceFeedProviderAck = from_slice(&msg.acknowledgement.data)?;
let ack: PriceFeedProviderAck = from_json(msg.acknowledgement.data)?;
let PriceFeedProviderAck::Update { time, twap } = ack;
let contract = RemotePriceFeedContract::new();
contract.update_twap(deps, time, twap)?;
Expand All @@ -149,7 +149,7 @@ pub(crate) fn make_ibc_packet(
) -> Result<IbcMsg, ContractError> {
Ok(IbcMsg::SendPacket {
channel_id: channel.endpoint.channel_id,
data: to_binary(&packet)?,
data: to_json_binary(&packet)?,
timeout: packet_timeout(now),
})
}
14 changes: 7 additions & 7 deletions contracts/consumer/virtual-staking/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::collections::{BTreeMap, HashMap, HashSet};

use cosmwasm_std::{
coin, ensure_eq, entry_point, to_binary, Coin, CosmosMsg, CustomQuery, DepsMut,
coin, ensure_eq, entry_point, to_json_binary, Coin, CosmosMsg, CustomQuery, DepsMut,
DistributionMsg, Env, Event, Reply, Response, StdResult, Storage, SubMsg, Uint128, Validator,
WasmMsg,
};
Expand Down Expand Up @@ -52,7 +52,7 @@
}

#[cfg_attr(not(feature = "library"), sylvia::entry_points)]
#[contract]

Check warning on line 55 in contracts/consumer/virtual-staking/src/contract.rs

View workflow job for this annotation

GitHub Actions / Test Suite

use of deprecated function `cosmwasm_std::to_binary`: use to_json_binary instead
#[error(ContractError)]
#[messages(virtual_staking_api as VirtualStakingApi)]
// #[sv::override_entry_point(sudo=sudo(SudoMsg))] // Disabled because lack of custom query support
Expand Down Expand Up @@ -262,7 +262,7 @@
};
let msg = WasmMsg::Execute {
contract_addr: cfg.converter.to_string(),
msg: to_binary(&msg)?,
msg: to_json_binary(&msg)?,
funds: vec![],
};
let resp = Response::new().add_message(msg);
Expand Down Expand Up @@ -338,7 +338,7 @@
};
let msg = WasmMsg::Execute {
contract_addr: cfg.converter.into_string(),
msg: to_binary(&msg)?,
msg: to_json_binary(&msg)?,
funds: vec![coin(total.into(), cfg.denom)],
};
Ok(Response::new().add_message(msg))
Expand Down Expand Up @@ -644,7 +644,7 @@
};

use cosmwasm_std::{
coins, from_binary,
coins, from_json,
testing::{mock_env, mock_info, MockApi, MockQuerier, MockStorage},
Decimal,
};
Expand Down Expand Up @@ -1221,12 +1221,12 @@
match msg {
mesh_bindings::VirtualStakeQuery::BondStatus { .. } => {
cosmwasm_std::SystemResult::Ok(cosmwasm_std::ContractResult::Ok(
to_binary(&*bs_copy.borrow()).unwrap(),
to_json_binary(&*bs_copy.borrow()).unwrap(),
))
}
mesh_bindings::VirtualStakeQuery::SlashRatio {} => {
cosmwasm_std::SystemResult::Ok(cosmwasm_std::ContractResult::Ok(
to_binary(&*slash_ratio.borrow()).unwrap(),
to_json_binary(&*slash_ratio.borrow()).unwrap(),
))
}
}
Expand Down Expand Up @@ -1515,7 +1515,7 @@
..
}] => {
if let converter_api::ExecMsg::DistributeRewards { mut payments } =
from_binary(bin_msg).unwrap()
from_json(bin_msg).unwrap()
{
payments.sort();
Self::Batch(payments)
Expand Down
15 changes: 10 additions & 5 deletions contracts/osmosis-price-provider/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use cosmwasm_std::entry_point;

use cosmwasm_std::{
from_slice, to_binary, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse,
from_json, to_json_binary, DepsMut, Env, Ibc3ChannelOpenResponse, IbcBasicResponse,
IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse,
IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, IbcTimeout,
StdError, Timestamp,
Expand Down Expand Up @@ -46,7 +46,7 @@ pub fn ibc_channel_open(
version: SUPPORTED_IBC_PROTOCOL_VERSION.to_string(),
}
} else {
let v: ProtocolVersion = from_slice(channel.version.as_bytes())?;
let v: ProtocolVersion = from_json(channel.version.as_bytes())?;
// if we can build a response to this, then it is compatible. And we use the highest version there
v.build_response(SUPPORTED_IBC_PROTOCOL_VERSION, MIN_IBC_PROTOCOL_VERSION)?
};
Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn ibc_channel_connect(

// Ensure the counterparty responded with a version we support.
// Note: here, we error if it is higher than what we proposed originally
let v: ProtocolVersion = from_slice(counterparty_version.as_bytes())?;
let v: ProtocolVersion = from_json(counterparty_version.as_bytes())?;
v.verify_compatibility(SUPPORTED_IBC_PROTOCOL_VERSION, MIN_IBC_PROTOCOL_VERSION)?;

let contract = OsmosisPriceProvider::new();
Expand Down Expand Up @@ -124,12 +124,17 @@ pub fn ibc_packet_receive(
pool_id,
base_asset,
quote_asset,
} = from_slice(&msg.packet.data)?;
} = from_json(msg.packet.data)?;
let contract = OsmosisPriceProvider::new();

let time = env.block.time;
let twap = contract.query_twap(deps, pool_id, base_asset, quote_asset)?;
Ok(IbcReceiveResponse::new().set_ack(to_binary(&PriceFeedProviderAck::Update { time, twap })?))
Ok(
IbcReceiveResponse::new().set_ack(to_json_binary(&PriceFeedProviderAck::Update {
time,
twap,
})?),
)
}

#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down
Loading
Loading