Skip to content
Open
Changes from 2 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
24 changes: 24 additions & 0 deletions pages/price-feeds/use-real-time-data/ton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,28 @@ This code snippet does the following:
4. Prepares the update data and calculates the update fee.
5. Updates the price feeds on the TON contract.

When providing Pyth data to your contract, there are typically two main scenarios: either you call a method supplying TON, or you transfer jettons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refer to the exact connector code block that shows these two scenarios ? That would help folks in better understanding.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connector is not merged yet, I used EVAA code for describing, pls take a look if it's ok.


They both are demonstrated in the [Pyth Connector example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/pyth-connector).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This url is giving me 404, will have to wait for this to get merged. Else we will have broken url.
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not merged yet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the example is not merged yet I can't add links to the code, so I only described the same patterns using EVAA code samples and diagrams

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we should add links to Pyth-connector as well, that would be useful.


These same patterns are also used in the
[EVAA Protocol code](https://github.com/evaafi/contracts/tree/v8).

1. **Pyth Proxy Call Pattern**
**Flow:** *User → Pyth → Your-Contract*

Use this method if you only need to send TON to your contract or simply call a contract method, without involving jettons.

2. **Onchain Getter Pattern**
**Flow:** *User → User-JW → Your-Contract-JW → Your-Contract → Pyth → Your-Contract*

> JW = Jetton Wallet

In this pattern, your contract first receives the Pyth data, then forwards it to the Pyth contract for validation, and finally gets the validated prices back.
This approach is useful when you want to transfer jettons to your contract while also providing price data.

Choose the pattern that best fits your use case and how you want to handle assets and price updates in your application.

## Additional Resources

You may find these additional resources helpful for developing your TON application:
Expand All @@ -134,3 +156,5 @@ You may find these additional resources helpful for developing your TON applicat
- [Pyth TON SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ton/sdk)
- [Pyth TON SDK Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/sdk_js_usage)
- [Pyth TON Send USD Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/send_usd)
- [Pyth Connector Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/pyth-connector)
- [EVAA Protocol Code](https://github.com/evaafi/contracts/tree/v8)