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

Amin Moghaddam eef8468a22 Entropy support in contract manager (#1242) пре 1 година
.github 7cf7420203 [entropy] add entropy ABIs to solidity sdk (#1219) пре 1 година
contract_manager eef8468a22 Entropy support in contract manager (#1242) пре 1 година
fortuna ab10b9f5fa [fortuna] script to setup a provider for all chains (#1229) пре 1 година
governance 7db31aa7b5 [governance] add chain ids (#1241) пре 1 година
hermes 69e4fee501 add /v2/updates/price/latest endpoint (#1225) пре 1 година
price_pusher 1be8a02b94 Expose gas-price option for injective price pusher (#1185) пре 1 година
price_service a270b64844 chore(price_service): update spy version and bootstrappers пре 1 година
pythnet 6c45ed81ad Fix pythnet-sdk ci (#1213) пре 1 година
target_chains eef8468a22 Entropy support in contract manager (#1242) пре 1 година
wormhole_attester 49d1a579c3 chore: cleanup repo пре 2 година
.dockerignore 2008da7a45 fix(hermes): unignore cache.rs from docker пре 2 година
.gitignore f34c9df224 [sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) пре 2 година
.pre-commit-config.yaml 6c45ed81ad Fix pythnet-sdk ci (#1213) пре 1 година
Dockerfile.lerna 49d1a579c3 chore: cleanup repo пре 2 година
LICENSE fedb92e446 Remove unused components/projects (#481) пре 2 година
README.md 65e21997e4 chore: remove price service mentions in the repo пре 2 година
SECURITY.md 2f0ff1235a Update SECURITY.md (#800) пре 2 година
lerna.json 4c5d0d5e1b [refactor] Add global lerna (#546) пре 2 година
package-lock.json eef8468a22 Entropy support in contract manager (#1242) пре 1 година
package.json f36e868ef6 [entropy] Typescript code for coin flip example + docs (#1128) пре 2 година
rustfmt.toml 7847a79b6a Update rustfmt (#864) пре 2 година
tsconfig.base.json 183081cc20 Expose pythnet message buffer idls (#865) пре 2 година

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:

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.

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.

Development

Pull requests

Use the following format for naming the pull requests:

[component] PR description

For example:

[hermes] Add storage tests

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