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

Aditya Arora 661feaf6c8 chore(pricefeeds/evm): Deploy new chains (#1955) há 1 ano atrás
.github bd90dd4a04 chore(target_chains/solana): add description and license (#1885) há 1 ano atrás
apps 0fc2579c7e fix: staking app hermes url now that devnet uses stable too (#1944) há 1 ano atrás
contract_manager 661feaf6c8 chore(pricefeeds/evm): Deploy new chains (#1955) há 1 ano atrás
express_relay a01cb0e573 feat: limo simple searcher (#1943) há 1 ano atrás
governance 661feaf6c8 chore(pricefeeds/evm): Deploy new chains (#1955) há 1 ano atrás
licenses ee455f1196 [solidity sdk] Add zerolend AggregatorV3 adapter to SDK (#1437) há 1 ano atrás
patches 29d6b9f586 Migrate to pnpm há 1 ano atrás
price_service 29aa0b9c32 chore(docker): fix & rewrite Node Dockerfiles há 1 ano atrás
pythnet 02d0adc460 feat: publisher-caps-program (#1812) há 1 ano atrás
target_chains 661feaf6c8 chore(pricefeeds/evm): Deploy new chains (#1955) há 1 ano atrás
wormhole_attester b8aeac327d chore(wormhole_attester): update cargo packages to fix ci (#1275) há 1 ano atrás
.dockerignore 9765acafb0 fix(hermes): update dockerfile path on the CI (#1689) há 1 ano atrás
.envrc 5e2edf27a0 Upgrade pnpm há 1 ano atrás
.gitignore 7ce7f6121f feat(api-reference): initialize api reference app há 1 ano atrás
.npmrc 63e528b7d2 chore(target_chains/fuel): update sdk to use the latest abi (#1795) há 1 ano atrás
.nvmrc 5e2edf27a0 Upgrade pnpm há 1 ano atrás
.pre-commit-config.yaml 02d0adc460 feat: publisher-caps-program (#1812) há 1 ano atrás
.prettierignore e3d8bfeff1 feat: add new pyth staking sdk (#1860) há 1 ano atrás
.tool-versions fff5688589 Add .tool-versions há 1 ano atrás
Dockerfile.node 5e2edf27a0 Upgrade pnpm há 1 ano atrás
LICENSE c0dcae183d fix(license) Update license to PDA (#1763) há 1 ano atrás
README.md d883e49e0a (fix) remove examples from monorepo (#1876) há 1 ano atrás
SECURITY.md 52f18563a3 chore: add starknet audit (#1771) há 1 ano atrás
flake.lock 5e2edf27a0 Upgrade pnpm há 1 ano atrás
flake.nix 018e3f9cac Implement API reference feedback há 1 ano atrás
funding.json f5f5b8b3bc chore: add funding.json for op grant (#1608) há 1 ano atrás
lerna.json 29d6b9f586 Migrate to pnpm há 1 ano atrás
package.json 6574611d86 chore(xc_admin): fix xc_admin dependencies há 1 ano atrás
pnpm-lock.yaml fd354aefb2 feature(target_chains/ton): add upgrade standard (#1939) há 1 ano atrás
pnpm-workspace.yaml e3d8bfeff1 feat: add new pyth staking sdk (#1860) há 1 ano atrás
rustfmt.toml 7847a79b6a Update rustfmt (#864) há 2 anos atrás
tsconfig.base.json 183081cc20 Expose pythnet message buffer idls (#865) há 2 anos atrás

README.md

Pyth Crosschain

This repository acts as a monorepo for the various components that make up Pyth protocols.

Within this monorepo you will find the following subprojects:

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 and SDKs.

Hermes

hermes

Hermes is 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 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 and examples for your blockchain runtime in the target_chains directory.

Fortuna

fortuna

Fortuna is an off-chain service which can be used by Entropy providers.

Development

Pull requests

Use the Conventional Commits format for your commit messages and PR titles. In the PR description, please include a summary of the changes and any relevant context. Also, please make sure to update the package versions following the Semantic Versioning rules.

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 tag pyth-js-v<number> and push to github. You can simply increment the version number each time -- it doesn't affect any of the published information.
  4. Pushing the tag automatically triggers 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 pnpm i from the repository root. You can build all of the packages using pnpm exec lerna run build and test with pnpm exec lerna run test.

Lerna has some common failure modes that you may encounter:

  1. pnpm i 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.
  3. pnpm i fails due to wrong node version. Make sure to be using v18. Node version v21 is not supported and known to cause issues.

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.