浏览代码

[price-service] Move to top (#474)

* Move price service to top

* Update the paths and docs

* A little cleanup
Ali Behjati 2 年之前
父节点
当前提交
0e55d0808d

+ 1 - 1
.github/workflows/price-service-image-push.yml

@@ -38,7 +38,7 @@ jobs:
           AWS_REGION: us-east-1
       - run: |
           DOCKER_BUILDKIT=1 docker build -f tilt-devnet/docker-images/Dockerfile.wasm -o type=local,dest=. .
-          DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/price-service/Dockerfile.price_service .
+          DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f price-service/Dockerfile.price_service .
           docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
         env:
           ECR_REGISTRY: public.ecr.aws

+ 17 - 15
README.md

@@ -1,7 +1,7 @@
-# Pyth2Wormhole
+# Pyth Crosschain
 
 This repository acts as a monorepo for the various components that make up
-Pyth2Wormhole. The base repository is a fork from Certus One's reference
+Pyth Crosschain. The base repository is a fork from Certus One's reference
 [Wormhole][] implementation in order to take advantage of the existing tooling
 for building projects based on Wormhole's various SDKs. Much of the existing
 documentation from there will also apply to this repository.
@@ -10,36 +10,38 @@ documentation from there will also apply to this repository.
 
 Within this monorepo you will find the following subprojects:
 
-## Pyth2Wormhole Solana
+## Wormhole Attester
 
-> solana/pyth2wormhole
+> wormhole-attester
 
 The main Pyth implementation currently exists as an [on-chain contract][] on
-Solana. In order to expose these prices cross-chain, the Pyth2Wormhole Solana
+Solana. 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 P2W receiver contracts.
+various receiver contracts.
 
 [on-chain contract]: https://github.com/pyth-network/pyth-client
 
-## Pyth2Wormhole Ethereum
+## Target Chains
 
-> ethereum/contracts/pyth
+### Ethereum
 
-The Ethereum P2W contract acts as a receiver for Pyth prices relayed from the
-P2W Solana contract. It also provides a public API for other Ethereum contracts
+> target-chains/ethereum/contracts/pyth
+
+The Ethereum contract acts as a receiver for Pyth prices relayed from the
+Wormhole Attester. It also provides a public API for other Ethereum contracts
 that can be used to consume Pyth prices. For a guide on using this API to
-consume Pyth price feeds see [pyth-evm-sdk][] which contains documented
+consume Pyth price feeds see [pyth-sdk-solidity][] which contains documented
 examples.
 
-[pyth-evm-sdk]: https://github.com/pyth-network/pyth-sdk-solidity
+[pyth-sdk-solidity]: https://github.com/pyth-network/pyth-sdk-solidity
 
-## Pyth2Wormhole Price Service
+## Price Service
 
-> third_party/pyth
+> price-service
 
-The P2W Price Service is an off-chain service which constantly observes the
+The Price Service is an off-chain service which constantly observes the
 Wormhole network watching for price attestations emitted from the Pyth Solana
 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

+ 1 - 2
Tiltfile

@@ -241,7 +241,7 @@ k8s_resource(
 docker_build(
     ref = "pyth-price-service",
     context = ".",
-    dockerfile = "third_party/pyth/price-service/Dockerfile.price_service",
+    dockerfile = "price-service/Dockerfile.price_service",
 )
 k8s_yaml_with_ns("tilt-devnet/k8s/pyth-price-service.yaml")
 k8s_resource(
@@ -249,7 +249,6 @@ k8s_resource(
     resource_deps = ["pyth", "p2w-attest", "spy", "eth-devnet", "wasm-gen"],
     port_forwards = [
         port_forward(4202, container_port = 4200, name = "Rest API (Status + Query) [:4202]", host = webHost),
-        port_forward(6202, container_port = 6200, name = "WSS API [:6202]", host = webHost),
         port_forward(8083, container_port = 8081, name = "Prometheus [:8083]", host = webHost)],
     labels = ["pyth"]
 )

+ 0 - 0
third_party/pyth/price-service/.dockerignore → price-service/.dockerignore


+ 0 - 0
third_party/pyth/price-service/.env.sample → price-service/.env.sample


+ 0 - 0
third_party/pyth/price-service/.gitignore → price-service/.gitignore


+ 1 - 1
third_party/pyth/price-service/Dockerfile.price_service → price-service/Dockerfile.price_service

@@ -10,7 +10,7 @@ WORKDIR ${BASE_PATH}/${P2W_SDK_REL_PATH}
 COPY --chown=pyth:pyth ${P2W_SDK_REL_PATH} .
 RUN npm ci && npm run build && npm cache clean --force
 
-ARG PRICE_SERVICE_REL_PATH=third_party/pyth/price-service
+ARG PRICE_SERVICE_REL_PATH=price-service
 WORKDIR ${BASE_PATH}/${PRICE_SERVICE_REL_PATH}
 COPY --chown=pyth:pyth ${PRICE_SERVICE_REL_PATH} .
 RUN npm ci && npm run build && npm cache clean --force

+ 1 - 1
third_party/pyth/price-service/README.md → price-service/README.md

@@ -57,7 +57,7 @@ Then, build the image from [the repo root](../../../) like below. It will create
 local image named `pyth_price_service`.
 
 ```
-$ docker buildx build -f third_party/pyth/price-service/Dockerfile.price_service -t pyth_price_service .
+$ docker buildx build -f price-service/Dockerfile.price_service -t pyth_price_service .
 ```
 
 If you wish to build price service without docker, please follow the instruction of the price service

+ 0 - 0
third_party/pyth/price-service/docker-compose.mainnet.yaml → price-service/docker-compose.mainnet.yaml


+ 0 - 0
third_party/pyth/price-service/docker-compose.testnet.yaml → price-service/docker-compose.testnet.yaml


+ 0 - 0
third_party/pyth/price-service/jest.config.js → price-service/jest.config.js


+ 28 - 3
third_party/pyth/price-service/package-lock.json → price-service/package-lock.json

@@ -11,7 +11,7 @@
       "dependencies": {
         "@certusone/wormhole-sdk": "^0.1.4",
         "@certusone/wormhole-spydk": "^0.0.1",
-        "@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js",
+        "@pythnetwork/p2w-sdk-js": "file:../third_party/pyth/p2w-sdk/js",
         "@pythnetwork/pyth-sdk-js": "^1.1.0",
         "@types/cors": "^2.8.12",
         "@types/express": "^4.17.13",
@@ -54,6 +54,31 @@
     },
     "../p2w-sdk/js": {
       "name": "@pythnetwork/p2w-sdk-js",
+      "version": "1.0.0",
+      "extraneous": true,
+      "license": "MIT",
+      "dependencies": {
+        "@certusone/wormhole-sdk": "0.2.1",
+        "@improbable-eng/grpc-web-node-http-transport": "^0.14.1",
+        "@pythnetwork/pyth-sdk-js": "^1.1.0"
+      },
+      "devDependencies": {
+        "@openzeppelin/contracts": "^4.2.0",
+        "@typechain/ethers-v5": "^7.1.2",
+        "@types/long": "^4.0.1",
+        "@types/node": "^16.6.1",
+        "copy-dir": "^1.3.0",
+        "find": "^0.3.0",
+        "prettier": "^2.3.2",
+        "tslint": "^6.1.3",
+        "tslint-config-prettier": "^1.18.0",
+        "typescript": "^4.3.5"
+      },
+      "peerDependencies": {
+        "@solana/web3.js": "^1.24.0"
+      }
+    },
+    "../third_party/pyth/p2w-sdk/js": {
       "version": "1.0.0",
       "license": "MIT",
       "dependencies": {
@@ -2208,7 +2233,7 @@
       "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
     },
     "node_modules/@pythnetwork/p2w-sdk-js": {
-      "resolved": "../p2w-sdk/js",
+      "resolved": "../third_party/pyth/p2w-sdk/js",
       "link": true
     },
     "node_modules/@pythnetwork/pyth-sdk-js": {
@@ -10604,7 +10629,7 @@
       "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
     },
     "@pythnetwork/p2w-sdk-js": {
-      "version": "file:../p2w-sdk/js",
+      "version": "file:../third_party/pyth/p2w-sdk/js",
       "requires": {
         "@certusone/wormhole-sdk": "0.2.1",
         "@improbable-eng/grpc-web-node-http-transport": "^0.14.1",

+ 1 - 1
third_party/pyth/price-service/package.json → price-service/package.json

@@ -31,7 +31,7 @@
   "dependencies": {
     "@certusone/wormhole-sdk": "^0.1.4",
     "@certusone/wormhole-spydk": "^0.0.1",
-    "@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js",
+    "@pythnetwork/p2w-sdk-js": "file:../third_party/pyth/p2w-sdk/js",
     "@pythnetwork/pyth-sdk-js": "^1.1.0",
     "@types/cors": "^2.8.12",
     "@types/express": "^4.17.13",

+ 0 - 0
third_party/pyth/price-service/src/__tests__/rest.test.ts → price-service/src/__tests__/rest.test.ts


+ 0 - 0
third_party/pyth/price-service/src/__tests__/ws.test.ts → price-service/src/__tests__/ws.test.ts


+ 0 - 0
third_party/pyth/price-service/src/helpers.ts → price-service/src/helpers.ts


+ 0 - 0
third_party/pyth/price-service/src/index.ts → price-service/src/index.ts


+ 0 - 0
third_party/pyth/price-service/src/listen.ts → price-service/src/listen.ts


+ 0 - 0
third_party/pyth/price-service/src/logging.ts → price-service/src/logging.ts


+ 0 - 0
third_party/pyth/price-service/src/promClient.ts → price-service/src/promClient.ts


+ 0 - 0
third_party/pyth/price-service/src/rest.ts → price-service/src/rest.ts


+ 0 - 0
third_party/pyth/price-service/src/ws.ts → price-service/src/ws.ts


+ 0 - 0
third_party/pyth/price-service/tsconfig.json → price-service/tsconfig.json


+ 0 - 0
third_party/pyth/price-service/tslint.json → price-service/tslint.json