pub struct MockPyth {
pub valid_time_period: Duration,
pub fee_per_vaa: Coin,
pub feeds: HashMap<PriceIdentifier, PriceFeed>,
}
Expand description
Mock version of Pyth for testing cosmwasm contracts. This mock stores some price feeds and responds to query messages.
Fields§
§valid_time_period: Duration
§fee_per_vaa: Coin
§feeds: HashMap<PriceIdentifier, PriceFeed>
Implementations§
Source§impl MockPyth
impl MockPyth
Sourcepub fn new(
valid_time_period: Duration,
fee_per_vaa: Coin,
feeds: &[PriceFeed],
) -> Self
pub fn new( valid_time_period: Duration, fee_per_vaa: Coin, feeds: &[PriceFeed], ) -> Self
Create a new MockPyth
. You can either provide the full list of price feeds up front,
or add them later via add_feed
.
Sourcepub fn handle_wasm_query(&self, msg: &Binary) -> QuerierResult
pub fn handle_wasm_query(&self, msg: &Binary) -> QuerierResult
Handler for processing query messages.
See the tests in contract.rs
https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/cosmwasm/examples/cw-contract/src/contract.rs#L13
for how to use this handler within your tests.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockPyth
impl RefUnwindSafe for MockPyth
impl Send for MockPyth
impl Sync for MockPyth
impl Unpin for MockPyth
impl UnwindSafe for MockPyth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more