Skip to content
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

feat: update ton addr #497

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions pages/price-feeds/contract-addresses/ton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import CopyAddress from "../../../components/CopyAddress";

# Price Feed Contract Addresses on TON

Pyth is currently deployed on TON Testnet.
Pyth is currently deployed on TON Mainnet and TON Testnet.

| Network | Contract address |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TON Testnet | <CopyAddress address={`EQDwGkJmcj7MMmWAHmhldnY-lAKI6hcTQ2tAEcapmwCnztQU`} url="https://testnet.tonscan.org/address/EQDwGkJmcj7MMmWAHmhldnY-lAKI6hcTQ2tAEcapmwCnztQU" /> |
| TON Mainnet | <CopyAddress address={`EQD2QZABE_SbKwCN0kyr5XU_qP_uNkL0fwDodHEgHFLaahgC`} url="https://tonscan.org/address/EQD2QZABE_SbKwCN0kyr5XU_qP_uNkL0fwDodHEgHFLaahgC" /> |
| TON Testnet | <CopyAddress address={`EQDi9IHGin5GmrJyU5d_dQqjuYC22tshx1dxz9j5_ZGUz74j`} url="https://testnet.tonscan.org/address/EQDi9IHGin5GmrJyU5d_dQqjuYC22tshx1dxz9j5_ZGUz74j" /> |
5 changes: 4 additions & 1 deletion pages/price-feeds/use-real-time-data/ton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { HermesClient } from "@pythnetwork/hermes-client";
import {
PythContract,
PYTH_CONTRACT_ADDRESS_TESTNET,
calculateUpdatePriceFeedsFee,
} from "@pythnetwork/pyth-ton-js";
const BTC_PRICE_FEED_ID =
"0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43";
Expand Down Expand Up @@ -72,6 +73,8 @@ async function main() {
// Get update fee
const updateFee = await contract.getUpdateFee(updateData);
console.log("Update fee:", updateFee);
const totalFee =
calculateUpdatePriceFeedsFee(BigInt(updateFee)) + BigInt(updateFee);
// Update price feeds
const mnemonic = "your mnemonic here";
const key = await mnemonicToPrivateKey(mnemonic.split(" "));
Expand All @@ -83,7 +86,7 @@ async function main() {
await contract.sendUpdatePriceFeeds(
provider.sender(key.secretKey),
updateData,
156000000n + BigInt(updateFee) // 156000000 = 390000 (estimated gas used for the transaction, this is defined in (contracts/common/gas.fc)[https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ton/contracts/common/gas.fc] as UPDATE_PRICE_FEEDS_GAS) * 400 (current settings in basechain are as follows: 1 unit of gas costs 400 nanotons)
totalFee
);
console.log("Price feeds updated successfully.");
}
Expand Down
Loading