[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-schema",
"cosmwasm-std", "cosmwasm-std",
"pyth-sdk 0.7.0", "pyth-sdk 0.7.0",
"thiserror",
] ]
[[package]] [[package]]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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