@@ -54,6 +54,10 @@ import {
5454 HERMES_SOL_UNIQUE_PRICE ,
5555 HERMES_SOL_UNIQUE_CONF ,
5656 HERMES_SOL_UNIQUE_EXPO ,
57+ HERMES_USDT_UNIQUE_PRICE ,
58+ HERMES_USDT_UNIQUE_EXPO ,
59+ HERMES_USDT_UNIQUE_CONF ,
60+ HERMES_USDT_UNIQUE_PUBLISH_TIME ,
5761} from "./utils/pyth" ;
5862import { GUARDIAN_SET_0 , MAINNET_UPGRADE_VAAS } from "./utils/wormhole" ;
5963import { DataSource } from "@pythnetwork/xc-admin-common" ;
@@ -1187,6 +1191,37 @@ describe("PythTest", () => {
11871191 expect ( solCurrentPrice . loadInt ( 32 ) ) . toBe ( HERMES_SOL_UNIQUE_EXPO ) ;
11881192 expect ( solCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_SOL_UNIQUE_PUBLISH_TIME ) ;
11891193
1194+ // Move through TON and PYTH price feeds to reach USDT
1195+ currentCell = solCs . loadRef ( ) ; // Move to TON
1196+ const tonCs = currentCell . beginParse ( ) ;
1197+ tonCs . loadUintBig ( 256 ) ; // Skip TON price ID
1198+ tonCs . loadRef ( ) ; // Skip TON price data
1199+
1200+ currentCell = tonCs . loadRef ( ) ; // Move to PYTH
1201+ const pythCs = currentCell . beginParse ( ) ;
1202+ pythCs . loadUintBig ( 256 ) ; // Skip PYTH price ID
1203+ pythCs . loadRef ( ) ; // Skip PYTH price data
1204+
1205+ currentCell = pythCs . loadRef ( ) ; // Move to USDT
1206+ const usdtCs = currentCell . beginParse ( ) ;
1207+ const usdtPriceId =
1208+ "0x" + usdtCs . loadUintBig ( 256 ) . toString ( 16 ) . padStart ( 64 , "0" ) ;
1209+ expect ( usdtPriceId ) . toBe ( USDT_PRICE_FEED_ID ) ;
1210+
1211+ const usdtPriceFeedCell = usdtCs . loadRef ( ) ;
1212+ const usdtPriceFeedSlice = usdtPriceFeedCell . beginParse ( ) ;
1213+
1214+ // Verify USDT current price
1215+ const usdtCurrentPriceCell = usdtPriceFeedSlice . loadRef ( ) ;
1216+ const usdtCurrentPrice = usdtCurrentPriceCell . beginParse ( ) ;
1217+ expect ( usdtCurrentPrice . loadInt ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_PRICE ) ;
1218+ expect ( usdtCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_CONF ) ;
1219+ expect ( usdtCurrentPrice . loadInt ( 32 ) ) . toBe ( HERMES_USDT_UNIQUE_EXPO ) ;
1220+ expect ( usdtCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_PUBLISH_TIME ) ;
1221+
1222+ // Verify this is the end of the chain
1223+ expect ( usdtCs . remainingRefs ) . toBe ( 0 ) ;
1224+
11901225 // Verify sender address
11911226 const senderAddress = cs . loadAddress ( ) ;
11921227 expect ( senderAddress ?. toString ( ) ) . toBe (
@@ -1390,6 +1425,38 @@ describe("PythTest", () => {
13901425 expect ( solCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_SOL_UNIQUE_CONF ) ;
13911426 expect ( solCurrentPrice . loadInt ( 32 ) ) . toBe ( HERMES_SOL_UNIQUE_EXPO ) ;
13921427 expect ( solCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_SOL_UNIQUE_PUBLISH_TIME ) ;
1428+
1429+ // Move through TON and PYTH price feeds to reach USDT
1430+ currentCell = solCs . loadRef ( ) ; // Move to TON
1431+ const tonCs = currentCell . beginParse ( ) ;
1432+ tonCs . loadUintBig ( 256 ) ; // Skip TON price ID
1433+ tonCs . loadRef ( ) ; // Skip TON price data
1434+
1435+ currentCell = tonCs . loadRef ( ) ; // Move to PYTH
1436+ const pythCs = currentCell . beginParse ( ) ;
1437+ pythCs . loadUintBig ( 256 ) ; // Skip PYTH price ID
1438+ pythCs . loadRef ( ) ; // Skip PYTH price data
1439+
1440+ currentCell = pythCs . loadRef ( ) ; // Move to USDT
1441+ const usdtCs = currentCell . beginParse ( ) ;
1442+ const usdtPriceId =
1443+ "0x" + usdtCs . loadUintBig ( 256 ) . toString ( 16 ) . padStart ( 64 , "0" ) ;
1444+ expect ( usdtPriceId ) . toBe ( USDT_PRICE_FEED_ID ) ;
1445+
1446+ const usdtPriceFeedCell = usdtCs . loadRef ( ) ;
1447+ const usdtPriceFeedSlice = usdtPriceFeedCell . beginParse ( ) ;
1448+
1449+ // Verify USDT current price
1450+ const usdtCurrentPriceCell = usdtPriceFeedSlice . loadRef ( ) ;
1451+ const usdtCurrentPrice = usdtCurrentPriceCell . beginParse ( ) ;
1452+ expect ( usdtCurrentPrice . loadInt ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_PRICE ) ;
1453+ expect ( usdtCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_CONF ) ;
1454+ expect ( usdtCurrentPrice . loadInt ( 32 ) ) . toBe ( HERMES_USDT_UNIQUE_EXPO ) ;
1455+ expect ( usdtCurrentPrice . loadUint ( 64 ) ) . toBe ( HERMES_USDT_UNIQUE_PUBLISH_TIME ) ;
1456+
1457+ // Verify this is the end of the chain
1458+ expect ( usdtCs . remainingRefs ) . toBe ( 0 ) ;
1459+
13931460 // Verify sender address
13941461 const senderAddress = cs . loadAddress ( ) ;
13951462 expect ( senderAddress ?. toString ( ) ) . toBe (
0 commit comments