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:
pip install -r requirements.txt
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
.
To publish a new version,
- look at using bumpversion
- copy pypi publishing command
- git/github tagging
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pontis-0.0.9.tar.gz
.
File metadata
- Download URL: pontis-0.0.9.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17fba66bc6c1c5f16bd3e78e494cad417ea592f76174410495eda7afd8a50420 |
|
MD5 | bfe6e8ae07bd13dca03be89ec211d199 |
|
BLAKE2b-256 | c18b480d31b6ff1408110e3694152f2aa887b7797b04972a06d2e8384e85fe58 |
File details
Details for the file pontis-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: pontis-0.0.9-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c693fa63fbc3d1bffe49f4eae14c7ccd9a285b2992774b0cd42d2602a33c6863 |
|
MD5 | 0093a923e285bf50cbb94ce09472f976 |
|
BLAKE2b-256 | 5a5d9f3cd9b7fbf05801524b9dfa769bff0c601437a86ef30043cf0f8ee044ec |