Skip to content

Conversation

masterjedy
Copy link

@masterjedy masterjedy commented Sep 1, 2025

Description

Provides short description of pyth data flow patterns used in pyth connector example and EVAA code.

Type of Change

documentation

  • New Page
  • Page update/improvement
  • Fix typo/grammar
  • Restructure/reorganize content
  • Update links/references
  • Other (please describe):

Areas Affected

price_feeds / use-real-time-data / ton.mdx

Checklist

  • I ran pre-commit run --all-files to check for linting errors
  • I have reviewed my changes for clarity and accuracy
  • All links are valid and working
  • Images (if any) are properly formatted and include alt text
  • Code examples (if any) are complete and functional
  • Content follows the established style guide
  • Changes are properly formatted in Markdown
  • Preview renders correctly in development environment

Related Issues

Closes #

Additional Notes

Contributor Information

Evaa protocol employee

Screenshots

Signed-off-by: master_jedy <yura.zarudny@gmail.com>
Copy link

vercel bot commented Sep 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Sep 6, 2025 0:46am
documentation Error Error Sep 6, 2025 0:46am

Copy link

vercel bot commented Sep 1, 2025

@masterjedy is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: master_jedy <yura.zarudny@gmail.com>
@@ -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).
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.

@@ -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.

Signed-off-by: master_jedy <yura.zarudny@gmail.com>
Signed-off-by: master_jedy <yura.zarudny@gmail.com>
Comment on lines 177 to 179
participant "U" as "User"
participant "P" as "Pyth Contract"

Copy link
Contributor

Choose a reason for hiding this comment

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

The double quotes can be removed from here. Else these are coming in the diagram.

image

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 190 to 193
participant "U" as "User"
participant "JW" as "Jetton Wallet"
participant "M" as "EVAA Master"
participant "P" as "Pyth Contract"
Copy link
Contributor

Choose a reason for hiding this comment

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

remove double quotes

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@nidhi-singh02 nidhi-singh02 left a comment

Choose a reason for hiding this comment

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

pre-commit is failing, please fix it.

Comment on lines 215 to 218
participant "U" as "User"
participant "JW" as "Jetton Wallet"
participant "M" as "EVAA Master"
participant "P" as "Pyth Contract"
Copy link
Contributor

Choose a reason for hiding this comment

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

remove double quotes

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Author

Choose a reason for hiding this comment

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

done

- **Jetton on-chain getter**: `User → Jetton Wallet → EVAA Master → Pyth → EVAA Master → ... (further processing)`
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.
*Note: This diagram is simplified. In reality, the "Jetton Wallet" step consists of a sequence of transactions: User's jetton wallet → EVAA jetton wallet → EVAA master. These internal details are omitted here to highlight the main flow and the interaction with Pyth.*
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can say the data flow instead of diagram

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

ok, replaced

Comment on lines 137 to 138
This approach is useful when you want to transfer jettons to your contract while also providing price data.
*Note: This diagram is simplified. In reality, the "Jetton Wallet" step consists of a sequence of transactions: User's jetton wallet → EVAA jetton wallet → EVAA master. These internal details are omitted here to highlight the main flow and the interaction with Pyth.*
Copy link
Contributor

Choose a reason for hiding this comment

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

image Note not coming properly, pls use
import { Callout } from "nextra/components";

<Callout type="info" emoji="ℹ️">
</Callout>

Copy link
Author

Choose a reason for hiding this comment

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

ok, will try it

Copy link
Author

Choose a reason for hiding this comment

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

replaced with Callout, it looks better.

@@ -124,6 +124,112 @@ 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.


# Patterns for Providing Pyth Data to Your Contract
Copy link
Contributor

Choose a reason for hiding this comment

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

make it ## as it one level below How to Use Real-Time Data in TON Contracts

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

fixed


Each operation described above can result in either a successful outcome or an error. It is important to consider and handle both scenarios for every pattern.

## Pyth proxy: Success
Copy link
Contributor

Choose a reason for hiding this comment

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

make it ### as all these are coming in the navigation bar.

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

fixed

- [Pyth proxy: liquidate (TON) in master.fc](https://github.com/evaafi/contracts/blob/d9138cb24f03b53522774351aceb38c51a047eee/contracts/master.fc#L171-L190)


## Pyth proxy: Error handling
Copy link
Contributor

Choose a reason for hiding this comment

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

make it ### as all these are coming in the navigation bar.

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

fixed

```


## Pyth onchain-getter: Success
Copy link
Contributor

Choose a reason for hiding this comment

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

make it ### as all these are coming in the navigation bar.

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

fixed

- [Request to Pyth (liquidate jetton)](https://github.com/evaafi/contracts/blob/d9138cb24f03b53522774351aceb38c51a047eee/contracts/core/master-liquidate.fc#L728-L742)
- [Request to Pyth (supply_withdraw jetton)](https://github.com/evaafi/contracts/blob/d9138cb24f03b53522774351aceb38c51a047eee/contracts/core/master-supply-withdrawal.fc#L446-L461)

## Pyth onchain-getter: Pyth error
Copy link
Contributor

Choose a reason for hiding this comment

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

make it ### as all these are coming in the navigation bar.

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@nidhi-singh02
Copy link
Contributor

Thanks @masterjedy for these diagrams. they look great!

Signed-off-by: master_jedy <yura.zarudny@gmail.com>
Signed-off-by: master_jedy <yura.zarudny@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants