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

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 and finally upload the new distribution with python3 -m twine upload --repository pontis dist/*.

To publish a new version,

  • look at using bumpversion
  • copy pypi publishing command
  • git/github tagging

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.8.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

pontis-0.0.8-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pontis-0.0.8.tar.gz
  • Upload date:
  • Size: 3.0 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.8.tar.gz
Algorithm Hash digest
SHA256 25151c55a7934a89297310c33015e9855741f4c1ec0ffb23bd53561af552efa0
MD5 0acface219ebc6b66ab103b071046062
BLAKE2b-256 e612467c228f6b00d7e1411a54f6e4bc2e45eba8fba097b7c8ec99afe6970c7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pontis-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 3.1 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe2fb6af5acadc8625de164f163a3000c86ae8c5471bcd5741a5c74c6aaea3e
MD5 51d114468f77afe79b5192771d61a55d
BLAKE2b-256 27bb7c62d05f1feea5e80c3c0ecb86abcf8ccf4cf49a1fe6693c94a126bb9257

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