Skip to content

Commit c970a43

Browse files
committed
Merge branch 'sui_docs' of github.com:pyth-network/documentation into sui_docs
2 parents efb52ec + cf74732 commit c970a43

File tree

4 files changed

+20
-42
lines changed

4 files changed

+20
-42
lines changed

pages/sui/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
The Pyth Network Aptos contract allows users to submit price updates for verification and store them for later use.
1+
The Pyth Network Sui contract allows users to submit price updates for verification and store them for later use.
22
Please see the documentation section on [Pull Updates](documentation/pythnet-price-feeds/on-demand) if you haven't already;
3-
this section will explain the differences between Pyth Network and other oracles, and help you understand the expected usage patterns.
3+
this section will explain the differences between Pyth Network and other oracles, and help you understand the expected usage patterns. Pyth on Sui also automatically pushes prices on-chain for a subset of symbols. More information on this TBA.
44

55
Users of the Pyth contract will typically need to perform two operations:
66

77
- Update the on-chain price -- In off-chain code, retrieve a verified price update from the
88
[price service](documentation/pythnet-price-feeds/price-service) and submit it to the contract
99
for verification. This operation makes the price available for on-chain use.
10-
You will typically call [update_price_feeds](aptos/update-price-feeds) to do this.
10+
You will typically call [update_price_feeds](sui/update-price-feeds) to do this.
1111
- Read the on-chain price -- After updating the price, your on-chain contract can call one of the
12-
many getter functions on the contract to get the price. See [get_price](aptos/get-price) and its variants
12+
many getter functions on the contract to get the price. See [get_price](sui/get-price) and its variants
1313
for more information.

pages/sui/price-feed-exists.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Examples from "../../components/Examples";
1010

1111
Determine if a price feed for the given `price_identifier` exists.
1212
Returns `true` if there has been at least one on-chain update of this feed in the past.
13-
Note that a `false` answer may mean that the feed exists, but simply has never been updated on Aptos.
13+
Note that a `false` answer may mean that the feed exists, but simply has never been updated on Sui.
1414
In this case, you can invoke [update_price_feeds](update-price-feeds) to pull an update on-chain.
1515

1616
<div className="mt-6 overflow-x-auto">

pages/sui/sdks.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Tab, Tabs } from "nextra-theme-docs";
22

33
# SDKs
44

5-
Aptos contracts can program against the Pyth contract's interface by including it as a project dependency.
5+
Sui contracts can program against the Pyth contract's interface by including it as a project dependency.
66

77
## Installation Instructions
88

@@ -12,24 +12,23 @@ Aptos contracts can program against the Pyth contract's interface by including i
1212

1313
```toml
1414
[dependencies]
15-
Pyth = { git = "https://github.com/pyth-network/pyth-crosschain.git", subdir = "target_chains/aptos/contracts", rev = "main" }
15+
Pyth = { git = "https://github.com/pyth-network/pyth-crosschain.git", subdir = "target_chains/sui/contracts", rev = "main" }
1616
```
1717

