-
Notifications
You must be signed in to change notification settings - Fork 37
add pyth patterns info in the pyth-connector example #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
eff9a2d
5e32248
16ed2bf
ce855c0
41c0c96
d254752
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
||
They both are demonstrated in the [Pyth Connector example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/ton/pyth-connector). | ||
|
||
|
||
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* | ||
|
||
nidhi-singh02 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
> 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: | ||
|
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.