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

[cosmwasm] Use ParsedVaa from wormhole contract #1237

Merged
merged 7 commits into from
Jan 24, 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
22 changes: 17 additions & 5 deletions target_chains/cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions target_chains/cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
members = ["contracts/pyth", "sdk/rust"]
exclude = ["examples/cw-contract"]

resolver = "2"

[profile.release]
opt-level = 3
debug = false
Expand All @@ -12,6 +14,3 @@ codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[patch.crates-io]
cw20-wrapped-2 = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.14.8"}
1 change: 1 addition & 0 deletions target_chains/cosmwasm/contracts/pyth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cosmwasm-schema = "1.1.9"
osmosis-std = "0.15.2"
pyth-sdk-cw = { path = "../../sdk/rust" }
pythnet-sdk = { path = "../../../../pythnet/pythnet_sdk" }
wormhole-cosmwasm = {git = "https://github.com/wormhole-foundation/wormhole", tag="v2.23.37"}

[dev-dependencies]
cosmwasm-vm = { version = "1.0.0", default-features = false }
Expand Down
18 changes: 9 additions & 9 deletions target_chains/cosmwasm/contracts/pyth/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ use {
ConfigInfo,
PythDataSource,
},
wormhole::{
ParsedVAA,
WormholeQueryMsg,
},
},
byteorder::BigEndian,
cosmwasm_std::{
Expand All @@ -60,6 +56,10 @@ use {
WasmMsg,
WasmQuery,
},
cw_wormhole::{
msg::QueryMsg as WormholeQueryMsg,
state::ParsedVAA,
},
pyth_sdk::{
Identifier,
UnixTimestamp,
Expand Down Expand Up @@ -1095,28 +1095,28 @@ mod test {
#[cfg(feature = "osmosis")]
fn check_sufficient_fee(deps: &Deps, data: &[Binary]) {
let mut info = mock_info("123", coins(100, "foo").as_slice());
let result = is_fee_sufficient(&deps, info.clone(), &data);
let result = is_fee_sufficient(deps, info.clone(), data);
assert_eq!(result, Ok(true));

// insufficient fee in base denom -> false
info.funds = coins(50, "foo");
let result = is_fee_sufficient(&deps, info.clone(), &data);
let result = is_fee_sufficient(deps, info.clone(), data);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy did this

assert_eq!(result, Ok(false));

// valid denoms are 'uion' or 'ibc/FF3065989E34457F342D4EFB8692406D49D4E2B5C70F725F127862E22CE6BDCD'
// a valid denom other than base denom with sufficient fee
info.funds = coins(100, "uion");
let result = is_fee_sufficient(&deps, info.clone(), &data);
let result = is_fee_sufficient(deps, info.clone(), data);
assert_eq!(result, Ok(true));

// insufficient fee in valid denom -> false
info.funds = coins(50, "uion");
let result = is_fee_sufficient(&deps, info.clone(), &data);
let result = is_fee_sufficient(deps, info.clone(), data);
assert_eq!(result, Ok(false));

// an invalid denom -> Err invalid fee denom
info.funds = coins(100, "invalid_denom");
let result = is_fee_sufficient(&deps, info, &data);
let result = is_fee_sufficient(deps, info, data);
assert_eq!(
result,
Err(PythContractError::InvalidFeeDenom {
Expand Down
1 change: 0 additions & 1 deletion target_chains/cosmwasm/contracts/pyth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod contract;
pub mod governance;
pub mod msg;
pub mod state;
pub mod wormhole;

#[cfg(feature = "injective")]
mod injective;
46 changes: 0 additions & 46 deletions target_chains/cosmwasm/contracts/pyth/src/wormhole.rs

This file was deleted.

Loading