Skip to content

Commit b55632b

Browse files
committed
update readme
1 parent 5865589 commit b55632b

File tree

1 file changed

+64
-7
lines changed

1 file changed

+64
-7
lines changed

price_feeds/ton/send_usd/README.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,70 @@
11
# send_usd
22

3+
This repository contains examples of applications integrating Pyth products and services. Sample contract demonstrating Pyth price feed integration on TON.
4+
5+
## Overview
6+
7+
This contract enables USD-denominated payments on TON by integrating with Pyth price oracles. It supports two operations:
8+
9+
1. `send_usd` - Send a USD-denominated payment that gets converted to TON at current price
10+
11+
Message format:
12+
13+
```typescript
14+
{
15+
queryId: number, // 64-bit unique identifier for the request
16+
recipient: Address, // TON address of payment recipient
17+
usdAmount: number, // Amount in USD dollars
18+
updateData: Buffer, // Pyth price update data (converted to cell chain)
19+
value: bigint // Amount of TON to attach to message
20+
}
21+
```
22+
23+
The `updateData` field contains Pyth price feed data and must be obtained from [Hermes](https://hermes.pyth.network/docs/). This data is converted to a TON cell chain format using the `createCellChain()` helper from the [pyth-ton-js](https://www.npmjs.com/package/@pythnetwork/pyth-ton-js) library. The Pyth contract can be found [here](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ton/contracts).
24+
25+
2. Pyth price update callback
26+
27+
- Receives price updates from Pyth oracle contract
28+
- Automatically processes pending USD payments using latest price
29+
30+
## Setup
31+
32+
1. Copy environment config:
33+
34+
```bash
35+
cp .env.example .env
36+
```
37+
38+
2. Configure `.env`:
39+
40+
```
41+
WALLET_MNEMONIC="your mnemonic here"
42+
```
43+
44+
## Usage
45+
46+
1. Deploy contract:
47+
48+
```bash
49+
npx blueprint run deploySendUsd --custom https://testnet.toncenter.com/api/v2/jsonRPC --custom-version v2 --custom-type testnet --custom-key <YOUR-API-KEY> --mnemonic
50+
```
51+
52+
This will deploy the contract and update `.env` with the deployed address.
53+
54+
2. Send USD payment:
55+
56+
```bash
57+
npx blueprint run sendUsdPayment <YOUR-TON-WALLET-ADDRESS> 1 --custom https://testnet.toncenter.com/api/v2/jsonRPC --custom-version v2 --custom-type testnet --custom-key <YOUR-API-KEY> --mnemonic
58+
```
59+
360
## Project structure
461

5-
- `contracts` - source code of all the smart contracts of the project and their dependencies.
6-
- `wrappers` - wrapper classes (implementing `Contract` from ton-core) for the contracts, including any [de]serialization primitives and compilation functions.
7-
- `tests` - tests for the contracts.
8-
- `scripts` - scripts used by the project, mainly the deployment scripts.
62+
- `contracts` - Smart contract source code and dependencies
63+
- `wrappers` - Contract wrapper classes implementing serialization and compilation
64+
- `tests` - Contract test suite
65+
- `scripts` - Deployment and interaction scripts
966

10-
## How to use
67+
## Development
1168

1269
### Build
1370

@@ -17,10 +74,10 @@
1774

1875
`npx blueprint test` or `yarn blueprint test`
1976

20-
### Deploy or run another script
77+
### Deploy or run scripts
2178

2279
`npx blueprint run` or `yarn blueprint run`
2380

24-
### Add a new contract
81+
### Create new contract
2582

2683
`npx blueprint create ContractName` or `yarn blueprint create ContractName`

0 commit comments

Comments
 (0)