[cosmwasm] Move data structures to pyth-sdk-cw (#578)

* pyth-sdk-cw add data structures

* consume pyth-sdk-cw data structure

* pre commit hooks
This commit is contained in:
Dev Kalra 2023-02-11 00:23:24 +05:30 committed by GitHub
parent 3e9472b8ef
commit 62083eb6d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 21 deletions

View File

@ -1309,6 +1309,7 @@ dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
"pyth-sdk 0.7.0",
"thiserror",
]
[[package]]

View File

@ -1,9 +1,11 @@
use {
cosmwasm_schema::write_api,
pyth_cosmwasm::msg::{
ExecuteMsg,
InstantiateMsg,
MigrateMsg,
},
pyth_sdk_cw::{
ExecuteMsg,
QueryMsg,
},
};

View File

@ -1,6 +1,5 @@
use {
crate::{
error::PythContractError,
governance::{
GovernanceAction::{
AuthorizeGovernanceDataSourceTransfer,
@ -13,10 +12,8 @@ use {
GovernanceInstruction,
},
msg::{
ExecuteMsg,
InstantiateMsg,
MigrateMsg,
QueryMsg,
},
state::{
config,
@ -27,7 +24,6 @@ use {
PriceInfo,
PythDataSource,
},
Price,
},
cosmwasm_std::{
coin,
@ -52,9 +48,13 @@ use {
WasmQuery,
},
pyth_sdk_cw::{
error::PythContractError,
ExecuteMsg,
Price,
PriceFeed,
PriceFeedResponse,
PriceIdentifier,
QueryMsg,
},
pyth_wormhole_attester_sdk::{
BatchPriceAttestation,

View File

@ -2,9 +2,6 @@
extern crate lazy_static;
pub mod contract;
pub mod error;
pub mod governance;
pub mod msg;
pub mod state;
pub use pyth_sdk::Price;

View File

@ -1,11 +1,7 @@
pub use pyth_sdk_cw::QueryMsg;
use {
crate::state::PythDataSource,
cosmwasm_schema::cw_serde,
cosmwasm_std::{
Binary,
Coin,
},
cosmwasm_std::Coin,
};
// cw_serde attribute is equivalent to
@ -29,14 +25,6 @@ pub struct InstantiateMsg {
pub fee: Coin,
}
#[derive(Eq)]
#[cw_serde]
pub enum ExecuteMsg {
// TODO: add UpdatePriceFeeds if necessary
UpdatePriceFeeds { data: Vec<Binary> },
ExecuteGovernanceInstruction { data: Binary },
}
#[derive(Eq)]
#[cw_serde]
pub struct MigrateMsg {}

View File

@ -15,3 +15,4 @@ keywords = [ "pyth", "oracle", "cosmwasm" ]
pyth-sdk = "0.7.0"
cosmwasm-std = { version = "1.0.0" }
cosmwasm-schema = "1.1.9"
thiserror = "1.0.20"

View File

@ -1,4 +1,6 @@
pub mod error;
pub use pyth_sdk::{
Price,
PriceFeed,
PriceIdentifier,
};
@ -14,6 +16,12 @@ use {
std::time::Duration,
};
#[derive(Eq)]
#[cw_serde]
pub enum ExecuteMsg {
UpdatePriceFeeds { data: Vec<Binary> },
ExecuteGovernanceInstruction { data: Binary },
}
#[cw_serde]
#[derive(QueryResponses)]