Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions target_chains/sui/contracts/Move.lock
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 3 additions & 2 deletions target_chains/sui/contracts/Move.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "Pyth"
version = "0.0.2"
published-at = "0x00b53b0f4174108627fbee72e2498b58d6a2714cded53fac537034c220d26302"

[dependencies.Sui]
git = "https://github.com/MystenLabs/sui.git"
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"
Expand Down
14 changes: 7 additions & 7 deletions target_chains/sui/contracts/sources/price.move
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 23 additions & 0 deletions target_chains/sui/contracts/sources/price_info.move
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down