|
|
@@ -1,6 +1,12 @@
|
|
|
# Pyth on Sui
|
|
|
+### Contents
|
|
|
+1. Background
|
|
|
+2. How to Update and Consume Price Feeds
|
|
|
+3. Examples
|
|
|
+4. Contracts Registry (addresses)
|
|
|
+5. Common Questions how How to Integrate with Pyth on Sui
|
|
|
|
|
|
-## 1. Background
|
|
|
+# 1. Background
|
|
|
|
|
|
Pyth price feeds on Sui are uniquely represented in the global store as `PriceInfoObjects`. These objects have the `key` ability and serve as wrappers around the `PriceInfo` object, which in turn wraps around the `PriceFeed`, the arrival time of the latest price update, and the attestation time of the latest update.
|
|
|
|
|
|
@@ -9,7 +15,7 @@ Pyth price feeds on Sui are uniquely represented in the global store as `PriceIn
|
|
|
- `update_single_price_feed`
|
|
|
- `update_single_pric_feeds_if_fresh`
|
|
|
|
|
|
-## 2. How to Update and Consume Price Feeds
|
|
|
+# 2. How to Update and Consume Price Feeds
|
|
|
|
|
|
To update and then consume a price feed, one needs to build a Sui [programmable transaction](https://docs.sui.io/build/prog-trans-ts-sdk).
|
|
|
|
|
|
@@ -68,7 +74,7 @@ public fun get_price(
|
|
|
```
|
|
|
This looks like a long sequence of calls to update a price feed, but programmable transactions make it easy. (See demos below).
|
|
|
|
|
|
-## 3. Examples
|
|
|
+# 3. Examples
|
|
|
|
|
|
See the `./scripts` folder for examples of programmable transactions for creating price feeds and updating price feeds.
|
|
|
- [Demo for updating a price feed](./scripts/pyth/update_price_feeds.ts)
|
|
|
@@ -79,7 +85,7 @@ $ make test
|
|
|
$ make build
|
|
|
```
|
|
|
|
|
|
-## 4. Contracts Registry
|
|
|
+# 4. Contracts Registry
|
|
|
|
|
|
## Pyth on Testnet
|
|
|
|
|
|
@@ -103,10 +109,10 @@ $ make build
|
|
|
- WORMHOLE_PACKAGE_ID: [0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a](https://explorer.sui.io/object/0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a)
|
|
|
- WORMHOLE_STATE_ID: [0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c](https://explorer.sui.io/object/0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c)
|
|
|
|
|
|
-## 5. Common Questions on How to Integrate with Pyth
|
|
|
+# 5. Common Questions on How to Integrate with Pyth on Sui
|
|
|
1. What is up with the "sui rev"? (`09b2081498366df936abae26eea4b2d5cafb2788`). Why does it point to a specific commit hash instead of Sui github "main" or "devnet"?
|
|
|
|
|
|
-Our Pyth `Move.toml` file looks like the following. It depends on specific versions of the Sui Framework as well as Wormhole. To make your contracts compatible, you must also specify the following dependencies verbatim in your `Move.toml` file. We are locked in to this specific `rev` because our package depends on Wormhole, which uses this rev.
|
|
|
+Our Pyth `Move.toml` file contains the following dependencies. It depends on specific versions of the [Sui Framework](https://github.com/MystenLabs/sui) as well as [Wormhole](https://github.com/wormhole-foundation/wormhole). To make your Sui package compatible, you must also specify the following dependencies verbatim in your `Move.toml` file. We are locked in to this specific `rev` because our package depends on Wormhole, which uses this `rev`.
|
|
|
```
|
|
|
[dependencies.Sui]
|
|
|
git = "https://github.com/MystenLabs/sui.git"
|