Skip to main content

Core package for Pontis oracle on Starknet

Project description

Pontis Oracle

This is the repository for the Pontis Oracle on Starknet.

About

You can read more about the Pontis Oracle here.

The Oracle contract is deployed at 0x037f6eb00ae24c94e401ac729ca297727a19b8c85d5c7fc201452e892689b9b1. (TODO: update with proxy contract address)

Setup

After you have cloned the repository, run the following commands to set up the repo:

  1. pip install -r requirements.txt
  2. pip install -e .

Usage

Interacting with Deployed Contracts

Make sure you set the following environment variables to be able to interact with the deployed contract:

STARKNET_NETWORK=alpha-goerli

Then you can use the Starknet CLI to invoke the contract. For instance to get the price of USD/ETH first calculate the key by converting the string to the UTF-8 encoded felt 24016925336360008 (use str_to_felt util in pontis.core.utils). Then run the following commands, replacing <ORACLE_ADDRESS> with the address of the Oracle (see above):

starknet-compile contracts/Oracle.cairo --abi oracle_abi.json --output oracle_compiled.json
starknet call --address <ORACLE_ADDRESS> --abi oracle_abi.json --function get_price --inputs 24016925336360008

Running Tests

To run tests, simply run pytest . from the project root.

Deploying Contracts

To deploy this contract on Goerli testnet (e.g. to test behavior outside of the production contract), first create a private/public key pair that will be required to allow new publishers to register with the contract (use get_random_private_key and private_to_stark_key in starkware.crypto.signature.signature).

Then run the following commands, replacing <PUBLIC_PUBLISHER_REGISTRATION_KEY> with the public key you generated in the previous step.

export STARKNET_NETWORK=alpha-goerli
starknet-compile contracts/Oracle.cairo --abi oracle_abi.json --output oracle_compiled.json
starknet deploy --contract oracle_compiled.json --inputs <PUBLIC_PUBLISHER_REGISTRATION_KEY>

Publishing a New Version

First, make sure to set the environmental variable PYPI_API_TOKEN.

To publish a new version, just run bumpversion <part> (where <part> is major, minor or patch). Then run python3 -m build to generate the distribution archives. Finally upload the new distribution with twine upload dist/* -u __token__ -p $PYPI_API_TOKEN.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pontis-0.0.10.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pontis-0.0.10-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pontis-0.0.10.tar.gz.

File metadata

  • Download URL: pontis-0.0.10.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for pontis-0.0.10.tar.gz
Algorithm Hash digest
SHA256 02ae4f04e2c44c6562f308cfc9e15df9270726c673db5a43b6755bcc4c9c26f7
MD5 754c1747287de7f7afde4f246f6191c4
BLAKE2b-256 22f7501e18d85d37dfbf04a9255ce43b4a6728a0b3a987146c4c3096e33b76ee

See more details on using hashes here.

File details

Details for the file pontis-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: pontis-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for pontis-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a676aee8c8dbfa5477765d05e18269e6297057c7025ff0bf0ab1ac45ef65153b
MD5 946ae120199b54ec3f237d1dc096ec2c
BLAKE2b-256 22973acf200674bc1a22a759ac9a9c91f8bb8874b90433fa9d42bb1bd17778ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page