diff --git a/target_chains/sui/contracts/Move.lock b/target_chains/sui/contracts/Move.lock index e6a4b9cea9..7e0d0662e6 100644 --- a/target_chains/sui/contracts/Move.lock +++ b/target_chains/sui/contracts/Move.lock @@ -1,36 +1,35 @@ # @generated by Move, please check-in and do not edit manually. [move] -version = 0 -manifest_digest = "320300697C11C4D84BF6ED32C1DB48A4EE830B6B44F4DFDA4E89345875C5EA11" +version = 3 +manifest_digest = "44F029ECFF2435A559351E8655F6F6674E0D6D9DBFEEAEAEB180176D2F2B66C9" deps_digest = "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600" - dependencies = [ - { name = "Sui" }, - { name = "Wormhole" }, + { id = "Sui", name = "Sui" }, + { id = "Wormhole", name = "Wormhole" }, ] [[move.package]] -name = "MoveStdlib" +id = "MoveStdlib" source = { git = "https://github.com/MystenLabs/sui.git", rev = "041c5f2bae2fe52079e44b70514333532d69f4e6", subdir = "crates/sui-framework/packages/move-stdlib" } [[move.package]] -name = "Sui" +id = "Sui" source = { git = "https://github.com/MystenLabs/sui.git", rev = "041c5f2bae2fe52079e44b70514333532d69f4e6", subdir = "crates/sui-framework/packages/sui-framework" } dependencies = [ - { name = "MoveStdlib" }, + { id = "MoveStdlib", name = "MoveStdlib" }, ] [[move.package]] -name = "Wormhole" -source = { git = "https://github.com/wormhole-foundation/wormhole.git", rev = "82d82bffd5a8566e4b5d94be4e4678ad55ab1f4f", subdir = "sui/wormhole" } +id = "Wormhole" +source = { git = "https://github.com/suilend/wormhole.git", rev = "77f64bb000d6823b2a3c8ce5afc3e2f521b9a298", subdir = "sui/wormhole" } dependencies = [ - { name = "Sui" }, + { id = "Sui", name = "Sui" }, ] [move.toolchain-version] -compiler-version = "1.19.1" -edition = "legacy" +compiler-version = "1.56.2" +edition = "2024" flavor = "sui" diff --git a/target_chains/sui/contracts/Move.toml b/target_chains/sui/contracts/Move.toml index fabdea676e..02d9436092 100644 --- a/target_chains/sui/contracts/Move.toml +++ b/target_chains/sui/contracts/Move.toml @@ -1,6 +1,7 @@ [package] name = "Pyth" version = "0.0.2" +published-at = "0x00b53b0f4174108627fbee72e2498b58d6a2714cded53fac537034c220d26302" [dependencies.Sui] git = "https://github.com/MystenLabs/sui.git" @@ -8,9 +9,9 @@ subdir = "crates/sui-framework/packages/sui-framework" rev = "041c5f2bae2fe52079e44b70514333532d69f4e6" [dependencies.Wormhole] -git = "https://github.com/wormhole-foundation/wormhole.git" +git = "https://github.com/suilend/wormhole.git" subdir = "sui/wormhole" -rev = "82d82bffd5a8566e4b5d94be4e4678ad55ab1f4f" +rev = "77f64bb000d6823b2a3c8ce5afc3e2f521b9a298" [addresses] pyth = "0x00b53b0f4174108627fbee72e2498b58d6a2714cded53fac537034c220d26302" diff --git a/target_chains/sui/contracts/sources/price.move b/target_chains/sui/contracts/sources/price.move index ea92602b9e..a1237c12a9 100644 --- a/target_chains/sui/contracts/sources/price.move +++ b/target_chains/sui/contracts/sources/price.move @@ -1,14 +1,14 @@ module pyth::price { use pyth::i64::I64; - /// A price with a degree of uncertainty, represented as a price +- a confidence interval. - /// - /// The confidence interval roughly corresponds to the standard error of a normal distribution. - /// Both the price and confidence are stored in a fixed-point numeric representation, - /// `x * (10^expo)`, where `expo` is the exponent. + // A price with a degree of uncertainty, represented as a price +- a confidence interval. // - /// Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how - /// to how this price safely. + // The confidence interval roughly corresponds to the standard error of a normal distribution. + // Both the price and confidence are stored in a fixed-point numeric representation, + // `x * (10^expo)`, where `expo` is the exponent. + // + // Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how + // to how this price safely. struct Price has copy, drop, store { price: I64, /// Confidence interval around the price diff --git a/target_chains/sui/contracts/sources/price_info.move b/target_chains/sui/contracts/sources/price_info.move index 132921ef7e..a53a7825f5 100644 --- a/target_chains/sui/contracts/sources/price_info.move +++ b/target_chains/sui/contracts/sources/price_info.move @@ -137,6 +137,29 @@ module pyth::price_info { } } + #[test_only] + public fun new_price_info_object_for_testing( + price_info: PriceInfo, + ctx: &mut TxContext + ): PriceInfoObject { + PriceInfoObject { + id: object::new(ctx), + price_info + } + } + + #[test_only] + public fun update_price_info_object_for_testing( + price_info_object: &mut PriceInfoObject, + price_info: &PriceInfo + ) { + price_info_object.price_info = new_price_info( + price_info.attestation_time, + price_info.arrival_time, + price_info.price_feed + ); + } + #[test] public fun test_get_price_info_object_id_from_price_identifier(){ use sui::object::{Self};