1818
Note that this dependency references the latest version of the Pyth contract code.
1919
You can also choose the most recent git sha in order to have a repeatable build.
20-
This contract was compiled with [aptos-cli v1.0.4](https://github.com/aptos-labs/aptos-core/releases/tag/aptos-cli-v1.0.4).
20+
This contract was compiled with sui-cli sui 1.0.0-09b208149.
2121

2222
Next, add the following named addresses to the `[addresses]` section of `Move.toml`:
2323

2424
```toml
2525
[addresses]
26-
pyth = "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387"
27-
deployer = "0xb31e712b26fd295357355f6845e77c888298636609e93bc9b05f0f604049f434"
28-
wormhole = "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625"
26+
pyth = TBA
27+
wormhole = TBA
2928
```
3029

3130
These lines allow you to reference Pyth resources as `pyth` instead of manually writing the contract address.
32-
The contract addresses provided above are for both Aptos mainnet and testnet -- the Pyth contract has the same address in both cases.
31+
The contract addresses provided above are for both Sui mainnet -- the Pyth contract has a different address on testnet (contract addresses on Sui are not generated deterministically).
3332

3433
You can now import the Pyth interfaces in Move code as follows:
3534

pages/sui/update-single-price-feed.mdx

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ Reverts if the required fee is not paid, or the `update_data` is incorrectly sig
2525

2626
| Argument | Input | Description |
2727
| ---------------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
28-
| <Arg required={true} type="vector<vector<u8>>">update_data</Arg> | <Input id="update_data" format={InputFormats.ByteArray} /> | The price update data for the contract to verify. |
29-
| <Arg required={true} type="Coin<AptosCoin>">fee</Arg> | <Input id="fee" format={InputFormats.BigInt}/> | The update fee in octa. This fee is transferred to the Pyth contract as an effect of the transaction. |
30-
28+
| <Arg required={true} type="&PythState">pyth_state</Arg> | <Input id="pyth_state" format={InputFormats.ByteArray} /> | The Pyth state object. |
29+
| <Arg required={true} type=" HotPotatoVector<PriceInfo>,">price_updates</Arg> | <Input id="price_updates" format={InputFormats.BigInt}/> | vector of authenticated price updates |
30+
| <Arg required={true} type=" &mut PriceInfoObject">price_info_object</Arg> | <Input id="price_info_object" format={InputFormats.BigInt}/> | PriceInfoObject is a shared Sui object containing the price feed to be updated. |
31+
| <Arg required={true} type=" Coin<SUI>">fee</Arg> | <Input id="fee" format={InputFormats.BigInt}/> | Fee coins. |
32+
| <Arg required={true} type=" &Clock">clock</Arg> | <Input id="clock" format={InputFormats.BigInt}/> | clock is a Sui shared object used to tell time and record timestamps |
3133
</div>
3234

35+
# Warning: do not hardcode price feed updates in your contract
36+
`update_single_price_feed` is meant to be called in a chain of programmable transactions, rather than hardcoded in a contract. This is because when a Sui contract upgrades, the upgraded version lives at a different address. When this happens the previous callsite gets bricked, or becomes un-callable. It is up to the user to use the correct call-site (we also have a helper function for finding the latest call-site given the Pyth state object ID, which is unchanged between upgrades).
37+
3338
<Examples>
3439
<Example
3540
keyValues={{
@@ -43,36 +48,10 @@ Reverts if the required fee is not paid, or the `update_data` is incorrectly sig
4348
)
4449
),
4550
fee: async (ctx) => {
46-
// NOTE: this technically could get the update fee for a different VAA than the one above.
47-
// This shouldn't affect the update fee as long as the fee is only dependent on the price feed ids
48-
// and not the specific content of the price update.
4951
let vaa = (await ctx.getLatestPriceFeed("Crypto.BTC/USD")).vaa;
5052
return await ctx.getEthUpdateFee([vaa]);
5153
},
5254
}}
53-
value="Latest BTC/USD update data"
55+
Example TBA
5456
/>
5557
</Examples>
56-
57-
## Example Code
58-
59-
<Tabs items={['Move']}>
60-
<Tab>
61-
<DynamicCode targets={{
62-
"1": (ctx) => ctx.get("update_data", "<update_data>"),
63-
"2": (ctx) => ctx.get("fee", "<fee>"),
64-
}}>
65-
```rust copy
66-
use pyth::pyth;
67-
use pyth::price_identifier;
68-
69-
let coins = coin::withdraw<AptosCoin>(payer, 2)
70-
pyth::update_price_feeds(
71-
vec![1],
72-
coins
73-
);
74-
```
75-
</DynamicCode>
76-
</Tab>
77-
78-
</Tabs>

0 commit comments

Comments
 (0)