Skip to content

joshualyguessennd/StarkNet-Open-Oracle

Repository files navigation

StarkNet-Open-Oracle

Setup

Install Protostar. Clone the repository. Use python 3.7.

python -m venv env
source env/bin/activate
pip install -r requirements.txt

Testing contracts (local contract deployment with protostar cool features takes some time so be patient)

protostar test tests/

Use protostar test --disable-hint-validation tests/ if using hints in the main Contract.

Using the client to publish signed prices

First you need to compile the contract to get its abi. It will be stored in build/OpenOraclePublisher_abi.json

protostar build

Then fill the necessary environment variables in client/.env(fill_and_rename_to.env and rename the file to .env. You will need:

  • your account private key as an integer
  • your account contract address
  • optionally, Coinbase API keys with “view” permission if you want to fetch signed prices from Coinbase.
    Note that Okex doesn't require any API keys to fetch its signed prices.

After that edit the function main() in client/client.py so you can choose your assets (only BTC, ETH and DAI are supported for now), and if you want to fetch prices either from:

  • okex (use c.publish_open_oracle_entries_okex)
  • coinbase (use c.publish_open_oracle_entries_coinbase)
  • both (use c.publish_open_oracle_entries_all_publishers).
async def main():
    c = OpenOracleClient()
    await c.publish_open_oracle_entries_okex(assets=['btc', 'eth'])

Finally, don't forget to activate the virtual env and just run python client/client.py.

All updates will happen in one transaction.

Contract deployment and current address

To deploy the contract, just use protostar like this :

protostar build
protostar deploy build/OpenOraclePublisher.json --network alpha-goerli

The current version of the contract is deployed here : https://goerli.voyager.online/contract/0x0098cfb3473709e706ed494d8b0d96bfc867cef075d584e5a23c1e9c9610dcbb

The contract address is also stored in the variable OPEN_ORACLE_ADDRESS in client/client.py.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages