Skip to content

Commit 62083eb

Browse files
author
Dev Kalra
authored
[cosmwasm] Move data structures to pyth-sdk-cw (#578)
* pyth-sdk-cw add data structures * consume pyth-sdk-cw data structure * pre commit hooks
1 parent 3e9472b commit 62083eb

File tree

8 files changed

+18
-21
lines changed

8 files changed

+18
-21
lines changed

target_chains/cosmwasm/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/cosmwasm/contracts/pyth/src/bin/schema.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use {
22
cosmwasm_schema::write_api,
33
pyth_cosmwasm::msg::{
4-
ExecuteMsg,
54
InstantiateMsg,
65
MigrateMsg,
6+
},
7+
pyth_sdk_cw::{
8+
ExecuteMsg,
79
QueryMsg,
810
},
911
};

target_chains/cosmwasm/contracts/pyth/src/contract.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use {
22
crate::{
3-
error::PythContractError,
43
governance::{
54
GovernanceAction::{
65
AuthorizeGovernanceDataSourceTransfer,
@@ -13,10 +12,8 @@ use {
1312
GovernanceInstruction,
1413
},
1514
msg::{
16-
ExecuteMsg,
1715
InstantiateMsg,
1816
MigrateMsg,
19-
QueryMsg,
2017
},
2118
state::{
2219
config,
@@ -27,7 +24,6 @@ use {
2724
PriceInfo,
2825
PythDataSource,
2926
},
30-
Price,
3127
},
3228
cosmwasm_std::{
3329
coin,
@@ -52,9 +48,13 @@ use {
5248
WasmQuery,
5349
},
5450
pyth_sdk_cw::{
51+
error::PythContractError,
52+
ExecuteMsg,
53+
Price,
5554
PriceFeed,
5655
PriceFeedResponse,
5756
PriceIdentifier,
57+
QueryMsg,
5858
},
5959
pyth_wormhole_attester_sdk::{
6060
BatchPriceAttestation,

target_chains/cosmwasm/contracts/pyth/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
extern crate lazy_static;
33

44
pub mod contract;
5-
pub mod error;
65
pub mod governance;
76
pub mod msg;
87
pub mod state;
9-
10-
pub use pyth_sdk::Price;

target_chains/cosmwasm/contracts/pyth/src/msg.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
pub use pyth_sdk_cw::QueryMsg;
21
use {
32
crate::state::PythDataSource,
43
cosmwasm_schema::cw_serde,
5-
cosmwasm_std::{
6-
Binary,
7-
Coin,
8-
},
4+
cosmwasm_std::Coin,
95
};
106

117
// cw_serde attribute is equivalent to
@@ -29,14 +25,6 @@ pub struct InstantiateMsg {
2925
pub fee: Coin,
3026
}
3127

32-
#[derive(Eq)]
33-
#[cw_serde]
34-
pub enum ExecuteMsg {
35-
// TODO: add UpdatePriceFeeds if necessary
36-
UpdatePriceFeeds { data: Vec<Binary> },
37-
ExecuteGovernanceInstruction { data: Binary },
38-
}
39-
4028
#[derive(Eq)]
4129
#[cw_serde]
4230
pub struct MigrateMsg {}

target_chains/cosmwasm/pyth-sdk-cw/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ keywords = [ "pyth", "oracle", "cosmwasm" ]
1515
pyth-sdk = "0.7.0"
1616
cosmwasm-std = { version = "1.0.0" }
1717
cosmwasm-schema = "1.1.9"
18+
thiserror = "1.0.20"

target_chains/cosmwasm/pyth-sdk-cw/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
pub mod error;
12
pub use pyth_sdk::{
3+
Price,
24
PriceFeed,
35
PriceIdentifier,
46
};
@@ -14,6 +16,12 @@ use {
1416
std::time::Duration,
1517
};
1618

19+
#[derive(Eq)]
20+
#[cw_serde]
21+
pub enum ExecuteMsg {
22+
UpdatePriceFeeds { data: Vec<Binary> },
23+
ExecuteGovernanceInstruction { data: Binary },
24+
}
1725

1826
#[cw_serde]
1927
#[derive(QueryResponses)]

0 commit comments

Comments
 (0)