Skip to content

Commit

Permalink
chore: remove price service mentions in the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bahjati committed Oct 18, 2023
1 parent 49d1a57 commit 27355a5
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 116 deletions.
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,25 @@ Pyth Crosschain.

Within this monorepo you will find the following subprojects:

## Wormhole Attester

> wormhole_attester
The main Pyth implementation currently exists as an [on-chain contract][] on
Pythnet, a separate instance of the Solana blockchain. In order to expose
these prices cross-chain, the Wormhole Attester contract acts as a sender for Pyth prices. At regular intervals the Pyth
contract will observe the current Pyth price for selected products, and produce
an attestation which is then relayed over Wormhole to be consumed by the
various receiver contracts.

[on-chain contract]: https://github.com/pyth-network/pyth-client

## Target Chains

> target_chains
> [target_chains](./target_chains/)
This directory contains on-chain contracts and SDKs for all of the various
blockchain runtimes that Pyth supports. Each subdirectory corresponds to a
blockchain runtime. Inside each subdirectory, there are subfolders for
contracts, SDKs, and examples.

## Price Service
## Hermes

> price_service
> [hermes](./hermes/)
The Price Service is an off-chain service which constantly observes the
Wormhole network watching for price attestations emitted from the Pyth
contract. It exposes all observed attestations via a public API over HTTPS/WSS
which can be consumed by client-side applications that wish to use Pyth pricing
data.
Hermesis an off-chain service which constantly observes Pythnet and the
Wormhole network watching for price updates emitted from the Pyth contract. It
exposes all observed attestations via a public API over HTTPS/WSS which can be
consumed by client-side applications that wish to use Pyth pricing data.

The `client` subdirectory provides an SDK for interacting with the price service.
The [`price_service/client`](./price_service/client/) directory provides an SDK for interacting with Hermes.
However, most users will interact with the price service via a chain-specific SDK

For a guide on utilising this service in your project, see the chain-specific SDK
Expand Down
6 changes: 3 additions & 3 deletions contract_manager/scripts/update_pricefeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const parser = yargs(hideBin(process.argv))
},
endpoint: {
type: "string",
desc: "Price service endpoint to use, defaults to https://xc-mainnet.pyth.network for mainnet and https://xc-testnet.pyth.network for testnet",
desc: "Hermes endpoint to use, defaults to https://hermes.pyth.network for mainnet and https://hermes-beta.pyth.network for testnet",
},
});

Expand All @@ -40,8 +40,8 @@ async function main() {
);
}
const defaultEndpoint = contract.getChain().isMainnet()
? "https://xc-mainnet.pyth.network"
: "https://xc-testnet.pyth.network";
? "https://hermes.pyth.network"
: "https://hermes-beta.pyth.network";
const priceService = new PriceServiceConnection(
argv.endpoint || defaultEndpoint
);
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions price_pusher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ npm run start -- injective --grpc-endpoint https://grpc-endpoint.com \

# For Aptos
npm run start -- aptos --endpoint https://fullnode.testnet.aptoslabs.com/v1 \
--pyth-contract-address 0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387 --price-service-endpoint "https://xc-testnet.pyth.network" \
--pyth-contract-address 0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387 --price-service-endpoint "https://hermes-beta.pyth.network" \
--price-config-file "./price-config.testnet.sample.yaml" \
--mnemonic-file "path/to/mnemonic.txt" \
[--pushing-frequency 10] \
Expand All @@ -99,7 +99,7 @@ npm run start -- sui \
--wormhole-package-id 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e \
--wormhole-state-id 0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02 \
--price-feed-to-price-info-object-table-id 0xf8929174008c662266a1adde78e1e8e33016eb7ad37d379481e860b911e40ed5 \
--price-service-endpoint https://xc-testnet.pyth.network \
--price-service-endpoint https://hermes-beta.pyth.network \
--mnemonic-file ./mnemonic \
--price-config-file ./price-config.testnet.sample.yaml \
[--pushing-frequency 10] \
Expand Down Expand Up @@ -128,7 +128,7 @@ For example, to push `BTC/USD` and `BNB/USD` prices on Fantom testnet, run the f

