Mirroring https://github.com/pyth-network/pyth-crosschain

Ali Behjati 6b81f89a42 Update comments 2 anos atrás
.github fbd0354b43 Update hermes-image-push.yml (#877) 2 anos atrás
governance 3ffcf12a70 Encapsulate parameters to proposeX methods (#870) 2 anos atrás
hermes 29dad7acc7 [hermes] Add get_price_feed endpoint (#883) 2 anos atrás
price_pusher 3721dd2c57 [price_pusher] Injective: cache sequence number (#874) 2 anos atrás
price_service 75abeb1553 [price-service] Add minSymbols check to liveness (#882) 2 anos atrás
pythnet 211bf02450 Implement accumulator updates for cosmwasm (#880) 2 anos atrás
scripts 0df243ba9e [eth] Add benchmark tests (#368) 3 anos atrás
target_chains 6b81f89a42 Update comments 2 anos atrás
third_party 183081cc20 Expose pythnet message buffer idls (#865) 2 anos atrás
tilt_devnet e283b15d20 [price-service] Improve vaa validation (#814) 2 anos atrás
tilt_modules d6e25d9209 Add pre-commit globally (#393) 3 anos atrás
wormhole_attester 64bce66383 Choose unique VAA for query time if it exists (#853) 2 anos atrás
.dockerignore 989ac4653a Update .dockerignore (#722) 2 anos atrás
.gitignore 85b9c80e2a [eth] Add Canto mainnet (#751) 2 anos atrás
.pre-commit-config.yaml 404bc6cb81 [ci] Fix pre-commit (#857) 2 anos atrás
LICENSE fedb92e446 Remove unused components/projects (#481) 2 anos atrás
README.md 94f38fdd74 Fix JS workflow (#727) 2 anos atrás
SECURITY.md 2f0ff1235a Update SECURITY.md (#800) 2 anos atrás
Tiltfile bbc140f2e4 [wormhole-attester] Increase accuracy and improve logging (#653) 2 anos atrás
lerna.json 4c5d0d5e1b [refactor] Add global lerna (#546) 2 anos atrás
package-lock.json 75abeb1553 [price-service] Add minSymbols check to liveness (#882) 2 anos atrás
package.json 183081cc20 Expose pythnet message buffer idls (#865) 2 anos atrás
rustfmt.toml 7847a79b6a Update rustfmt (#864) 2 anos atrás
tsconfig.base.json 183081cc20 Expose pythnet message buffer idls (#865) 2 anos atrás

README.md

Pyth Crosschain

This repository acts as a monorepo for the various components that make up 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.

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

price_service

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.

The client subdirectory provides an SDK for interacting with the price service. 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 and examples for your blockchain runtime in the target_chains directory.

Development

Releases

The repository has a CI workflow that will release javascript packages whose version number has changed. To perform a release, follow these steps:

  1. Update the version number in the package.json file for the package(s) you wish to release. Please follow Semantic Versioning for package versions.
  2. Submit a PR with the changes and merge them in to main.
  3. Create a new release in github with a tag of the form pyth-js-v<number>. You can simply increment the version number each time -- it doesn't affect any of the published information.
  4. When this release is published, it will automatically trigger a CI workflow to publish the updated packages to NPM.

If you have a javascript package that shouldn't be published, simply add "private": "true" to the package.json file and it will be excluded from the publishing workflow. If you are creating a new public javascript package, you should add the following config option to package.json:

  "publishConfig": {
    "access": "public"
  },

pre-commit hooks

pre-commit is a tool that checks and fixes simple issues (formatting, ...) before each commit. You can install it by following their website. In order to enable checks for this repo run pre-commit install from command-line in the root of this repo.

The checks are also performed in the CI to ensure the code follows consistent formatting.

Tilt CI

Integration tests run in Tilt (via the tilt ci command). The Tilt CI workflow requires approval from a member of the Pyth team. If you are a member, click on "Details" next to the "Workflow / ci-pyth-crosschain" check in a pull request, and then on the "Resume" button on the workflow page.

Typescript Monorepo

All of the typescript / javascript packages in this repository are part of a lerna monorepo. This setup allows each package to reference the current version of the others. You can install dependencies using npm ci from the repository root. You can build all of the packages using npx lerna run build and test with npx lerna run test.

Lerna has some common failure modes that you may encounter:

  1. npm ci fails with a typescript compilation error about a missing package. This error likely means that the failing package has a prepare entry compiling the typescript in its package.json. Fix this error by moving that logic to the prepublishOnly entry.
  2. The software builds locally but fails in CI, or vice-versa. This error likely means that some local build caches need to be cleaned. The build error may not indicate that this is a caching issue, e.g., it may appear that the packages are being built in the wrong order. Delete node_modules/, lib/ and tsconfig.tsbuildinfo from each package's subdirectory. then try again.

Audit / Feature Status

This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Or plainly spoken - this is a very complex piece of software which targets a bleeding-edge, experimental smart contract runtime. Mistakes happen, and no matter how hard you try and whether you pay someone to audit it, it may eat your tokens, set your printer on fire or startle your cat. Cryptocurrencies are a high-risk investment, no matter how fancy.