Skip to content

Commit 3664ef3

Browse files
authored
Merge pull request #2840 from pyth-network/pyth-stylus-parse-updates
feat: stylus parse price feed updates fxn
2 parents 4871ad3 + 8f97571 commit 3664ef3

File tree

4 files changed

+232
-101
lines changed

4 files changed

+232
-101
lines changed

target_chains/stylus/contracts/pyth-receiver/src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pub enum PythReceiverError {
1717
InsufficientFee,
1818
InvalidEmitterAddress,
1919
TooManyUpdates,
20+
PriceFeedNotFoundWithinRange,
21+
NoFreshUpdate,
2022
}
2123

2224
impl core::fmt::Debug for PythReceiverError {
@@ -43,6 +45,8 @@ impl From<PythReceiverError> for Vec<u8> {
4345
PythReceiverError::InsufficientFee => 13,
4446
PythReceiverError::InvalidEmitterAddress => 14,
4547
PythReceiverError::TooManyUpdates => 15,
48+
PythReceiverError::PriceFeedNotFoundWithinRange => 16,
49+
PythReceiverError::NoFreshUpdate => 17,
4650
}]
4751
}
4852
}

target_chains/stylus/contracts/pyth-receiver/src/integration_tests.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,4 +342,14 @@ mod test {
342342
multiple_updates_diff_vaa_results()[1]
343343
);
344344
}
345+
346+
#[motsu::test]
347+
fn test_multiple_updates_same_id_updates_latest(
348+
pyth_contract: Contract<PythReceiver>,
349+
wormhole_contract: Contract<WormholeContract>,
350+
alice: Address,
351+
) {
352+
pyth_wormhole_init(&pyth_contract, &wormhole_contract, &alice);
353+
alice.fund(U256::from(200));
354+
}
345355
}

0 commit comments

Comments
 (0)