```sh
npm run dev -- evm --endpoint https://endpoints.omniatech.io/v1/fantom/testnet/public \
--pyth-contract-address 0xff1a0f4744e8582DF1aE09D5611b887B6a12925C --price-service-endpoint https://xc-testnet.pyth.network \
--pyth-contract-address 0xff1a0f4744e8582DF1aE09D5611b887B6a12925C --price-service-endpoint https://hermes-beta.pyth.network \
--mnemonic-file "./mnemonic" --price-config-file "./price-config.testnet.sample.yaml"
```

Expand Down
2 changes: 1 addition & 1 deletion price_pusher/config.aptos.testnet.sample.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"endpoint": "https://fullnode.testnet.aptoslabs.com/v1",
"pyth-contract-address": "0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387",
"price-service-endpoint": "https://xc-testnet.pyth.network",
"price-service-endpoint": "https://hermes-beta.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.testnet.sample.yaml"
}
2 changes: 1 addition & 1 deletion price_pusher/config.evm.testnet.sample.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"endpoint": "https://endpoints.omniatech.io/v1/fantom/testnet/public",
"pyth-contract-address": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
"price-service-endpoint": "https://xc-testnet.pyth.network",
"price-service-endpoint": "https://hermes-beta.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.testnet.sample.yaml"
}
2 changes: 1 addition & 1 deletion price_pusher/config.injective.testnet.sample.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"grpc-endpoint": "https://k8s.testnet.chain.grpc-web.injective.network",
"pyth-contract-address": "inj1z60tg0tekdzcasenhuuwq3htjcd5slmgf7gpez",
"price-service-endpoint": "https://xc-testnet.pyth.network",
"price-service-endpoint": "https://hermes-beta.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.testnet.sample.yaml",
"network": "testnet"
Expand Down
2 changes: 1 addition & 1 deletion price_pusher/config.sui.mainnet.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"wormhole-package-id": "0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a",
"wormhole-state-id": "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",
"price-feed-to-price-info-object-table-id": "0x14b4697477d24c30c8eecc31dd1bd49a3115a9fe0db6bd4fd570cf14640b79a0",
"price-service-endpoint": "https://xc-mainnet.pyth.network",
"price-service-endpoint": "https://hermes.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.mainnet.sample.yaml"
}
2 changes: 1 addition & 1 deletion price_pusher/config.sui.testnet.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"wormhole-package-id": "0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e",
"wormhole-state-id": "0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02",
"price-feed-to-price-info-object-table-id": "0xf8929174008c662266a1adde78e1e8e33016eb7ad37d379481e860b911e40ed5",
"price-service-endpoint": "https://xc-testnet.pyth.network",
"price-service-endpoint": "https://hermes-beta.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.testnet.sample.yaml"
}
21 changes: 8 additions & 13 deletions price_service/client/js/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Price Service Client

