Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Aug 30, 2022
1 parent 6444ba6 commit f72cbff
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# StarkNet-Open-Oracle

## Setup
### What is the open oracle standard ?
Compound Finance [announced](https://medium.com/compound-finance/announcing-compound-open-oracle-development-cff36f06aad3) in august 2019 on the Open Oracle standard.

It allows a *Reporter* (typically a trusted source like an exchange) to sign a message containing price data in a standardized way with a private key.

A *Publisher* can then use this signed message to put the price data on-chain.

Using the *Reporter's* public key to verify the message's signature, there is no need to trust the *Publisher* for correctly reporting the data from the *Reporter*.


In April 2020, [Coinbase started providing an Open Oracle compatible signed price feed](https://blog.coinbase.com/introducing-the-coinbase-price-oracle-6d1ee22c7068) so that anyone can publish their data on chain.
They were [followed by Okx](https://www.okx.com/academy/en/okex-enhances-support-for-defi-growth-with-its-secure-price-feed-okex-oracle) the same year.


This repository ports the on-chain [verification contracts](https://github.com/compound-finance/open-oracle/blob/0e148fdb0e8cbe4d412548490609679621ab2325/contracts/OpenOracleData.sol#L40-L43) of the standard from Ethereum over to StarkNet.


## Setup for development
Install Protostar. Clone the repository. Use python 3.7.

```bash
Expand Down Expand Up @@ -29,23 +46,35 @@ Then fill the necessary environment variables in `client/.env(fill_and_rename_to
- 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.
Note that OKX 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`)
After that edit the function `main()` in `client/main.py` so you can choose your assets, and if you want to fetch prices either from:
- okx (use `c.publish_open_oracle_entries_okx`)
- coinbase (use `c.publish_open_oracle_entries_coinbase`)
- both (use `c.publish_open_oracle_entries_all_publishers`).
- both (use `c.publish_open_oracle_entries_all_reporters`).

Supported assets are :
- BTC, ETH, DAI, ZRX, BAT, KNC, LINK, COMP (for both Coinbase and Okx)
- XTZ, REP, UNI, GRT, SNX. (for Coinbase only)

```python
async def main():
c = OpenOracleClient()
await c.publish_open_oracle_entries_okex(assets=['btc', 'eth'])
await c.publish_open_oracle_entries_all_reporters(assets=['btc', 'eth'])
```

Finally, don't forget to activate the virtual env and just run `python client/client.py`.
#### Run locally
Make sure you have activated the virtual env and just run `python client/main.py`.

All updates will happen in one transaction.

#### Build and use a Docker container

```bash
docker build -t python-open-oracle-client .
docker run --env-file client/.env python-open-oracle-client
```

## Contract deployment and current address

To deploy the contract, just use protostar like this :
Expand All @@ -55,6 +84,6 @@ 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 current version of the contract is deployed here : https://goerli.voyager.online/contract/0x03f0c6d6c792e8a1febc289e023de63824391a0056dd43a154bec792fec1ddff

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

0 comments on commit f72cbff

Please sign in to comment.