[Pyth Network](https://pyth.network/) provides real-time pricing data in a variety of asset classes, including cryptocurrency, equities, FX and commodities.
These prices are available either via HTTP or WebSocket from Pyth's [price service](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/server).
This library is a client for interacting with the price service, allowing your application to consume Pyth real-time prices in on- and off-chain Javascript/Typescript applications.
These prices are available either via HTTP or WebSocket from [Hermes](https://github.com/pyth-network/pyth-crosschain/tree/main/hermes).
This library is a client for interacting with Hermes, allowing your application to consume Pyth real-time prices in on- and off-chain Javascript/Typescript applications.

## Installation

Expand All @@ -24,15 +24,15 @@ Typical usage of the connection is along the following lines:

```typescript
const connection = new PriceServiceConnection(
"https://xc-testnet.pyth.network",
"https://hermes-beta.pyth.network",
{
priceFeedRequestConfig: {
// Provide this option to retrieve signed price updates for on-chain contracts.
// Ignore this option for off-chain use.
binary: true,
},
}
); // See Price Service endpoints section below for other endpoints
); // See Hermes endpoints section below for other endpoints

const priceIds = [
// You can find the ids of prices at https://pyth.network/developers/price-feed-ids#pyth-evm-testnet
Expand Down Expand Up @@ -67,7 +67,7 @@ setTimeout(() => {

### On-chain Applications

On-chain applications will need to submit the price updates returned by the price service to the Pyth contract on their blockchain.
On-chain applications will need to submit the price updates returned by Hermes to the Pyth contract on their blockchain.
These applications should pass the `binary: true` option to the constructor as shown above, to ensure that all methods on `PriceServiceConnection` return the required information.
This option will add a `vaa` field to `PriceFeed` that represents a signed price update.
The `vaa` is a binary blob serialized as a base64 string.
Expand All @@ -80,14 +80,9 @@ You can run it with `npm run example`.
A full command that prints BTC and ETH price feeds, in the testnet network, looks like so:

```bash
npm run example -- --endpoint https://xc-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
npm run example -- --endpoint https://hermes-beta.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
```

## Price Service endpoints
## Hermes endpoints

Public endpoints for the Price Service are provided for both mainnet and testnet. These can be used regardless of which network you deploy your own contracts to as long as it is a Pyth supported network. For example, you can use the testnet Price Service whether you are deploying your contract to the BNB or Polygon testnet.

| network | url |
| ------- | ------------------------------- |
| mainnet | https://xc-mainnet.pyth.network |
| testnet | https://xc-testnet.pyth.network |
You can find the list of Hermes public endpoints [here](https://docs.pyth.network/documentation/pythnet-price-feeds/hermes#public-endpoints).
2 changes: 1 addition & 1 deletion price_service/client/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-service-client",
"version": "1.8.1",
"version": "1.8.2",
"description": "Pyth price service client",
"author": {
"name": "Pyth Data Association"
Expand Down
16 changes: 2 additions & 14 deletions price_service/server/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
# Pyth Price Service

** Pyth price service is deprecated. Please use [Hermes](../../hermes/) instead. **

The Pyth price service is a webservice that listens to the Wormhole Network for Pyth price updates and serves them via a
convenient web API. The service allows users to easily query for recent price updates via a REST API, or subscribe to
a websocket for streaming updates. [Price service JS client](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/sdk/js) connects
to an instance of the price service in order to fetch on-demand price updates.

## Public Endpoints

The Pyth Data Association operates two public endpoints for the price service, for mainnet and testnet respectively.
These endpoints can be used to test integrations with Pyth Network:

| network | url |
| ------- | ------------------------------- |
| mainnet | https://xc-mainnet.pyth.network |
| testnet | https://xc-testnet.pyth.network |

For production deployments, developers integrating with Pyth Network are **strongly encouraged** to host their own instance of the price service for maximum resilience and decentralization.
By running an independent instance of this service, developers tap directly into Wormhole's peer-to-peer network to stream Pyth price updates.
This peer-to-peer network has built-in redundancy and is therefore inherently more reliable than a centralized service operated by the PDA.

## Wormhole Spy

The price service depends on a Wormhole Spy to stream Pyth messages from the Wormhole Network to it. The
Expand Down
4 changes: 2 additions & 2 deletions target_chains/aptos/examples/mint_nft/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import logo from "./logo.svg";
// Please read https://docs.pyth.network/documentation/pythnet-price-feeds before building on Pyth

// Rpc endpoint
const TESTNET_PRICE_SERVICE = "https://xc-testnet.pyth.network";
const TESTNET_HERMES_ENDPOINT = "https://hermes-beta.pyth.network";

// Connection
const testnetConnection = new AptosPriceServiceConnection(
TESTNET_PRICE_SERVICE
TESTNET_HERMES_ENDPOINT
); // Price service client used to retrieve the offchain VAAs to update the onchain price

// Price id : this is not an aptos account but instead an opaque identifier for each price https://pyth.network/developers/price-feed-ids/#pyth-cross-chain-testnet
Expand Down
23 changes: 11 additions & 12 deletions target_chains/aptos/sdk/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ $ yarn add @pythnetwork/pyth-aptos-js
Pyth stores prices off-chain to minimize gas fees, which allows us to offer a wider selection of products and faster update times.
See [On-Demand Updates](https://docs.pyth.network/documentation/pythnet-price-feeds/on-demand) for more information about this approach.
To use Pyth prices on chain,
they must be fetched from an off-chain price service. The `AptosPriceServiceConnection` class can be used to interact with these services,
they must be fetched from a Hermes instance. The `AptosPriceServiceConnection` class can be used to interact with these services,
providing a way to fetch these prices directly in your code. The following example wraps an existing RPC provider and shows how to obtain
Pyth prices and submit them to the network:

```typescript
const connection = new AptosPriceServiceConnection(
"https://xc-testnet.pyth.network"
); // See Price Service endpoints section below for other endpoints
"https://hermes-beta.pyth.network"
); // See Hermes endpoints section below for other endpoints

const priceIds = [
// You can find the ids of prices at https://pyth.network/developers/price-feed-ids#aptos-testnet
Expand Down Expand Up @@ -120,21 +120,20 @@ setTimeout(() => {

[This example](./src/examples/AptosRelay.ts) shows how to update prices on an Aptos network. It does the following:

1. Fetches update data from the Price Service for the given price feeds.
1. Fetches update data from Hermes for the given price feeds.
2. Calls the Pyth Aptos contract with the update data.

You can run this example with `npm run example-relay`. A full command that updates BTC and ETH prices on the BNB Chain testnet network looks like this:

```bash
export APTOS_KEY = "0x...";
npm run example-relay -- --endpoint https://xc-testnet.pyth.network --price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6 --full-node https://fullnode.testnet.aptoslabs.com/v1 --pyth-contract 0xaa706d631cde8c634fe1876b0c93e4dec69d0c6ccac30a734e9e257042e81541
npm run example-relay -- \
--endpoint https://hermes-beta.pyth.network \
--full-node https://fullnode.testnet.aptoslabs.com/v1 \
--pyth-contract 0xaa706d631cde8c634fe1876b0c93e4dec69d0c6ccac30a734e9e257042e81541 \
--price-ids 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b 0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6
```

## Price Service endpoints
## Hermes endpoints

We provide public endpoints for the price service, although it is strongly recommended to host your own instance.

| Aptos Network | Price Service URL |
| ------------- | ------------------------------- |
| Testnet | https://xc-testnet.pyth.network |
| Mainnet | https://xc-mainnet.pyth.network |
Please find the list of public Hermes endpoints [here](https://docs.pyth.network/documentation/pythnet-price-feeds/hermes#public-endpoints).
2 changes: 1 addition & 1 deletion target_chains/aptos/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-aptos-js",
"version": "1.4.1",
"version": "1.4.2",
"description": "Pyth Network Aptos Utilities",
"homepage": "https://pyth.network",
"author": {
Expand Down
25 changes: 11 additions & 14 deletions target_chains/ethereum/examples/oracle_swap/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CONFIG = {
},
swapContractAddress: "0x15F9ccA28688F5E6Cbc8B00A8f33e8cE73eD7B02",
pythContractAddress: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
priceServiceUrl: "https://xc-testnet.pyth.network",
hermesUrl: "https://hermes-beta.pyth.network",
mintQty: 100,
};

Expand Down Expand Up @@ -98,18 +98,15 @@ function App() {
useEffect(() => {
// The Pyth price service client is used to retrieve the current Pyth prices and the price update data that
// needs to be posted on-chain with each transaction.
const pythPriceService = new EvmPriceServiceConnection(
CONFIG.priceServiceUrl,
{
logger: {
error: console.error,
warn: console.warn,
info: () => undefined,
debug: () => undefined,
trace: () => undefined,
},
}
);
const pythPriceService = new EvmPriceServiceConnection(CONFIG.hermesUrl, {
logger: {
error: console.error,
warn: console.warn,
info: () => undefined,
debug: () => undefined,
trace: () => undefined,
},
});

pythPriceService.subscribePriceFeedUpdates(
[CONFIG.baseToken.pythPriceFeedId, CONFIG.quoteToken.pythPriceFeedId],
Expand Down Expand Up @@ -289,7 +286,7 @@ function App() {
approxPrice={exchangeRateMeta?.rate}
baseToken={CONFIG.baseToken}
quoteToken={CONFIG.quoteToken}
priceServiceUrl={CONFIG.priceServiceUrl}
hermesUrl={CONFIG.hermesUrl}
pythContractAddress={CONFIG.pythContractAddress}
swapContractAddress={CONFIG.swapContractAddress}
/>
Expand Down
Loading

0 comments on commit 27355a5

Please sign in to comment.